public inbox for bunsen@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: bunsen@sourceware.org
Subject: [PATCH] Introduce simplified grok_architecture function
Date: Tue, 22 Sep 2020 10:58:33 -0700	[thread overview]
Message-ID: <20200922175833.1441668-1-keiths@redhat.com> (raw)

While playing around with testing data generated via our internal
beaker instances, I noticed that +list_runs was failing to list
an architecture:

project=gdb
* 2020-06 98af45e... pass_count=74416 fail_count=1518
  - source_commit: 95e2b05fc4facb5cf26d8e9411eb31b1de9680fd
  - source_branch: scl-gcc-toolset-9-rhel-8.1.0
  - arch: None
  - version: Red Hat Enterprise Linux 9.2-2.el8
  - problems: unknown arch

This patch is a more generic approach to figuring this out and should
be suitable for common DejaGNU parsing.

Comments on this apporach?

Should I move this to the common module and update systemtap/parse_dejagnu.py?

Keith

---

Add a simplified and more complete architecture grok'ing function
to handle the result of the "Native configuration is ..." line from
the .log file, taking advantage of the fact that this string will
necessarily be of the form "ARCH-VENDOR-linux".
---
 scripts-master/gdb/parse_dejagnu.py | 36 +++++++++++++----------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/scripts-master/gdb/parse_dejagnu.py b/scripts-master/gdb/parse_dejagnu.py
index 9013860..90f7f82 100755
--- a/scripts-master/gdb/parse_dejagnu.py
+++ b/scripts-master/gdb/parse_dejagnu.py
@@ -32,17 +32,19 @@ import lzma
 
 # === TODO CREATE common.parse_dejagnu AND HARMONIZE WITH SYSTEMTAP ===
 
-native_configuration_map = {"Native configuration is i686-pc-linux-gnu":"i686",
-                            "Native configuration is i686-unknown-linux-gnu":"i686",
-                            "Native configuration is x86_64-unknown-linux-gnu":"x86_64",
-                            "Native configuration is powerpc64-unknown-linux-gnu":"ppc64",
-                            # Older systemtap logs have "Native configuration is /usr/share/dejagnu/libexec/config.guess: unable to guess system type" for ppc64le.
-                            "Native configuration is powerpc64le-unknown-linux-gnu":"ppc64le",
-                            "Native configuration is aarch64-unknown-linux-gnu":"aarch64",
-                            "Native configuration is armv7l-unknown-linux-gnueabihf":"armhf",
-                            "Native configuration is s390x-ibm-linux":"s390x",
-                            "Native configuration is x86_64-pc-linux-gnu":"x86_64", # seen on Ubuntu
-                            }
+# Deduce the architecture from TEXT, which must start with the string
+# "Native configuration is ".  If TEXT does not start with this string or
+# the architecture is not deduced, return None.
+
+def grok_architecture(text):
+    arch = None
+    if text.startswith("Native configuration is "):
+        text = text[len("Native configuration is "):]
+        # General form of TEXT is: ARCH-VENDOR-linux.*
+        match = re.match(r'(\w+)-(\w+)-linux.*', text)
+        if match:
+            arch = match.group(1)
+    return arch
 
 # TODO Handle other exotic DejaGNU outcome codes if they come up.
 test_outcome_map = {'PASS':'PASS', 'XPASS':'XPASS', 'IPASS':'PASS',
@@ -242,7 +244,7 @@ def annotate_dejagnu_log(testrun, logfile, outcome_lines=[],
     # (2) Parse the logfile and match its segments to the map of testcases.
     i = None # XXX index into testcases
     j = 0 # XXX index into outcome_lines
-    native_configuration_is = None
+    testrun.arch = None
     year_month = None
     gdb_version = None
     running_test = None
@@ -253,8 +255,8 @@ def annotate_dejagnu_log(testrun, logfile, outcome_lines=[],
     for cur in Cursor(logfile, name=os.path.basename(logfile), input_file=f, fast_hack=True):
         line = cur.line
 
-        if line.startswith("Native configuration is"):
-            native_configuration_is = line
+        if testrun.arch is None and line.startswith("Native configuration is"):
+            testrun.arch = grok_architecture(line)
         if (line.startswith("Test Run By") and " on " in line) or (" completed at " in line):
             if line.startswith("Test Run By"):
                 t1 = line.rfind(" on ") + len(" on ")
@@ -339,12 +341,6 @@ def annotate_dejagnu_log(testrun, logfile, outcome_lines=[],
             last_test_cur = Cursor(start=cur); last_test_cur.line_start += 1
     f.close()
 
-    uname_machine = None
-    if uname_machine is None:
-        uname_machine = check_mapping(native_configuration_is,
-                                      native_configuration_map)
-
-    testrun.arch = uname_machine
     # XXX testrun.osver should be extracted from buildbot repo path
     testrun.version = gdb_version
     testrun.year_month = year_month
-- 
2.26.2


                 reply	other threads:[~2020-09-22 17:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200922175833.1441668-1-keiths@redhat.com \
    --to=keiths@redhat.com \
    --cc=bunsen@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).