summaryrefslogtreecommitdiff
path: root/selftest
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2021-07-27 13:45:03 +0200
committerJule Anger <janger@samba.org>2021-09-08 12:32:10 +0000
commit36a99feeafba8e407c353a748ce114945eac9fd6 (patch)
tree208fbd8b5a36c1632fe0d4ece678a00825259bc2 /selftest
parentdaab1eba30ae5b27b3e3550352d2c543e6336414 (diff)
downloadsamba-36a99feeafba8e407c353a748ce114945eac9fd6.tar.gz
selftest: Add support for setting ENV variables in plantestsuite()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=14817 (cherry picked from commit 48289b6964d28e153fec885aceca02c6a9b436ef)
Diffstat (limited to 'selftest')
-rw-r--r--selftest/selftesthelpers.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py
index 524026248d9..542737dbd10 100644
--- a/selftest/selftesthelpers.py
+++ b/selftest/selftesthelpers.py
@@ -66,7 +66,7 @@ def valgrindify(cmdline):
return valgrind + " " + cmdline
-def plantestsuite(name, env, cmdline):
+def plantestsuite(name, env, cmd, environ={}):
"""Plan a test suite.
:param name: Testsuite name
@@ -80,8 +80,18 @@ def plantestsuite(name, env, cmdline):
fullname = "%s(%s)" % (name, env)
print(fullname)
print(env)
- if isinstance(cmdline, list):
- cmdline = " ".join(cmdline)
+
+ cmdline = ""
+ if environ:
+ environ = dict(environ)
+ cmdline_env = ["%s=%s" % item for item in environ.items()]
+ cmdline = " ".join(cmdline_env) + " "
+
+ if isinstance(cmd, list):
+ cmdline += " ".join(cmd)
+ else:
+ cmdline += cmd
+
if "$LISTOPT" in cmdline:
raise AssertionError("test %s supports --list, but not --load-list" % name)
print(cmdline + " 2>&1 " + " | " + add_prefix(name, env))
@@ -182,14 +192,17 @@ smbtorture4_options = [
] + get_env_torture_options()
-def plansmbtorture4testsuite(name, env, options, target, environ={}, modname=None):
+def plansmbtorture4testsuite(name, env, options, target, modname=None, environ={}):
if modname is None:
modname = "samba4.%s" % name
if isinstance(options, list):
options = " ".join(options)
options = " ".join(smbtorture4_options + ["--target=%s" % target]) + " " + options
- cmdline = ["%s=%s" % item for item in environ.items()]
- cmdline += "%s $LISTOPT $LOADLIST %s %s" % (valgrindify(smbtorture4), options, name)
+ cmdline = ""
+ if environ:
+ environ = dict(environ)
+ cmdline = ["%s=%s" % item for item in environ.items()]
+ cmdline += " %s $LISTOPT $LOADLIST %s %s" % (valgrindify(smbtorture4), options, name)
plantestsuite_loadlist(modname, env, cmdline)