]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: rewrite "valgrind_post" to use ValgrindScanner
authorVallari Agrawal <val.agl002@gmail.com>
Thu, 26 Oct 2023 05:46:29 +0000 (11:16 +0530)
committerVallari Agrawal <val.agl002@gmail.com>
Thu, 26 Oct 2023 08:38:46 +0000 (14:08 +0530)
previously, valgrind_post() func used grep to find error
from valgrind logs.
now, it uses ValgrindScanner to log better exceptions with
traceback and exception kind, along with creating a more detailed
summary in valgrind.yaml in archive.

Signed-off-by: Vallari Agrawal <val.agl002@gmail.com>
qa/tasks/ceph.py

index d487c4296105b72b6127de31a13a626534b0e01d..a7b3ad4c5eec6b75a3bd1a1672e9fa6dc1ae6ff6 100644 (file)
@@ -28,6 +28,7 @@ from teuthology import misc as teuthology
 from teuthology import contextutil
 from teuthology import exceptions
 from teuthology.orchestra import run
+from teuthology.util.scanner import ValgrindScanner
 from tasks import ceph_client as cclient
 from teuthology.orchestra.daemon import DaemonGroup
 from tasks.daemonwatchdog import DaemonWatchdog
@@ -327,38 +328,15 @@ def valgrind_post(ctx, config):
     try:
         yield
     finally:
-        lookup_procs = list()
-        log.info('Checking for errors in any valgrind logs...')
-        for remote in ctx.cluster.remotes.keys():
-            # look at valgrind logs for each node
-            proc = remote.run(
-                args="sudo zgrep '<kind>' /var/log/ceph/valgrind/* "
-                     # include a second file so that we always get
-                     # a filename prefix on the output
-                     "/dev/null | sort | uniq",
-                wait=False,
-                check_status=False,
-                stdout=StringIO(),
-            )
-            lookup_procs.append((proc, remote))
-
         valgrind_exception = None
-        for (proc, remote) in lookup_procs:
-            proc.wait()
-            out = proc.stdout.getvalue()
-            for line in out.split('\n'):
-                if line == '':
-                    continue
-                try:
-                    (file, kind) = line.split(':')
-                except Exception:
-                    log.error('failed to split line %s', line)
-                    raise
-                log.debug('file %s kind %s', file, kind)
-                if (file.find('mds') >= 0) and kind.find('Lost') > 0:
-                    continue
-                log.error('saw valgrind issue %s in %s', kind, file)
-                valgrind_exception = Exception('saw valgrind issues')
+        valgrind_yaml = os.path.join(ctx.archive, 'valgrind.yaml')
+        for remote in ctx.cluster.remotes.keys():
+            scanner = ValgrindScanner(remote)
+            errors = scanner.scan_all_files('/var/log/ceph/valgrind/*')
+            scanner.write_summary(valgrind_yaml)
+            if errors and not valgrind_exception:
+                log.debug('valgrind exception message: %s', errors[0])
+                valgrind_exception = Exception(errors[0])
 
         if config.get('expect_valgrind_errors'):
             if not valgrind_exception: