From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 8C7063851C2A for ; Tue, 22 Sep 2020 17:58:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8C7063851C2A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-2HgPLZjINjOIWSuCanjPJg-1; Tue, 22 Sep 2020 13:58:40 -0400 X-MC-Unique: 2HgPLZjINjOIWSuCanjPJg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A909B10059AA for ; Tue, 22 Sep 2020 17:58:35 +0000 (UTC) Received: from theo.uglyboxes.com.com (ovpn-113-168.phx2.redhat.com [10.3.113.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B3E77367E for ; Tue, 22 Sep 2020 17:58:35 +0000 (UTC) From: Keith Seitz To: bunsen@sourceware.org Subject: [PATCH] Introduce simplified grok_architecture function Date: Tue, 22 Sep 2020 10:58:33 -0700 Message-Id: <20200922175833.1441668-1-keiths@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: bunsen@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bunsen mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Sep 2020 17:58:45 -0000 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