From 91331283beb6fedfa5e75a051ae648b55abc94bf Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 22 Mar 2013 22:48:28 +0200 Subject: [PATCH] Can run test suite under Valgrind. --- backends.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backends.py b/backends.py index 68dd14287..f9bcbb65d 100755 --- a/backends.py +++ b/backends.py @@ -395,14 +395,22 @@ class NinjaBackend(Backend): d.data.append(i) def generate_tests(self, outfile): + valgrind = environment.find_valgrind() script_root = self.environment.get_script_dir() test_script = os.path.join(script_root, 'meson_test.py') test_data = os.path.join(self.environment.get_scratch_dir(), 'meson_test_setup.dat') + cmd = [sys.executable, test_script, test_data] elem = NinjaBuildElement('test', 'CUSTOM_COMMAND', 'all') - elem.add_item('COMMAND', [sys.executable, test_script, test_data]) + elem.add_item('COMMAND', cmd) elem.add_item('DESC', 'Running test suite.') elem.write(outfile) - + + if valgrind: + velem = NinjaBuildElement('test-valgrind', 'CUSTOM_COMMAND', 'all') + velem.add_item('COMMAND', cmd + ['--wrapper=' + valgrind]) + velem.add_item('DESC', 'Running test suite under valgrind.') + velem.write(outfile) + datafile = open(test_data, 'w') for t in self.build.get_tests(): datafile.write(self.get_target_filename(t.get_exe()) + '\n')