* [PATCH] test/py: memtest: Fix test for non-trivial parameters
@ 2025-03-28 16:30 Andrew Goodbody
2025-03-30 10:40 ` Love Kumar
2025-04-10 20:14 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Goodbody @ 2025-03-28 16:30 UTC (permalink / raw)
To: u-boot; +Cc: Andrew Goodbody, Love Kumar, Tom Rini
When using non-trivial values for parameters for this test it
will cause a spurious failure as the test passes a decimal value
to the mtest command which will interpret it as hexadecimal and
result in failure as below.
test/py/tests/test_memtest.py:66: in test_memtest_ddr
assert expected_response in response
E AssertionError: assert 'Tested 16 iteration(s) with 0 errors.' in 'Refusing to do empty test\r\nmtest - simple RAM read/write test\r\n\r\nUsage:\r\nmtest [start [end [pattern [iterations]]]]'
----------------------------- Captured stdout call -----------------------------
U-Boot> mtest 134217728 0x8001000 90 0x10
Refusing to do empty test
mtest - simple RAM read/write test
Usage:
mtest [start [end [pattern [iterations]]]]
The fix is to ensure that all the parameters to the mtest command are
passed as hexadecimal values.
Fixes: 22efc1cf276c ("test/py: memtest: Add tests for mtest command")
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
---
test/py/tests/test_memtest.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/py/tests/test_memtest.py b/test/py/tests/test_memtest.py
index 0618d96f1be..f03e23db2e4 100644
--- a/test/py/tests/test_memtest.py
+++ b/test/py/tests/test_memtest.py
@@ -29,12 +29,12 @@ def get_memtest_env(u_boot_console):
if not f:
pytest.skip("memtest is not enabled!")
else:
- start = f.get("start_addr", 0x0)
- size = f.get("size", 0x1000)
- pattern = f.get("pattern", 0x0)
+ start = hex(f.get("start_addr", 0x0))
+ size = hex(f.get("size", 0x1000))
+ pattern = hex(f.get("pattern", 0x0))
iteration = f.get("iteration", 2)
timeout = f.get("timeout", 50000)
- end = hex(int(start) + int(size))
+ end = hex(int(start, 16) + int(size, 16))
return start, end, pattern, iteration, timeout
@pytest.mark.buildconfigspec("cmd_memtest")
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] test/py: memtest: Fix test for non-trivial parameters
2025-03-28 16:30 [PATCH] test/py: memtest: Fix test for non-trivial parameters Andrew Goodbody
@ 2025-03-30 10:40 ` Love Kumar
2025-04-10 20:14 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Love Kumar @ 2025-03-30 10:40 UTC (permalink / raw)
To: Andrew Goodbody, u-boot; +Cc: Tom Rini, michal Simek
On 28/03/25 10:00 pm, Andrew Goodbody wrote:
> When using non-trivial values for parameters for this test it
> will cause a spurious failure as the test passes a decimal value
> to the mtest command which will interpret it as hexadecimal and
> result in failure as below.
>
> test/py/tests/test_memtest.py:66: in test_memtest_ddr
> assert expected_response in response
> E AssertionError: assert 'Tested 16 iteration(s) with 0 errors.' in 'Refusing to do empty test\r\nmtest - simple RAM read/write test\r\n\r\nUsage:\r\nmtest [start [end [pattern [iterations]]]]'
> ----------------------------- Captured stdout call -----------------------------
> U-Boot> mtest 134217728 0x8001000 90 0x10
> Refusing to do empty test
> mtest - simple RAM read/write test
> Usage:
> mtest [start [end [pattern [iterations]]]]
>
> The fix is to ensure that all the parameters to the mtest command are
> passed as hexadecimal values.
>
> Fixes: 22efc1cf276c ("test/py: memtest: Add tests for mtest command")
> Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
>
> ---
>
> test/py/tests/test_memtest.py | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test/py/tests/test_memtest.py b/test/py/tests/test_memtest.py
> index 0618d96f1be..f03e23db2e4 100644
> --- a/test/py/tests/test_memtest.py
> +++ b/test/py/tests/test_memtest.py
> @@ -29,12 +29,12 @@ def get_memtest_env(u_boot_console):
> if not f:
> pytest.skip("memtest is not enabled!")
> else:
> - start = f.get("start_addr", 0x0)
> - size = f.get("size", 0x1000)
> - pattern = f.get("pattern", 0x0)
> + start = hex(f.get("start_addr", 0x0))
> + size = hex(f.get("size", 0x1000))
> + pattern = hex(f.get("pattern", 0x0))
> iteration = f.get("iteration", 2)
> timeout = f.get("timeout", 50000)
> - end = hex(int(start) + int(size))
> + end = hex(int(start, 16) + int(size, 16))
> return start, end, pattern, iteration, timeout
>
> @pytest.mark.buildconfigspec("cmd_memtest")
Reviewed-by: Love Kumar <love.kumar@amd.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] test/py: memtest: Fix test for non-trivial parameters
2025-03-28 16:30 [PATCH] test/py: memtest: Fix test for non-trivial parameters Andrew Goodbody
2025-03-30 10:40 ` Love Kumar
@ 2025-04-10 20:14 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2025-04-10 20:14 UTC (permalink / raw)
To: u-boot, Andrew Goodbody; +Cc: Love Kumar
On Fri, 28 Mar 2025 16:30:37 +0000, Andrew Goodbody wrote:
> When using non-trivial values for parameters for this test it
> will cause a spurious failure as the test passes a decimal value
> to the mtest command which will interpret it as hexadecimal and
> result in failure as below.
>
> test/py/tests/test_memtest.py:66: in test_memtest_ddr
> assert expected_response in response
> E AssertionError: assert 'Tested 16 iteration(s) with 0 errors.' in 'Refusing to do empty test\r\nmtest - simple RAM read/write test\r\n\r\nUsage:\r\nmtest [start [end [pattern [iterations]]]]'
> ----------------------------- Captured stdout call -----------------------------
> U-Boot> mtest 134217728 0x8001000 90 0x10
> Refusing to do empty test
> mtest - simple RAM read/write test
> Usage:
> mtest [start [end [pattern [iterations]]]]
>
> [...]
Applied to u-boot/master, thanks!
[1/1] test/py: memtest: Fix test for non-trivial parameters
commit: 3c6a3e99b398558b6bfb1362a44fbf0e07e2539e
--
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-10 20:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28 16:30 [PATCH] test/py: memtest: Fix test for non-trivial parameters Andrew Goodbody
2025-03-30 10:40 ` Love Kumar
2025-04-10 20:14 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox