From b97a8c82e7d0c54d643c64358d24dfb9b1fa1d3e Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 24 Aug 2014 01:41:12 +0300 Subject: [PATCH] Can specify Valgrind command line arguments. --- backends.py | 6 ++++-- interpreter.py | 11 +++++++++-- meson_test.py | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/backends.py b/backends.py index cae8e6b4d..559113987 100644 --- a/backends.py +++ b/backends.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) diff --git a/interpreter.py b/interpreter.py index 1d6a1323a..2893b8d95 100644 --- a/interpreter.py +++ b/interpreter.py @@ -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='') diff --git a/meson_test.py b/meson_test.py index 1584ee581..170dbd3e7 100755 --- a/meson_test.py +++ b/meson_test.py @@ -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