public inbox for bunsen@sourceware.org
 help / color / mirror / Atom feed
From: "Serhei Makarov" <me@serhei.io>
To: "Keith Seitz" <keiths@redhat.com>
Cc: Bunsen <bunsen@sourceware.org>
Subject: Re: [PATCH v2] Introduce simplified grok_architecture function
Date: Wed, 23 Sep 2020 15:26:01 -0400	[thread overview]
Message-ID: <6e7c5822-19a1-4a36-a88e-ba3a99b3af4d@www.fastmail.com> (raw)
In-Reply-To: <20200923191517.1467231-1-keiths@redhat.com>

LGTM, just have one niggle.

On Wed, Sep 23, 2020, at 3:15 PM, Keith Seitz wrote:
> +# Standardized architecture name mapping table.  The "Native 
> configuration
> +# is " line of a test run is matched against the keys in this table.  
> If
> +# a match is found, the architecture is given by the corresponding 
> value.
> +# Keys are regular expressions; values are functions which take the 
> regexp
> +# match as parameter and return a string representatin of the 
> architecture.
> +standard_architecture_map = {r'powerpc64-(\w+)-linux.*':lambda m: 
> 'ppc64',
> +                             r'powerpc64le-(\w+)-linux.*':lambda m: 
> 'ppc64le',
> +                             r'armv7l-(\w+)-linux-gnueabihf':lambda m: 
> 'armhf',
> +                             r'(\w+)-(\w+)-linux.*':lambda m: 
> m.group(1)}
LGTM, I like it.

<snip>
>  # TODO Handle other exotic DejaGNU outcome codes if they come up.
>  test_outcome_map = {'PASS':'PASS', 'XPASS':'XPASS', 'IPASS':'PASS',
> @@ -242,7 +232,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
<snip>
> +        if testrun.arch is None and line.startswith("Native 
> configuration is"):
> +            testrun.arch = grok_architecture(line)
I would set uname_machine at this point and keep the 'testrun.arch = uname_machine' assignment in the block at the bottom. That way all the properties we plan to set are glanceable in one place. (Note the comment that says we plan to set testrun.osver but don't have the info yet.)

I inherited this code layout from Martin Cermak's logproc code
and I think keeping it intact helps maintainability.

<snip>
> -    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
> -- 

  reply	other threads:[~2020-09-23 19:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 13:21 Fwd: Re: [PATCH] " Serhei Makarov
2020-09-23 18:14 ` Keith Seitz
2020-09-23 19:15   ` [PATCH v2] " Keith Seitz
2020-09-23 19:26     ` Serhei Makarov [this message]
2020-09-23 19:46       ` Keith Seitz
2020-09-23 22:48         ` Serhei Makarov

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=6e7c5822-19a1-4a36-a88e-ba3a99b3af4d@www.fastmail.com \
    --to=me@serhei.io \
    --cc=bunsen@sourceware.org \
    --cc=keiths@redhat.com \
    /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).