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] test/py: Add support for extending timeout for large files
Date: Mon, 2 May 2016 10:27:58 -0600	[thread overview]
Message-ID: <5727800E.8090604@wwwdotorg.org> (raw)
In-Reply-To: <b03d952471eea861766a6ad78f732404ff5c7cbf.1462192143.git.michal.simek@xilinx.com>

On 05/02/2016 06:29 AM, Michal Simek wrote:
> Slow network or big image filesize is not able to be finished
> in 30s. Add option to user to extend timeout(in miliseconds).
>
> env__net_tftp_readable_file = {
>      "fn": "192.168.0.105:zc706/image.ub",
>      "addr": 0x20000000,
>      "size": 20484981,
>      "crc32": "873a30ae",
>      "timeout": 50000,

Out of curiosity, I wonder why your network is so slow.

> diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py

> @@ -140,6 +141,11 @@ def test_net_tftpboot(u_boot_console):
>       if not addr:
>           addr = u_boot_utils.find_ram_base(u_boot_console)
>
> +    timeout = f.get('timeout', None)
> +    if timeout:
> +        orig_timeout = u_boot_console.p.timeout
> +        u_boot_console.p.timeout = timeout
> +
>       fn = f['fn']
>       output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
>       expected_text = 'Bytes transferred = '
> @@ -157,3 +163,6 @@ def test_net_tftpboot(u_boot_console):
>
>       output = u_boot_console.run_command('crc32 %x $filesize' % addr)
>       assert expected_crc in output
> +
> +    if timeout:
> +        u_boot_console.p.timeout = orig_timeout

The timeout won't be correctly restored if an exception occurs. Please 
introduce a u_boot_console.temporary_timeout(to) API into 
u_boot_console_base.py (see e.g. how the existing disable_check() API 
works) and use it like:

timeout = f.get('timeout', None)
with u_boot_console.temporary_timeout(timeout):
   existing code

(The implementation can treat None as "no change")

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-02 12:29 [U-Boot] [PATCH] test/py: Add support for extending timeout for large files Michal Simek
2016-05-02 16:27 ` Stephen Warren [this message]
2016-05-03  6:45   ` Michal Simek
2016-05-18 13:11     ` 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=5727800E.8090604@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.