selftest: Move determining of smbtorture4 options to selftesthelpers.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 26 Oct 2012 21:38:32 +0000 (13:38 -0800)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 27 Oct 2012 13:16:18 +0000 (05:16 -0800)
selftest/selftesthelpers.py
source3/selftest/tests.py
source4/selftest/tests.py

index 6640290..40efc1f 100644 (file)
@@ -179,6 +179,15 @@ def planpythontestsuite(env, module, name=None, extra_path=[]):
     plantestsuite_idlist(name, env, args)
 
 
+def get_env_torture_options():
+    ret = []
+    if not os.getenv("SELFTEST_VERBOSE"):
+        ret.append("--option=torture:progress=no")
+    if os.getenv("SELFTEST_QUICK"):
+        ret.append("--option=torture:quick=yes")
+    return ret
+
+
 samba4srcdir = source4dir()
 bbdir = os.path.join(srcdir(), "testprogs/blackbox")
 configuration = "--configfile=$SMB_CONF_PATH"
@@ -186,26 +195,23 @@ configuration = "--configfile=$SMB_CONF_PATH"
 smbtorture4 = binpath("smbtorture4")
 smbtorture4_testsuite_list = subprocess.Popen([smbtorture4, "--list-suites"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate("")[0].splitlines()
 
+smbtorture4_options = [
+    configuration,
+    "--maximum-runtime=$SELFTEST_MAXTIME",
+    "--basedir=$SELFTEST_TMPDIR",
+    "--format=subunit"
+    ] + get_env_torture_options()
 
-def plansmbtorture4testsuite(name, env, options, modname=None):
+
+def plansmbtorture4testsuite(name, env, options, target, modname=None):
     if modname is None:
         modname = "samba4.%s" % name
     if isinstance(options, list):
         options = " ".join(options)
+    options += " " + " ".join(smbtorture4_options + ["--target=%s" % target])
     cmdline = "%s $LISTOPT %s %s" % (valgrindify(smbtorture4), options, name)
     plantestsuite_loadlist(modname, env, cmdline)
 
 
 def smbtorture4_testsuites(prefix):
     return filter(lambda x: x.startswith(prefix), smbtorture4_testsuite_list)
-
-
-def get_env_torture_options():
-    ret = []
-    if not os.getenv("SELFTEST_VERBOSE"):
-        ret.append("--option=torture:progress=no")
-    if os.getenv("SELFTEST_QUICK"):
-        ret.append("--option=torture:quick=yes")
-    return ret
-
-
index c4b2aee..f0f0b8f 100755 (executable)
@@ -43,7 +43,7 @@ torture_options = [configuration,
                    '--format=subunit'
                    ]
 
-torture_options.extend(env_get_torture_options())
+torture_options.extend(get_env_torture_options())
 
 smbtorture4 += " " + " ".join(torture_options)
 
index b36f43b..08236c8 100755 (executable)
 
 import os, sys
 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../selftest"))
+import selftesthelpers
 from selftesthelpers import *
 import subprocess
 
+print >>sys.stderr, "OPTIONS %s" % " ".join(smbtorture4_options)
+
+def plansmbtorture4testsuite(name, env, options, modname=None):
+    return selftesthelpers.plansmbtorture4testsuite(name, env, options,
+        target='samba4', modname=modname)
+
 samba4srcdir = source4dir()
 samba4bindir = bindir()
 validate = os.getenv("VALIDATE", "")
@@ -38,16 +45,6 @@ subprocess.call([smbtorture4, "-V"], stdout=sys.stderr)
 
 bbdir = os.path.join(srcdir(), "testprogs/blackbox")
 
-torture_options = [configuration,
-                   "--maximum-runtime=$SELFTEST_MAXTIME",
-                   "--target=samba4",
-                   "--basedir=$SELFTEST_TMPDIR",
-                   "--format=subunit"]
-torture_options.extend(get_env_torture_options())
-smbtorture4 += " " + " ".join(torture_options)
-
-print >>sys.stderr, "OPTIONS %s" % " ".join(torture_options)
-
 # Simple tests for LDAP and CLDAP
 for options in ['-U"$USERNAME%$PASSWORD" --option=socket:testnonblock=true', '-U"$USERNAME%$PASSWORD"', '-U"$USERNAME%$PASSWORD" -k yes', '-U"$USERNAME%$PASSWORD" -k no', '-U"$USERNAME%$PASSWORD" -k no --sign', '-U"$USERNAME%$PASSWORD" -k no --encrypt', '-U"$USERNAME%$PASSWORD" -k yes --encrypt', '-U"$USERNAME%$PASSWORD" -k yes --sign']:
     plantestsuite("samba4.ldb.ldap with options %s(dc)" % options, "dc", "%s/test_ldb.sh ldap $SERVER %s" % (bbdir, options))