Commit 59ee7970 authored by Julien Muchembled's avatar Julien Muchembled

testnode: use PATH instead of command-line options to provide extra binaries

The /bin/ folder of all extra SR provided by the testnode are added to PATH.
SR must fixed either by moving executables or adding symlinks.

The testnode will stop looking at the parameter list of runTestSuite,
and --firefox_bin/--xvfb_bin are deprecated.

This is part of defining a generic and unique API between the testnode and
the tested software.
parent 71d55f86
......@@ -160,7 +160,7 @@ class ProcessManager(object):
if new_session:
subprocess_kw['preexec_fn'] = os.setsid
raise_error_if_fail = kw.pop('raise_error_if_fail', True)
env = kw and dict(os.environ, **kw) or None
env = dict(os.environ, **kw) if kw else None
command = format_command(*args, **kw)'subprocess_kw : %r', subprocess_kw)'$ %s', command)
......@@ -139,18 +139,22 @@ class UnitTestRunner(object):
'--revision', node_test_suite.revision,
'--test_suite', node_test_suite.test_suite,
'--test_suite_title', node_test_suite.test_suite_title)
soft = config['slapos_directory'] + '/soft/'
software_list = [soft + md5digest(x) for x in config['software_list']]
PATH = os.getenv('PATH', '')
PATH = ':'.join(x + '/bin' for x in software_list) + (PATH and ':' + PATH)
supported_parameter_set = set(self.testnode.process_manager
def part(path):
path = config['slapos_directory'] + '/soft/%s/parts/' + path
path, = filter(os.path.exists, (path % md5digest(software)
for software in config['software_list']))
def path(name, compat): # BBB
path, = filter(os.path.exists, (base + relative
for relative in ('/bin/' + name, '/parts/' + compat)
for base in software_list))
return path
for option, value in (
('--firefox_bin', lambda: part('firefox/firefox-slapos')),
('--firefox_bin', lambda: path('firefox', 'firefox/firefox-slapos')),
('--frontend_url', lambda: config['frontend_url']),
('--node_quantity', lambda: config['node_quantity']),
('--xvfb_bin', lambda: part('xserver/bin/Xvfb')),
('--xvfb_bin', lambda: path('xvfb', 'xserver/bin/Xvfb')),
if option in supported_parameter_set:
invocation_list += option, value()
......@@ -165,7 +169,7 @@ class UnitTestRunner(object):
# result. We only do cleanup if the test runner itself is not able
# to run.
createFolder(node_test_suite.test_suite_directory, clean=True)
self.testnode.process_manager.spawn(*invocation_list, PATH=PATH,
log_prefix='runTestSuite', get_output=False)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment