From: Andreas Schneider Date: Fri, 22 Apr 2022 13:34:08 +0000 (+0200) Subject: s3:tests: Reformat test_force_close_share.sh X-Git-Tag: talloc-2.3.4~250 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2af74a2bdd4d10d50843bb395114f848438543d8;p=thirdparty%2Fsamba.git s3:tests: Reformat test_force_close_share.sh shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source3/script/tests/test_force_close_share.sh b/source3/script/tests/test_force_close_share.sh index 2d01b3162f1..87276ad1a08 100755 --- a/source3/script/tests/test_force_close_share.sh +++ b/source3/script/tests/test_force_close_share.sh @@ -10,8 +10,8 @@ # with 2 second delays on pread/pwrite. if [ $# -lt 6 ]; then - echo Usage: $0 SERVERCONFFILE SMBCLIENT SMBCONTROL IP aio_delay_inject_sharename PREFIX - exit 1 + echo Usage: $0 SERVERCONFFILE SMBCLIENT SMBCONTROL IP aio_delay_inject_sharename PREFIX + exit 1 fi CONFIGURATION=$1 @@ -44,34 +44,35 @@ rm -f $FIFO_STDIN $FIFO_STDOUT $FIFO_STDERR $TESTFILE 2>/dev/null # Create the smbclient communication pipes. mkfifo $FIFO_STDIN $FIFO_STDOUT $FIFO_STDERR if [ $? -ne 0 ]; then - echo "Failed to create fifos" - exit 1 + echo "Failed to create fifos" + exit 1 fi # Create a large-ish testfile head -c 100MB /dev/zero >$TESTFILE -CLI_FORCE_INTERACTIVE=1; export CLI_FORCE_INTERACTIVE +CLI_FORCE_INTERACTIVE=1 +export CLI_FORCE_INTERACTIVE ${smbclient} //${SERVER}/${SHARE} ${CONFIGURATION} -U${USER}%${PASSWORD} \ - < $FIFO_STDIN > $FIFO_STDOUT 2>$FIFO_STDERR & + <$FIFO_STDIN >$FIFO_STDOUT 2>$FIFO_STDERR & CLIENT_PID=$! count=0 while [ 1 ]; do - if [ $count -ge 20 ]; then - echo "Failed to start smbclient" - exit 1 - fi - kill -0 $CLIENT_PID - if [ $? -eq 0 ]; then - break - fi - sleep 0.5 - count=$((count + 1)) + if [ $count -ge 20 ]; then + echo "Failed to start smbclient" + exit 1 + fi + kill -0 $CLIENT_PID + if [ $? -eq 0 ]; then + break + fi + sleep 0.5 + count=$((count + 1)) done -exec 100>$FIFO_STDIN 101<$FIFO_STDOUT 102<$FIFO_STDERR +exec 100>$FIFO_STDIN 101<$FIFO_STDOUT 102<$FIFO_STDERR # consume the smbclient startup messages head -n 1 <&101 @@ -86,7 +87,7 @@ sleep 0.2 # Close the aio_delay_inject share whilst we have outstanding writes. testit "smbcontrol" ${SMBCONTROL} ${CONFIGURATION} smbd close-share ${SHARE} || - failed=$(expr $failed + 1) + failed=$(expr $failed + 1) sleep 0.5 @@ -98,17 +99,17 @@ sleep 0.5 # BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 # COUNT=$(head -n 2 <&102 | - grep -e NT_STATUS_NETWORK_NAME_DELETED -e NT_STATUS_INVALID_HANDLE | - wc -l) + grep -e NT_STATUS_NETWORK_NAME_DELETED -e NT_STATUS_INVALID_HANDLE | + wc -l) testit "Verify close-share did cancel the file put" \ - test $COUNT -ge 1 || failed=$(expr $failed + 1) + test $COUNT -ge 1 || failed=$(expr $failed + 1) kill ${CLIENT_PID} # Remove the testfile from the server test_smbclient "remove_testfile" \ - 'del testfile; quit' //${SERVER}/${SHARE} -U${USER}%${PASSWORD} \ - || failed=$(expr $failed + 1) + 'del testfile; quit' //${SERVER}/${SHARE} -U${USER}%${PASSWORD} || + failed=$(expr $failed + 1) testok $0 $failed