]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:tests: Reformat test_force_close_share.sh
authorAndreas Schneider <asn@samba.org>
Fri, 22 Apr 2022 13:34:08 +0000 (15:34 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 5 May 2022 11:00:35 +0000 (11:00 +0000)
shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/script/tests/test_force_close_share.sh

index 2d01b3162f119c025f2f226f0a88d6269dfd310b..87276ad1a08999b10b27dd1de53214fe27f4695f 100755 (executable)
@@ -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