return a
return b
-def get_valgrind_args(testdir, name, v):
+def get_valgrind_args(testdir, name, preamble, v):
+ """
+ Build a command line for running valgrind.
+
+ testdir - test results directory
+ name - name of daemon (for naming hte log file)
+ preamble - stuff we should run before valgrind
+ v - valgrind arguments
+ """
if v is None:
return []
if not isinstance(v, list):
val_path = '/var/log/ceph/valgrind'.format(tdir=testdir)
if '--tool=memcheck' in v or '--tool=helgrind' in v:
extra_args = [
- 'cd', testdir,
- run.Raw('&&'),
+
'valgrind',
'--num-callers=50',
'--suppressions={tdir}/valgrind.supp'.format(tdir=testdir),
]
else:
extra_args = [
- 'cd', testdir,
- run.Raw('&&'),
'valgrind',
'--suppressions={tdir}/valgrind.supp'.format(tdir=testdir),
'--log-file={vdir}/{n}.log'.format(vdir=val_path, n=name)
]
- extra_args.extend(v)
- log.debug('running %s under valgrind with args %s', name, extra_args)
- return extra_args
+ args = [
+ 'cd', testdir,
+ run.Raw('&&'),
+ ] + preamble + extra_args + v
+ log.debug('running %s under valgrind with args %s', name, args)
+ return args
def stop_daemons_of_type(ctx, type_):
log.info('Shutting down %s daemons...' % type_)
]
if client_config.get('valgrind') is not None:
- run_cmd.extend(
- teuthology.get_valgrind_args(
- testdir,
- 'client.{id}'.format(id=id_),
- client_config.get('valgrind'),
- )
+ run_cmd = teuthology.get_valgrind_args(
+ testdir,
+ 'client.{id}'.format(id=id_),
+ run_cmd,
+ client_config.get('valgrind'),
)
run_cmd.extend(run_cmd_tail)
'-f',
'-i', id_]
+ if type_ in config.get('cpu_profile', []):
+ profile_path = '/var/log/ceph/profiling-logger/%s.%s.prof' % (type_, id_)
+ run_cmd.extend([ 'env', 'CPUPROFILE=%s' % profile_path ])
+
if config.get('valgrind') is not None:
valgrind_args = None
if type_ in config['valgrind']:
valgrind_args = config['valgrind'][type_]
if name in config['valgrind']:
valgrind_args = config['valgrind'][name]
- run_cmd.extend(teuthology.get_valgrind_args(testdir, name, valgrind_args))
-
- if type_ in config.get('cpu_profile', []):
- profile_path = '/var/log/ceph/profiling-logger/%s.%s.prof' % (type_, id_)
- run_cmd.extend([ 'env', 'CPUPROFILE=%s' % profile_path ])
+ run_cmd = teuthology.get_valgrind_args(testdir, name,
+ run_cmd,
+ valgrind_args)
run_cmd.extend(run_cmd_tail)
run.Raw('2>&1'),
]
- run_cmd.extend(
- teuthology.get_valgrind_args(
- testdir,
- client,
- client_config.get('valgrind')
- )
+ run_cmd = teuthology.get_valgrind_args(
+ testdir,
+ client,
+ run_cmd,
+ client_config.get('valgrind')
)
run_cmd.extend(run_cmd_tail)