summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-10-26 13:51:54 -0800
committerJelmer Vernooij <jelmer@samba.org>2012-10-27 05:16:18 -0800
commit58345820c078f79fe7f67b8e6f947691f7237641 (patch)
treef6b781d20a661a636ea699db6449442a63fa3973
parent8237e2727da0d04b82cb3cf644dd337a4c77fe34 (diff)
downloadsamba-58345820c078f79fe7f67b8e6f947691f7237641.tar.gz
samba-58345820c078f79fe7f67b8e6f947691f7237641.tar.bz2
samba-58345820c078f79fe7f67b8e6f947691f7237641.zip
selftesthelpers: Add function for printing smbtorture4 version.
-rw-r--r--selftest/selftesthelpers.py12
-rwxr-xr-xsource3/selftest/tests.py5
-rwxr-xr-xsource4/selftest/tests.py3
3 files changed, 13 insertions, 7 deletions
diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py
index 40efc1f7ef..ff5bbd7f1f 100644
--- a/selftest/selftesthelpers.py
+++ b/selftest/selftesthelpers.py
@@ -203,12 +203,22 @@ smbtorture4_options = [
] + get_env_torture_options()
+def print_smbtorture4_version():
+ """Print the version of Samba smbtorture4 comes from.
+
+ :return: Whether smbtorture4 was successfully run
+ """
+ sub = subprocess.Popen([smbtorture4, "-V"], stdout=sys.stderr)
+ sub.communicate("")
+ return (sub.returncode == 0)
+
+
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])
+ options = " ".join(smbtorture4_options + ["--target=%s" % target]) + " " + options
cmdline = "%s $LISTOPT %s %s" % (valgrindify(smbtorture4), options, name)
plantestsuite_loadlist(modname, env, cmdline)
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index f0f0b8fdd3..6935e89e48 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -21,7 +21,6 @@
import os, sys
sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(__file__), "../../selftest")))
from selftesthelpers import *
-import subprocess
samba3srcdir = srcdir() + "/source3"
scriptdir = os.path.join(samba3srcdir, "../script/tests")
@@ -47,9 +46,7 @@ torture_options.extend(get_env_torture_options())
smbtorture4 += " " + " ".join(torture_options)
-sub = subprocess.Popen("%s --version 2> /dev/null" % smbtorture4, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
-sub.communicate("")
-smbtorture4_possible = (sub.returncode == 0)
+smbtorture4_possible = print_smbtorture4_version()
def plansmbtorturetestsuite(name, env, options, description=''):
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 08236c8744..422be2ba06 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -22,7 +22,6 @@ 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)
@@ -41,7 +40,7 @@ else:
nmblookup = binpath('nmblookup4')
smbclient = binpath('smbclient4')
-subprocess.call([smbtorture4, "-V"], stdout=sys.stderr)
+print_smbtorture4_version()
bbdir = os.path.join(srcdir(), "testprogs/blackbox")