]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests: Show that we 100% loop in cli_list_old_recv()
authorVolker Lendecke <vl@samba.org>
Thu, 1 Jun 2023 14:41:37 +0000 (16:41 +0200)
committerJule Anger <janger@samba.org>
Fri, 2 Jun 2023 12:51:11 +0000 (12:51 +0000)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=15382

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e86234f3d61c62e4365e1ea105bdd29feaf7ccbe)

selftest/knownfail.d/old-dirlist [new file with mode: 0644]
source3/script/tests/test_old_dirlisting.sh [new file with mode: 0755]
source3/selftest/tests.py

diff --git a/selftest/knownfail.d/old-dirlist b/selftest/knownfail.d/old-dirlist
new file mode 100644 (file)
index 0000000..0c1066a
--- /dev/null
@@ -0,0 +1 @@
+^samba3.blackbox.smbclient_old_dir.*
diff --git a/source3/script/tests/test_old_dirlisting.sh b/source3/script/tests/test_old_dirlisting.sh
new file mode 100755 (executable)
index 0000000..f50a474
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# This tests listing directories using the SMBSearch call family
+
+if [ $# -lt 2 ]; then
+    cat <<EOF
+Usage: $0 TIMELIMIT SMBCLIENT
+EOF
+    exit 1
+fi
+
+TIMELIMIT="$1"
+shift
+SMBCLIENT="$VALGRIND $1"
+shift
+
+incdir=$(dirname $0)/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+# Make sure we don't loop 100% CPU. A normal dir listing should return
+# in less than 3 seconds. At the point of this commit smbclient -c dir
+# | wc returns 43 lines, so checking for 100 lines should be well
+# enough.
+
+count=$($TIMELIMIT 3 $SMBCLIENT //"$SERVER_IP"/tmpguest -m LANMAN1 -U% \
+                  -c dir | wc -l)
+
+testit "listing shares with LANMAN1" test ${count} -le 100 ||
+    failed=$((failed + 1))
index 2c5ae8cff4f69befeb84c399f04a1c9ecafa96ca..04349c1f1f759495b7837bac86b3b85497150715 100755 (executable)
@@ -33,6 +33,7 @@ from selftesthelpers import valgrindify, smbtorture4_testsuites
 from selftesthelpers import smbtorture4_options
 from selftesthelpers import smbcontrol
 from selftesthelpers import smbstatus
+from selftesthelpers import timelimit
 smbtorture4_options.extend([
     '--option=torture:sharedelay=100000',
    '--option=torture:writetimeupdatedelay=500000',
@@ -690,6 +691,11 @@ for env in ["fileserver"]:
                   '$SERVER', 'fruit_resource_stream', '$USERNAME', '$PASSWORD',
                   '$LOCAL_PATH/fruit_resource_stream', smbclient3])
 
+plantestsuite("samba3.blackbox.smbclient_old_dir", "fileserver_smb1",
+              [os.path.join(samba3srcdir,
+                            "script/tests/test_old_dirlisting.sh"),
+               timelimit, smbclient3])
+
 for env in ["fileserver:local"]:
     plantestsuite("samba3.blackbox.net_usershare", env, [os.path.join(samba3srcdir, "script/tests/test_net_usershare.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', smbclient3])