Can specify Valgrind command line arguments.

pull/15/head
Jussi Pakkanen 10 years ago
parent 1419a6a316
commit b97a8c82e7
  1. 6
      backends.py
  2. 11
      interpreter.py
  3. 2
      meson_test.py

@ -86,7 +86,8 @@ def do_conf_file(src, dst, confdata):
replace_if_different(dst, dst_tmp)
class TestSerialisation:
def __init__(self, name, fname, is_cross, exe_wrapper, is_parallel, cmd_args, env):
def __init__(self, name, fname, is_cross, exe_wrapper, is_parallel, cmd_args, env,
valgrind_args):
self.name = name
self.fname = fname
self.is_cross = is_cross
@ -94,6 +95,7 @@ class TestSerialisation:
self.is_parallel = is_parallel
self.cmd_args = cmd_args
self.env = env
self.valgrind_args = valgrind_args
# This class contains the basic functionality that is needed by all backends.
# Feel free to move stuff in and out of it as you see fit.
@ -308,7 +310,7 @@ class Backend():
else:
exe_wrapper = None
ts = TestSerialisation(t.get_name(), fname, is_cross, exe_wrapper,
t.is_parallel, t.cmd_args, t.env)
t.is_parallel, t.cmd_args, t.env, t.valgrind_args)
arr.append(ts)
pickle.dump(arr, datafile)

@ -392,13 +392,14 @@ class RunTargetHolder(InterpreterObject):
self.held_object = build.RunTarget(name, command, args, subdir)
class Test(InterpreterObject):
def __init__(self, name, exe, is_parallel, cmd_args, env):
def __init__(self, name, exe, is_parallel, cmd_args, env, valgrind_args):
InterpreterObject.__init__(self)
self.name = name
self.exe = exe
self.is_parallel = is_parallel
self.cmd_args = cmd_args
self.env = env
self.valgrind_args = valgrind_args
def get_exe(self):
return self.exe
@ -1131,7 +1132,13 @@ class Interpreter():
if ' ' in k:
raise InterpreterException('Env var key must not have spaces in it.')
env[k] = val
t = Test(args[0], args[1].held_object, par, cmd_args, env)
valgrind_args = kwargs.get('valgrind_args', [])
if not isinstance(valgrind_args, list):
valgrind_args = [valgrind_args]
for a in valgrind_args:
if not isinstance(a, str):
raise InterpreterException('Valgrind_arg not a string.')
t = Test(args[0], args[1].held_object, par, cmd_args, env, valgrind_args)
self.build.tests.append(t)
mlog.debug('Adding test "', mlog.bold(args[0]), '".', sep='')

@ -72,6 +72,8 @@ def run_single_test(wrap, test):
cmd = [test.exe_runner, test.fname]
else:
cmd = [test.fname]
if len(wrap) > 0 and 'valgrind' in wrap[0]:
wrap += test.valgrind_args
if cmd is None:
res = 'SKIP'
duration = 0.0

Loading…
Cancel
Save