selftesthelpers: Add function for printing smbtorture4 version.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 26 Oct 2012 21:51:54 +0000 (13:51 -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 40efc1f7efd91c483d9aa9fcaa176bc32842ead2..ff5bbd7f1f62f1437b6b4485ed328eac6ed89d2d 100644 (file)
@@ -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)
 
index f0f0b8fdd3eb67526bc11ba8ff95ea41f91a453c..6935e89e4898491f5a326bc20bbd3baca8c5803b 100755 (executable)
@@ -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=''):
index 08236c87446eeba4a8ad961d437ecfc5b61fa3ef..422be2ba0611a2f97c572f31ecac34d762ecef4b 100755 (executable)
@@ -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")