* [U-Boot] [PATCH] test/py: Add support for extending timeout for large files
@ 2016-05-02 12:29 Michal Simek
2016-05-02 16:27 ` Stephen Warren
0 siblings, 1 reply; 4+ messages in thread
From: Michal Simek @ 2016-05-02 12:29 UTC (permalink / raw)
To: u-boot
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,
}
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
test/py/tests/test_net.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
index 4ab58b44248a..4f4a876c1335 100644
--- a/test/py/tests/test_net.py
+++ b/test/py/tests/test_net.py
@@ -46,6 +46,7 @@ env__net_tftp_readable_file = {
"addr": 0x10000000,
"size": 5058624,
"crc32": "c2244b26",
+ "timeout": 50000,
}
"""
@@ -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
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] [PATCH] test/py: Add support for extending timeout for large files
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
2016-05-03 6:45 ` Michal Simek
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2016-05-02 16:27 UTC (permalink / raw)
To: u-boot
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")
^ permalink raw reply [flat|nested] 4+ messages in thread* [U-Boot] [PATCH] test/py: Add support for extending timeout for large files
2016-05-02 16:27 ` Stephen Warren
@ 2016-05-03 6:45 ` Michal Simek
2016-05-18 13:11 ` Michal Simek
0 siblings, 1 reply; 4+ messages in thread
From: Michal Simek @ 2016-05-03 6:45 UTC (permalink / raw)
To: u-boot
On 2.5.2016 18:27, Stephen Warren wrote:
> 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.
it is on 100Mbit/s and speed is 620kB/s.
In boardfarm because of high traffic this should be also selectable.
>> 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")
ok. Will look at it if my minimal python experience allows me to do it. :-)
Thanks,
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread* [U-Boot] [PATCH] test/py: Add support for extending timeout for large files
2016-05-03 6:45 ` Michal Simek
@ 2016-05-18 13:11 ` Michal Simek
0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2016-05-18 13:11 UTC (permalink / raw)
To: u-boot
On 3.5.2016 08:45, Michal Simek wrote:
> On 2.5.2016 18:27, Stephen Warren wrote:
>> 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.
>
> it is on 100Mbit/s and speed is 620kB/s.
> In boardfarm because of high traffic this should be also selectable.
>
>
>
>
>>> 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")
>
> ok. Will look at it if my minimal python experience allows me to do it. :-)
I have sent the patch for it
"test/py: Support setting up specific timeout"
Thanks,
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-18 13:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2016-05-03 6:45 ` Michal Simek
2016-05-18 13:11 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox