public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] test/py: only check for SPL signature if SPL uses serial output
Date: Tue, 16 Feb 2016 09:39:03 -0700	[thread overview]
Message-ID: <56C350A7.6070607@wwwdotorg.org> (raw)
In-Reply-To: <1455624817-4988-1-git-send-email-hs@denx.de>

On 02/16/2016 05:13 AM, Heiko Schocher wrote:
> check for U-Boot SPL signature only if SPL really has
> a serial output. So check if CONFIG_SPL_SERIAL_SUPPORT
> is active in board config.

Nit: That's wrapped really narrow. Any chance of wrapping to more like 
72-74 characters?

> diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
> index bc2bd76..f888d5c 100644

>               if self.config.buildconfig.get('config_spl', False) == 'y':
> -                m = self.p.expect([pattern_u_boot_spl_signon] + self.bad_patterns)
> -                if m != 0:
> -                    raise Exception('Bad pattern found on console: ' +
> -                                    self.bad_pattern_ids[m - 1])
> +                if self.config.buildconfig.get('config_spl_serial_support',
> +                                               False) == 'y':
> +                    m = self.p.expect([pattern_u_boot_spl_signon] +
> +                                      self.bad_patterns)
> +                    if m != 0:
> +                        raise Exception('Bad pattern found on console: ' +
> +                                        self.bad_pattern_ids[m - 1])

Conceptually this change looks fine. Rather than using nested ifs, why 
not write "if a and b:" and so avoid adding an extra indent level? I'd 
also introduce some variables to shorten the text a bit:

bcfg = u_boot_console.config.buildconfig
if bcfg.get('config_spl', 'n') == 'y' and
         bcfg.get('config_spl_serial_support', 'n') == 'y':
     ...

or:

bcfg = u_boot_console.config.buildconfig
config_spl = bcfg.get('config_spl', 'n') == 'y'
config_spl_serial_support = bcfg.get('config_spl_serial_support',
     'n') == 'y'
if config_spl and config_spl_serial_support:
     ...

      reply	other threads:[~2016-02-16 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 12:13 [U-Boot] [PATCH] test/py: only check for SPL signature if SPL uses serial output Heiko Schocher
2016-02-16 16:39 ` Stephen Warren [this message]

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=56C350A7.6070607@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /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