]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Revert "Merge pull request #1624 from batrick/get-valgrind-args" 1772/head
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 22 Jun 2022 23:54:37 +0000 (19:54 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 22 Jun 2022 23:54:37 +0000 (19:54 -0400)
This reverts commit 40fff4b2911949847a302adfe2f4714cfaccb58e, reversing
changes made to 93d2b653facc0e5a7a532b39d9ff91a044f2c4a9.

teuthology/misc.py

index 7e92debe5e86cb744c7e5dd617672a144aecff24..6a6651e7222403e357ea127e991b1d675172ffc6 100644 (file)
@@ -1022,6 +1022,64 @@ def deep_merge(a, b):
     return b
 
 
+def get_valgrind_args(testdir, name, preamble, v, exit_on_first_error=True):
+    """
+    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 preamble
+    if not isinstance(v, list):
+        v = [v]
+
+    # https://tracker.ceph.com/issues/44362
+    preamble.extend([
+        'env', 'OPENSSL_ia32cap=~0x1000000000000000',
+    ])
+
+    val_path = '/var/log/ceph/valgrind'
+    if '--tool=memcheck' in v or '--tool=helgrind' in v:
+        extra_args = [
+            'valgrind',
+            '--trace-children=no',
+            '--child-silent-after-fork=yes',
+            '--soname-synonyms=somalloc=*tcmalloc*',
+            '--num-callers=50',
+            '--suppressions={tdir}/valgrind.supp'.format(tdir=testdir),
+            '--xml=yes',
+            '--xml-file={vdir}/{n}.log'.format(vdir=val_path, n=name),
+            '--time-stamp=yes',
+            '--vgdb=yes',
+        ]
+    else:
+        extra_args = [
+            'valgrind',
+            '--trace-children=no',
+            '--child-silent-after-fork=yes',
+            '--soname-synonyms=somalloc=*tcmalloc*',
+            '--suppressions={tdir}/valgrind.supp'.format(tdir=testdir),
+            '--log-file={vdir}/{n}.log'.format(vdir=val_path, n=name),
+            '--time-stamp=yes',
+            '--vgdb=yes',
+        ]
+    if exit_on_first_error:
+        extra_args.extend([
+            # at least Valgrind 3.14 is required
+            '--exit-on-first-error=yes',
+            '--error-exitcode=42',
+        ])
+    args = [
+        'cd', testdir,
+        run.Raw('&&'),
+    ] + preamble + extra_args + v
+    log.debug('running %s under valgrind with args %s', name, args)
+    return args
+
+
 def ssh_keyscan(hostnames, _raise=True):
     """
     Fetch the SSH public key of one or more hosts