From 8237e2727da0d04b82cb3cf644dd337a4c77fe34 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 Oct 2012 13:38:32 -0800 Subject: [PATCH] selftest: Move determining of smbtorture4 options to selftesthelpers. --- selftest/selftesthelpers.py | 30 ++++++++++++++++++------------ source3/selftest/tests.py | 2 +- source4/selftest/tests.py | 17 +++++++---------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py index 66402903b78..40efc1f7efd 100644 --- a/selftest/selftesthelpers.py +++ b/selftest/selftesthelpers.py @@ -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 - - diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index c4b2aeeba5a..f0f0b8fdd3e 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -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) diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index b36f43bb4b1..08236c87446 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -20,9 +20,16 @@ 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)) -- 2.34.1