From e644e783060fc44082f683a7d36384173a79e899 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 23 Feb 2022 18:10:59 +0100 Subject: [PATCH] CI: add a test for async dosmode on a file in a shadow_copy2 snapshot Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit 1097b1d0776661d873861672ca38e5892014725d) --- .../script/tests/test_shadow_copy_torture.sh | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/source3/script/tests/test_shadow_copy_torture.sh b/source3/script/tests/test_shadow_copy_torture.sh index e5dc0192e95..4ae2f9f707f 100755 --- a/source3/script/tests/test_shadow_copy_torture.sh +++ b/source3/script/tests/test_shadow_copy_torture.sh @@ -150,6 +150,47 @@ test_shadow_copy_fix_inodes() echo $out | grep "hardlink: for read/write fnum 1" || return 1 } +build_hiddenfile() +{ + local snapdir + + snapdir=$WORKDIR/.snapshots + + #delete snapshots from previous tests + find $WORKDIR -name ".snapshots" -exec rm -rf {} \; 1>/dev/null 2>&1 + build_snapshots + + touch $WORKDIR/hiddenfile + + # Create a file with hidden attribute + $SMBCLIENT -U $USERNAME%$PASSWORD \ + "//$SERVER/shadow_write" \ + -c "put $WORKDIR/hiddenfile hiddenfile; setmode hiddenfile +h" + # ...and move it to the snapshot directory + mv $WORKDIR/hiddenfile $snapdir/$SNAPSHOT/ +} + +test_hiddenfile() +{ + build_hiddenfile + + out=$($SMBCLIENT \ + -U $USERNAME%$PASSWORD \ + "//$SERVER/shadow_write" \ + -c "allinfo $SNAPSHOT/hiddenfile") || return 1 + echo $out + echo $out | grep "attributes: HA (22)" || return 1 + + out=$($SMBCLIENT \ + -U $USERNAME%$PASSWORD \ + "//$SERVER/shadow_write" \ + -c "ls $SNAPSHOT/hiddenfile") || return 1 + echo $out + echo $out | grep "hiddenfile[[:blank:]]*AH" || return 1 + + return 0 +} + build_files $WORKDIR # test open for writing and write behaviour of snapshoted files @@ -161,4 +202,6 @@ test_shadow_copy_openroot "opening root of shadow copy share" testit "fix inodes with hardlink" test_shadow_copy_fix_inodes || failed=`expr $failed + 1` +testit "Test reading DOS attribute" test_hiddenfile || failed=`expr $failed + 1` + exit $failed