[PATCH v2 2/2] test: wget: add a test case for validating URI
Heinrich Schuchardt
xypron.glpk at gmx.de
Thu Jun 26 10:28:35 CEST 2025
On 24.06.25 14:07, Sughosh Ganu wrote:
> The wget module has a function wget_validate_uri() which is used for
> validating the URI to be used by wget. Add a basic test case for this
> function.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
LGTM
Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> Changes since V2: New patch
>
> test/cmd/wget.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/test/cmd/wget.c b/test/cmd/wget.c
> index 445750660c2..1005392b952 100644
> --- a/test/cmd/wget.c
> +++ b/test/cmd/wget.c
> @@ -241,3 +241,23 @@ static int net_test_wget(struct unit_test_state *uts)
> return 0;
> }
> CMD_TEST(net_test_wget, UTF_CONSOLE);
> +
> +static int net_test_wget_uri_validate(struct unit_test_state *uts)
> +{
> + ut_asserteq(true, wget_validate_uri("http://foo.com/bar.html"));
> + ut_asserteq(true, wget_validate_uri("http://1.1.2.3/bar.html"));
> + ut_asserteq(false, wget_validate_uri("http://foo/ba r.html"));
> + ut_asserteq(false, wget_validate_uri("http://"));
> +
> + if (CONFIG_IS_ENABLED(WGET_HTTPS)) {
> + ut_asserteq(true,
> + wget_validate_uri("https://foo.com/bar.html"));
> + ut_asserteq(true,
> + wget_validate_uri("https://1.1.2.3/bar.html"));
> + ut_asserteq(false, wget_validate_uri("https://foo/ba r.html"));
> + ut_asserteq(false, wget_validate_uri("https://"));
> + }
> +
> + return 0;
> +}
> +CMD_TEST(net_test_wget_uri_validate, UTF_CONSOLE);
More information about the U-Boot
mailing list