]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
misc: valgrind: fix cd behavior 82/head
authorSage Weil <sage@inktank.com>
Fri, 6 Sep 2013 22:56:39 +0000 (15:56 -0700)
committerSage Weil <sage@inktank.com>
Fri, 6 Sep 2013 23:09:27 +0000 (16:09 -0700)
The cd needs to happen at the beginning of the command, not at the end, or
else the funky wrapper scripts don't work right.

This also cleans up the command line construction a bit so that it is more
flexible, explicit, and hopefully less fragile.

Signed-off-by: Sage Weil <sage@inktank.com>
teuthology/misc.py
teuthology/task/ceph-fuse.py
teuthology/task/ceph.py
teuthology/task/rgw.py

index 0ff1c55efa738af242a7bc5b0aceb98d9531dab5..dc677374c68efdeb7cf413ff0aee7249c74416cf 100644 (file)
@@ -862,7 +862,15 @@ def deep_merge(a, b):
         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):
@@ -870,8 +878,7 @@ def get_valgrind_args(testdir, name, v):
     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),
@@ -880,15 +887,16 @@ def get_valgrind_args(testdir, name, v):
             ]
     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_)
index 66eb42863c289f1de3aaeed99d8a5899e226961d..eeff1c0e285411863adb3fde6dabe031b5bfada2 100644 (file)
@@ -97,12 +97,11 @@ def task(ctx, config):
             ]
 
         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)
index a6757f5ecea287bb7b34e0695692de12fd0695de..6ed67116b7c9a13067266873f605d5378d3ae8fa 100644 (file)
@@ -901,17 +901,19 @@ def run_daemon(ctx, config, type_):
                 '-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)
 
index 54848b27bee4b8afcdae8586a78f80504537705e..b4f1725d7a6a7bea8c3d7f8b2174ecc1a203a6ff 100644 (file)
@@ -177,12 +177,11 @@ def start_rgw(ctx, config):
             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)