aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/backend/ninjabackend.py15
-rw-r--r--mesonbuild/coredata.py3
-rw-r--r--mesonbuild/dependencies.py6
-rw-r--r--mesonbuild/scripts/meson_test.py7
4 files changed, 19 insertions, 12 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/dependencies.py b/mesonbuild/dependencies.py
index 271c6b4..e2c932e 100644
--- a/mesonbuild/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -88,6 +88,8 @@ class PkgConfigDependency(Dependency):
self.static = kwargs.get('static', False)
if not isinstance(self.static, bool):
raise DependencyException('Static keyword must be boolean')
+ self.cargs = []
+ self.libs = []
if 'native' in kwargs and environment.is_cross_build():
want_cross = not kwargs['native']
else:
@@ -100,8 +102,6 @@ class PkgConfigDependency(Dependency):
if not PkgConfigDependency.pkgconfig_found:
if self.required:
raise DependencyException('Pkg-config not found.')
- self.cargs = []
- self.libs = []
return
if environment.is_cross_build() and want_cross:
if "pkgconfig" not in environment.cross_info.config["binaries"]:
@@ -122,8 +122,6 @@ class PkgConfigDependency(Dependency):
if self.required:
raise DependencyException('%s dependency %s not found.' % (self.type_string, name))
self.modversion = 'none'
- self.cargs = []
- self.libs = []
else:
self.modversion = out.decode().strip()
mlog.log('%s dependency' % self.type_string, mlog.bold(name), 'found:',
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)