]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
ceph, ceph-fuse: simplify valgrind argument additions
authorJosh Durgin <josh.durgin@dreamhost.com>
Fri, 24 Feb 2012 19:21:04 +0000 (11:21 -0800)
committerJosh Durgin <josh.durgin@dreamhost.com>
Fri, 24 Feb 2012 20:05:35 +0000 (12:05 -0800)
teuthology/task/ceph-fuse.py
teuthology/task/ceph.py

index f23e06f64e73485244c55c58c50c23d6386dbd45..9d139215507c44d1192bb716292db480a82d3523 100644 (file)
@@ -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(
index 35c3859ac743dd1c440a44063cbfc033c5f5c6e0..4e6a11af52852f0638bb9ce29bc608f4a4dd19d3 100644 (file)
@@ -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,