[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Oct 19 21:15:04 UTC 2020


The branch, master has been updated
       via  67c437bf11c s3:tests: Improve test_force_close_share test
      from  40a4dd28627 spoolss.idl: remove obviously bogous PROCESSOR_ARM 0 define

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 67c437bf11caf6b9ec1ead62fbc5ba0f0f10d77a
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Sep 2 09:25:43 2020 +0200

    s3:tests: Improve test_force_close_share test
    
    This fixes the test with fast disks where 20MB transfers are done in
    less than a second.
    
    This also cleans up the code to have less sleeping time!
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Oct 19 21:14:21 UTC 2020 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 source3/script/tests/test_force_close_share.sh | 85 +++++++++++++++-----------
 source3/selftest/tests.py                      |  3 +-
 2 files changed, 50 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_force_close_share.sh b/source3/script/tests/test_force_close_share.sh
index da78b5a752e..46db07edfbe 100755
--- a/source3/script/tests/test_force_close_share.sh
+++ b/source3/script/tests/test_force_close_share.sh
@@ -9,57 +9,83 @@
 # the aio_delay_inject share which is preconfigured
 # with 2 second delays on pread/pwrite.
 
-if [ $# -lt 5 ]; then
-    echo Usage: test_share_force_close.sh \
-	 SERVERCONFFILE SMBCLIENT SMBCONTROL IP aio_delay_inject_sharename
-exit 1
+if [ $# -lt 6 ]; then
+    echo Usage: $0 SERVERCONFFILE SMBCLIENT SMBCONTROL IP aio_delay_inject_sharename PREFIX
+    exit 1
 fi
 
-CONF=$1
-SMBCLIENT=$2
+CONFIGURATION=$1
+smbclient=$2
 SMBCONTROL=$3
 SERVER=$4
 SHARE=$5
+PREFIX=$6
+shift 6
 
 incdir=$(dirname $0)/../../../testprogs/blackbox
 . $incdir/subunit.sh
+. $incdir/common_test_fns.inc
 
 failed=0
 
+mkdir -p $PREFIX/private
+
+FIFO_STDIN="$PREFIX/smbclient-stdin"
+FIFO_STDOUT="$PREFIX/smbclient-stdout"
+FIFO_STDERR="$PREFIX/smbclient-stderr"
+TESTFILE="$PREFIX/testfile"
+
+rm -f $FIFO_STDIN $FIFO_STDOUT $FIFO_STDERR $TESTFILE 2>/dev/null
+
 # Create the smbclient communication pipes.
-rm -f smbclient-stdin smbclient-stdout smbclient-stderr
-mkfifo smbclient-stdin smbclient-stdout smbclient-stderr
+mkfifo $FIFO_STDIN $FIFO_STDOUT $FIFO_STDERR
+if [ $? -ne 0 ]; then
+    echo "Failed to create fifos"
+    exit 1
+fi
 
 # Create a large-ish testfile
-rm testfile
-head -c 20MB /dev/zero >testfile
+head -c 100MB /dev/zero >$TESTFILE
 
 CLI_FORCE_INTERACTIVE=1; export CLI_FORCE_INTERACTIVE
 
-${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
-	     < smbclient-stdin > smbclient-stdout 2>smbclient-stderr &
+${smbclient} //${SERVER}/${SHARE} ${CONFIGURATION} -U${USER}%${PASSWORD} \
+    < $FIFO_STDIN > $FIFO_STDOUT 2>$FIFO_STDERR &
 CLIENT_PID=$!
 
-sleep 1
-
-exec 100>smbclient-stdin  101<smbclient-stdout 102<smbclient-stderr
+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))
+done
+
+exec 100>$FIFO_STDIN  101<$FIFO_STDOUT 102<$FIFO_STDERR
 
 # consume the smbclient startup messages
 head -n 1 <&101
 head -n 1 <&102
 
 # Ensure we're putting a fresh file.
+echo "lcd $(dirname $TESTFILE)" >&100
 echo "del testfile" >&100
 echo "put testfile" >&100
 
-sleep 1
+sleep 0.2
 
 # Close the aio_delay_inject share whilst we have outstanding writes.
 
-testit "smbcontrol" ${SMBCONTROL} ${CONF} smbd close-share ${SHARE} ||
+testit "smbcontrol" ${SMBCONTROL} ${CONFIGURATION} smbd close-share ${SHARE} ||
     failed=$(expr $failed + 1)
 
-sleep 1
+sleep 0.5
 
 # If we get one or more NT_STATUS_NETWORK_NAME_DELETED
 # or NT_STATUS_INVALID_HANDLE on stderr from the writes we
@@ -77,24 +103,9 @@ testit "Verify close-share did cancel the file put" \
 
 kill ${CLIENT_PID}
 
-# Rerun smbclient to remove the testfile on the server.
-rm -f smbclient-stdin smbclient-stdout smbclient-stderr testfile
-mkfifo smbclient-stdin smbclient-stdout
-
-${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
-	     < smbclient-stdin > smbclient-stdout &
-CLIENT_PID=$!
-
-sleep 1
-
-exec 100>smbclient-stdin  101<smbclient-stdout
-
-echo "del testfile" >&100
-
-sleep 1
-
-kill ${CLIENT_PID}
-
-rm -f smbclient-stdin smbclient-stdout testfile
+# Remove the testfile from the server
+test_smbclient "remove_testfile" \
+    'del testfile; quit' //${SERVER}/${SHARE} -U${USER}%${PASSWORD} \
+    || failed=$(expr $failed + 1)
 
 testok $0 $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index f0b01a8a740..604a13b95da 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -968,7 +968,8 @@ plantestsuite("samba3.blackbox.force-close-share", "simpleserver:local",
                os.path.join(bindir(), "smbclient"),
                os.path.join(bindir(), "smbcontrol"),
                '$SERVER_IP',
-               "aio_delay_inject"])
+               "aio_delay_inject",
+               '$PREFIX/force-close-share'])
 
 plantestsuite("samba3.blackbox.open-eintr", "simpleserver:local",
               [os.path.join(samba3srcdir,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list