From 1f76b76a84cb635f764ecbd2b77aaba1d375d72b Mon Sep 17 00:00:00 2001 From: Hemmo Nieminen Date: Fri, 3 Jun 2016 21:21:26 +0300 Subject: [PATCH] Add support for running specific test suites with valgrind. --- mesonbuild/backend/ninjabackend.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 7a4b0cd96..b97d99e37 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -131,6 +131,7 @@ class NinjaBackend(backends.Backend): self.ninja_filename = 'build.ninja' self.fortran_deps = {} self.all_outputs = {} + self.valgrind = environment.find_valgrind() def detect_vs_dep_prefix(self, outfile, tempfilename): '''VS writes its dependency in a locale dependent format. @@ -575,9 +576,15 @@ int dummy; elem.add_item('pool', 'console') elem.write(outfile) + if self.valgrind: + velem = NinjaBuildElement(self.all_outputs, 'test-valgrind:' + s, 'CUSTOM_COMMAND', ['all', 'PHONY']) + velem.add_item('COMMAND', cmd + ['--wrapper=' + self.valgrind, '--suite=' + s]) + velem.add_item('DESC', 'Running test suite %s under Valgrind.' % visible_name) + velem.add_item('pool', 'console') + velem.write(outfile) + def generate_tests(self, outfile): (test_data, benchmark_data) = self.serialise_tests() - valgrind = environment.find_valgrind() script_root = self.environment.get_script_dir() cmd = [ sys.executable, self.environment.get_build_command(), '--internal', 'test' ] if not self.environment.coredata.get_builtin_option('stdsplit'): @@ -592,9 +599,9 @@ int dummy; elem.write(outfile) self.write_test_suite_targets(cmd, outfile) - if valgrind: + if self.valgrind: velem = NinjaBuildElement(self.all_outputs, 'test-valgrind', 'CUSTOM_COMMAND', ['all', 'PHONY']) - velem.add_item('COMMAND', cmd + ['--wrapper=' + valgrind]) + velem.add_item('COMMAND', cmd + ['--wrapper=' + self.valgrind]) velem.add_item('DESC', 'Running test suite under Valgrind.') velem.add_item('pool', 'console') velem.write(outfile)