[PATCH] test/cmd/wget.c: Fix loadaddr rewrite

Jerome Forissier jerome.forissier at linaro.org
Mon Jan 27 08:40:53 CET 2025



On 1/27/25 00:57, Marek Vasut wrote:
> The $loadaddr variable is a hexadecimal value, not a string, it must be
> assigned using env_set_hex(). This may break follow up tests, like the
> dm_test_cmd_hash_md5 in CI. To avoid any interference with other tests,
> set $wgetaddr variable which is specific to this test and use it in the
> test.
> 
> Fixes: 20f641987f83 ("test/cmd/wget.c: move net_test_wget() to the cmd test suite")
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: Jerome Forissier <jerome.forissier at linaro.org>
> Cc: Mikhail Kshevetskiy <mikhail.kshevetskiy at iopsys.eu>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Yasuharu Shibata <yasuharu.shibata at gmail.com>
> Cc: u-boot at lists.denx.de
> ---
>  test/cmd/wget.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/test/cmd/wget.c b/test/cmd/wget.c
> index b020d20ad70..445750660c2 100644
> --- a/test/cmd/wget.c
> +++ b/test/cmd/wget.c
> @@ -217,28 +217,26 @@ static int net_test_wget(struct unit_test_state *uts)
>  {
>  	char *prev_ethact = env_get("ethact");
>  	char *prev_ethrotate = env_get("ethrotate");
> -	char *prev_loadaddr = env_get("loadaddr");
>  
>  	sandbox_eth_set_tx_handler(0, sb_http_handler);
>  	sandbox_eth_set_priv(0, uts);
>  
>  	env_set("ethact", "eth at 10002000");
>  	env_set("ethrotate", "no");
> -	env_set("loadaddr", "0x20000");
> -	ut_assertok(run_command("wget ${loadaddr} 1.1.2.2:/index.html", 0));
> +	env_set("wgetaddr", "0x20000");
> +	ut_assertok(run_command("wget ${wgetaddr} 1.1.2.2:/index.html", 0));
>  	ut_assert_nextline_empty();
>  	ut_assert_nextline("Packets received 5, Transfer Successful");
>  	ut_assert_nextline("Bytes transferred = 29 (1d hex)");
>  
>  	sandbox_eth_set_tx_handler(0, NULL);
>  
> -	run_command("md5sum ${loadaddr} ${filesize}", 0);
> +	run_command("md5sum ${wgetaddr} ${filesize}", 0);
>  	ut_assert_nextline("md5 for 00020000 ... 0002001c ==> 847d5e7320a27462e90bc1ed75eb8cd8");
>  	ut_assert_console_end();
>  
>  	env_set("ethact", prev_ethact);
>  	env_set("ethrotate", prev_ethrotate);
> -	env_set("loadaddr", prev_loadaddr);
>  
>  	return 0;
>  }

Acked-by: Jerome Forissier <jerome.forissier at linaro.org>

Thanks,
-- 
Jerome


More information about the U-Boot mailing list