]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
task/internal/__init__.py: improve core program extraction 1719/head
authorKamoltat Sirivadhna <ksirivad@redhat.com>
Wed, 3 Aug 2022 21:00:06 +0000 (21:00 +0000)
committerKamoltat <ksirivad@redhat.com>
Wed, 24 Aug 2022 01:52:34 +0000 (01:52 +0000)
Problem:
The previous technique for extracting the program name
of the coredump file doesn't deal with the case
where there is no white space after program name
e.g.,

``SVR4-style, from 'ceph_test_rados_api_io', real uid: 1000``

here we will get an error when we reach the part where we

``remote.sh(['which', dump_program]).rstrip()``.

Solution:

Use regex to extract first occurence of the word that
is in the format ``from '<word>'``.

Signed-off-by: Kamoltat Sirivadhna <ksirivad@redhat.com>
teuthology/task/internal/__init__.py

index 041964d38c13fcae338724e2cb13b505aebab66f..0fb5b203deb03abeb3fc62a469352dbbec3da1b6 100644 (file)
@@ -13,7 +13,7 @@ import time
 import yaml
 import subprocess
 import tempfile
-
+import re
 import humanfriendly
 
 import teuthology.lock.ops
@@ -335,7 +335,7 @@ def fetch_binaries_for_coredumps(path, remote):
                     log.error(e)
                     continue
             try:
-                dump_program = dump_out.split("from '")[1].split(' ')[0]
+                dump_program = re.findall("from '([^']+)'", dump_out)[0]
                 log.info(f' dump_program: {dump_program}')
             except Exception as e:
                 log.info("core doesn't have the desired format, moving on ...")