1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

selftest: Add support for setting ENV variables in plantestsuite()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2021-07-27 13:45:03 +02:00 committed by Andreas Schneider
parent 3db299e586
commit 48289b6964

View File

@ -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,12 +192,15 @@ 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 = ""
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)