Add support for running specific test suites with valgrind.

pull/582/head
Hemmo Nieminen 9 years ago
parent fac6f869e0
commit 1f76b76a84
  1. 13
      mesonbuild/backend/ninjabackend.py

@ -131,6 +131,7 @@ class NinjaBackend(backends.Backend):
self.ninja_filename = 'build.ninja' self.ninja_filename = 'build.ninja'
self.fortran_deps = {} self.fortran_deps = {}
self.all_outputs = {} self.all_outputs = {}
self.valgrind = environment.find_valgrind()
def detect_vs_dep_prefix(self, outfile, tempfilename): def detect_vs_dep_prefix(self, outfile, tempfilename):
'''VS writes its dependency in a locale dependent format. '''VS writes its dependency in a locale dependent format.
@ -575,9 +576,15 @@ int dummy;
elem.add_item('pool', 'console') elem.add_item('pool', 'console')
elem.write(outfile) 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): def generate_tests(self, outfile):
(test_data, benchmark_data) = self.serialise_tests() (test_data, benchmark_data) = self.serialise_tests()
valgrind = environment.find_valgrind()
script_root = self.environment.get_script_dir() script_root = self.environment.get_script_dir()
cmd = [ sys.executable, self.environment.get_build_command(), '--internal', 'test' ] cmd = [ sys.executable, self.environment.get_build_command(), '--internal', 'test' ]
if not self.environment.coredata.get_builtin_option('stdsplit'): if not self.environment.coredata.get_builtin_option('stdsplit'):
@ -592,9 +599,9 @@ int dummy;
elem.write(outfile) elem.write(outfile)
self.write_test_suite_targets(cmd, 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 = 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('DESC', 'Running test suite under Valgrind.')
velem.add_item('pool', 'console') velem.add_item('pool', 'console')
velem.write(outfile) velem.write(outfile)

Loading…
Cancel
Save