aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-06-09 23:18:10 +0300
committerGitHub <noreply@github.com>2016-06-09 23:18:10 +0300
commit1d709400210e40ad06ed463656d5071cc39ac1be (patch)
tree613c743727e25eb6fa450f0ea5c3191b2a484596
parentf9910d2c113e4d593dc1fe4099c52dc3fb828c9c (diff)
parent1f76b76a84cb635f764ecbd2b77aaba1d375d72b (diff)
downloadmeson-1d709400210e40ad06ed463656d5071cc39ac1be.zip
meson-1d709400210e40ad06ed463656d5071cc39ac1be.tar.gz
meson-1d709400210e40ad06ed463656d5071cc39ac1be.tar.bz2
Merge pull request #582 from trhd/master
Valgrind fixes
-rw-r--r--mesonbuild/backend/ninjabackend.py15
-rw-r--r--mesonbuild/coredata.py3
-rw-r--r--mesonbuild/scripts/meson_test.py7
3 files changed, 17 insertions, 8 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 077254d..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.
@@ -569,15 +570,21 @@ 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')
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)
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,
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)