All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] test/py: Support setting up specific timeout
Date: Wed, 18 May 2016 13:00:38 -0600	[thread overview]
Message-ID: <573CBBD6.4090804@wwwdotorg.org> (raw)
In-Reply-To: <24750597429bfd579c2463bb17e2a1f262f02f83.1463590854.git.michal.simek@xilinx.com>

On 05/18/2016 11:00 AM, Michal Simek wrote:
> Large file transfers, flash erasing and more complicated tests
> requires more time to finish. Provide a way to setup specific
> timeout directly in test.
>
> For example description for 50s test:
> timeout = 50000
> with u_boot_console.temporary_timeout(timeout):
>    u_boot_console.run_command(...)

> diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py

> +class ConsoleSetupTimeout(object):

> +    def __init__(self, console, timeout):
> +        self.p = console.p
> +        self.orig_timeout = self.p.timeout
> +        self.p.timeout = timeout

> +    def __exit__(self, extype, value, traceback):
> +        if not self.p:
> +            return

That test can't fail, since __init__ already used self.p in a way that 
would have triggered an exception during the constructor, which I 
believe would cause neither __enter__ nor __exit__ to ever be called 
since the object would not exist.

Still, this does no harm, so either way,
Reviewed-by: Stephen Warren <swarren@nvidia.com>

  reply	other threads:[~2016-05-18 19:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 17:00 [U-Boot] [PATCH v2] test/py: Support setting up specific timeout Michal Simek
2016-05-18 19:00 ` Stephen Warren [this message]
2016-05-19  5:58   ` Michal Simek

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=573CBBD6.4090804@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.