From 3bfb8d696ee218faeba5e75c01731844742325bf Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Fri, 24 Feb 2012 11:21:04 -0800 Subject: [PATCH] ceph, ceph-fuse: simplify valgrind argument additions --- teuthology/task/ceph-fuse.py | 21 +++++++++---------- teuthology/task/ceph.py | 39 +++++++++++++++--------------------- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/teuthology/task/ceph-fuse.py b/teuthology/task/ceph-fuse.py index f23e06f64e..9d13921550 100644 --- a/teuthology/task/ceph-fuse.py +++ b/teuthology/task/ceph-fuse.py @@ -64,8 +64,7 @@ def task(ctx, config): log.info("Client client.%s config is %s" % (id_, client_config)) daemon_signal = 'kill' - if client_config.get('coverage'): - log.info('Recording coverage for this run.') + if client_config.get('coverage') or client_config.get('valgrind') is not None: daemon_signal = 'term' remote.run( @@ -81,6 +80,7 @@ def task(ctx, config): '/tmp/cephtest/binary/usr/local/bin/ceph-coverage', '/tmp/cephtest/archive/coverage', '/tmp/cephtest/daemon-helper', + daemon_signal, ] run_cmd_tail=[ '/tmp/cephtest/binary/usr/local/bin/ceph-fuse', @@ -91,15 +91,14 @@ def task(ctx, config): mnt, ] - extra_args = teuthology.get_valgrind_args( - 'client.%s' % id_, - client_config.get('valgrind', None)) - if extra_args is not None: - daemon_signal = 'term' - - run_cmd.append(daemon_signal) - if extra_args is not None: - run_cmd.extend(extra_args) + if client_config.get('valgrind') is not None: + run_cmd.extend( + teuthology.get_valgrind_args( + 'client.{id}'.format(id=id_), + client_config.get('valgrind'), + ) + ) + run_cmd.extend(run_cmd_tail) proc = remote.run( diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 35c3859ac7..4e6a11af52 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -745,8 +745,7 @@ def run_daemon(ctx, config, type_): coverage_dir = '/tmp/cephtest/archive/coverage' daemon_signal = 'kill' - if config.get('coverage'): - log.info('Recording coverage for this run.') + if config.get('coverage') or config.get('valgrind') is not None: daemon_signal = 'term' num_active = 0 @@ -757,33 +756,27 @@ def run_daemon(ctx, config, type_): if not id_.endswith('-s'): num_active += 1 - proc_signal = daemon_signal - run_cmd = ['/tmp/cephtest/enable-coredump', - '/tmp/cephtest/binary/usr/local/bin/ceph-coverage', - coverage_dir, - '/tmp/cephtest/daemon-helper' - ] + run_cmd = [ + '/tmp/cephtest/enable-coredump', + '/tmp/cephtest/binary/usr/local/bin/ceph-coverage', + coverage_dir, + '/tmp/cephtest/daemon-helper', + daemon_signal, + ] run_cmd_tail = [ '/tmp/cephtest/binary/usr/local/bin/ceph-%s' % type_, '-f', '-i', id_, '-c', '/tmp/cephtest/ceph.conf'] - valgrind_args = None - if config.get('valgrind'): - v = config.get('valgrind') - if v.get(type_, None) is not None: - valgrind_args = v.get(type_) - if v.get(name, None) is not None: - valgrind_args = v.get(name) - - extra_args = teuthology.get_valgrind_args(name, valgrind_args) - if extra_args is not None: - proc_signal = 'term' - - run_cmd.append(proc_signal) - if extra_args is not None: - run_cmd.extend(extra_args) + 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(name, valgrind_args)) + run_cmd.extend(run_cmd_tail) ctx.daemons.add_daemon(remote, type_, id_, args=run_cmd, -- 2.39.5