Helgrind support for run_tests.py

Also allow maxjobs to be tweaked based upon which configs are being run,
to prevent memory starvation.
pull/35/head
Craig Tiller 10 years ago
parent e55e1155d3
commit 2aa4d64947
  1. 30
      tools/run_tests/run_tests.py

@ -15,6 +15,7 @@ import watch_dirs
class SimpleConfig(object): class SimpleConfig(object):
def __init__(self, config): def __init__(self, config):
self.build_config = config self.build_config = config
self.maxjobs = 32 * multiprocessing.cpu_count()
def run_command(self, binary): def run_command(self, binary):
return [binary] return [binary]
@ -22,11 +23,13 @@ class SimpleConfig(object):
# ValgrindConfig: compile with some CONFIG=config, but use valgrind to run # ValgrindConfig: compile with some CONFIG=config, but use valgrind to run
class ValgrindConfig(object): class ValgrindConfig(object):
def __init__(self, config): def __init__(self, config, tool):
self.build_config = config self.build_config = config
self.tool = tool
self.maxjobs = 4 * multiprocessing.cpu_count()
def run_command(self, binary): def run_command(self, binary):
return ['valgrind', binary] return ['valgrind', binary, '--tool=%s' % self.tool]
# different configurations we can run under # different configurations we can run under
@ -37,7 +40,8 @@ _CONFIGS = {
'msan': SimpleConfig('msan'), 'msan': SimpleConfig('msan'),
'asan': SimpleConfig('asan'), 'asan': SimpleConfig('asan'),
'gcov': SimpleConfig('gcov'), 'gcov': SimpleConfig('gcov'),
'valgrind': ValgrindConfig('dbg'), 'memcheck': ValgrindConfig('dbg', 'memcheck'),
'helgrind': ValgrindConfig('dbg', 'helgrind')
} }
@ -81,14 +85,18 @@ def _build_and_run(check_cancelled):
return 1 return 1
# run all the tests # run all the tests
if not jobset.run(( if not jobset.run(
config.run_command(x) itertools.ifilter(
for config in run_configs lambda x: x is not None, (
for filt in filters config.run_command(x)
for x in itertools.chain.from_iterable(itertools.repeat( for config in run_configs
glob.glob('bins/%s/%s_test' % ( for filt in filters
config.build_config, filt)), for x in itertools.chain.from_iterable(itertools.repeat(
runs_per_test))), check_cancelled): glob.glob('bins/%s/%s_test' % (
config.build_config, filt)),
runs_per_test)))),
check_cancelled,
maxjobs=min(c.maxjobs for c in run_configs)):
return 2 return 2
return 0 return 0

Loading…
Cancel
Save