[PATCH] Add libsmbclient list shares test

Jeremy Allison jra at samba.org
Tue Aug 28 23:30:38 UTC 2018


On Mon, Aug 27, 2018 at 05:29:22PM +0200, Andreas Schneider via samba-technical wrote:
> Hi,
> 
> the attached patch adds a test for listing shares using libsmbclient and fixes 
> teh tests to run against a target with smbd.
> 
> 
> Please review and push if OK.

OK Andreas, with the following additional (attached) diff I
can get this to pass a local:

make test TESTS=libsmbclient

I'll leave it to you to merge this into your
patchset.

First thing is to split out the change I had
to make to source3/selftest/tests.py that splits
the string:

-libsmbclient = ["libsmbclient"]
+libsmbclient = ["libsmbclient.version", "libsmbclient.initialize",
+               "libsmbclient.configuration", "libsmbclient.setConfiguration",
+               "libsmbclient.options", "libsmbclient.opendir",
+               "libsmbclient.list_shares", "libsmbclient.readdirplus"]

(minus the "libsmbclient.list_shares" entry) and add in the

    elif t == "libsmbclient":
+    elif t.startswith("libsmbclient"):

hunk as a separate prerequisite change. Once that's in you need to
edit the part of the patch that adds the new test to source4/selftest/tests.py
to also add it to source3/selftest/tests.py in the way shown.

If you don't have time to do this, let me know and
I'll merge the changes into a new patch for you
to review. But I'd rather you did it (as I had
to spend the time figuring all this shit out :-).

Cheers,

	Jeremy.
-------------- next part --------------
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index ed241f002da..3b6735231de 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -431,7 +431,10 @@ unix = ["unix.info2", "unix.whoami"]
 
 nbt = ["nbt.dgram"]
 
-libsmbclient = ["libsmbclient"]
+libsmbclient = ["libsmbclient.version", "libsmbclient.initialize",
+		"libsmbclient.configuration", "libsmbclient.setConfiguration",
+		"libsmbclient.options", "libsmbclient.opendir",
+		"libsmbclient.list_shares", "libsmbclient.readdirplus"]
 
 vfs = ["vfs.fruit", "vfs.acl_xattr", "vfs.fruit_netatalk", "vfs.fruit_file_id", "vfs.fruit_timemachine"]
 
@@ -579,13 +582,17 @@ for t in tests:
     elif t == "rpc.samba3.netlogon" or t == "rpc.samba3.sessionkey":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest')
-    elif t == "libsmbclient":
+    elif t.startswith("libsmbclient"):
+	url = "smb://$USERNAME:$PASSWORD@$SERVER/tmp"
+	if t == "libsmbclient.list_shares":
+		url = "smb://$USERNAME:$PASSWORD@$SERVER"
+
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%%$PASSWORD '
-                                    '--option=torture:smburl=smb://$USERNAME:$PASSWORD@$SERVER/tmp '
-                                    '--option=torture:replace_smbconf=%s' % os.path.join(srcdir(), "testdata/samba3/smb_new.conf"))
+                                    '--option=torture:smburl=' + url +
+                                    ' --option=torture:replace_smbconf=%s' % os.path.join(srcdir(), "testdata/samba3/smb_new.conf"))
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%%$PASSWORD '
-                                    '--option=torture:smburl=smb://$USERNAME:$PASSWORD@$SERVER/tmp '
-                                    '--option=torture:replace_smbconf=%s' % os.path.join(srcdir(), "testdata/samba3/smb_new.conf"))
+                                    '--option=torture:smburl=' + url +
+                                    ' --option=torture:replace_smbconf=%s' % os.path.join(srcdir(), "testdata/samba3/smb_new.conf"))
     elif t == "smb2.streams":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index b0d597017f3..eb85fecbcc6 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -328,7 +328,7 @@ for t in base + raw + smb2 + netapi:
 libsmbclient = smbtorture4_testsuites("libsmbclient.")
 for t in libsmbclient:
     url = "smb://$USERNAME:$PASSWORD@$SERVER/tmp"
-    if "list_shares" in t:
+    if t == "libsmbclient.list_shares":
         url = "smb://$USERNAME:$PASSWORD@$SERVER"
 
     libsmbclient_testargs = ["--option=torture:smburl=" + url,


More information about the samba-technical mailing list