From 30bbcded235018bc7a353d67e93a5e5e5c7ec592 Mon Sep 17 00:00:00 2001 From: Hemmo Nieminen Date: Tue, 17 May 2016 21:50:34 +0300 Subject: meson_test: Fix a bug in valgrind argument handling. Do not modify the wrap command argument from the calling function. Appending the valgrind arguments to the wrap list argument will cause all the valgrind arguments to cumulate from all the tests to the wrapper command itself. --- mesonbuild/scripts/meson_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mesonbuild/scripts/meson_test.py b/mesonbuild/scripts/meson_test.py index 524dc7a..33b6165 100644 --- a/mesonbuild/scripts/meson_test.py +++ b/mesonbuild/scripts/meson_test.py @@ -110,8 +110,6 @@ 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 @@ -119,7 +117,10 @@ def run_single_test(wrap, test): stde = None returncode = -1 else: - cmd = wrap + cmd + test.cmd_args + if len(wrap) > 0 and 'valgrind' in wrap[0]: + cmd = wrap + test.valgrind_args + cmd + test.cmd_args + else: + cmd = wrap + cmd + test.cmd_args starttime = time.time() child_env = os.environ.copy() child_env.update(test.env) -- cgit v1.1 From fac6f869e08c139d8d84cff56c479a10cad7ac8e Mon Sep 17 00:00:00 2001 From: Hemmo Nieminen Date: Fri, 3 Jun 2016 21:17:57 +0300 Subject: Change test suite separator character from '-' to ':'. This allows defining test suites for test-valgrind target without the risk of e.g. being unable to differentiate the targets test-valgrind (testing with valgrind) from test-valgrind (testing the valgrind subproject). --- mesonbuild/backend/ninjabackend.py | 2 +- mesonbuild/coredata.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 077254d..7a4b0cd 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -569,7 +569,7 @@ int dummy; visible_name = 'for top level tests' else: visible_name = s - elem = NinjaBuildElement(self.all_outputs, 'test-' + s, 'CUSTOM_COMMAND', ['all', 'PHONY']) + elem = NinjaBuildElement(self.all_outputs, 'test:' + s, 'CUSTOM_COMMAND', ['all', 'PHONY']) elem.add_item('COMMAND', cmd + ['--suite=' + s]) elem.add_item('DESC', 'Running test suite %s.' % visible_name) elem.add_item('pool', 'console') diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 9507a03..494c89f 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -228,8 +228,9 @@ forbidden_target_names = {'clean': None, 'PHONY': None, 'all': None, 'test': None, + 'test:': None, 'test-valgrind': None, - 'test-': None, + 'test-valgrind:': None, 'benchmark': None, 'install': None, 'build.ninja': None, -- cgit v1.1 From 1f76b76a84cb635f764ecbd2b77aaba1d375d72b Mon Sep 17 00:00:00 2001 From: Hemmo Nieminen Date: Fri, 3 Jun 2016 21:21:26 +0300 Subject: 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 7a4b0cd..b97d99e 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) -- cgit v1.1