[LTP] [PATCH 1/1] tst_net.sh: Move run code after loading test lib

Richard Palethorpe rpalethorpe@suse.de
Mon Feb 13 11:35:44 CET 2023


Hello,

Petr Vorel <pvorel@suse.cz> writes:

> This is important mostly for variable checks (tst_res() would not be
> loaded). Originally added in ecc29beeda on correct place, but left on
> wrong place during 04021637f4.
>
> Fixes: 04021637f4 ("tst_test.sh: Cleanup getopts usage")
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Acked-by: Richard Palethorpe <rpalethorpe@suse.com>

> ---
> Hi,
>
> this is expected to be applied on the top of
> "[9/9] tst_net.sh: Move net setup into separate function"
> https://patchwork.ozlabs.org/project/ltp/patch/20230126215401.29101-10-pvorel@suse.cz/
> (non-applied patches starts from the 6th)
>
> Kind regards,
> Petr
>
>  testcases/lib/tst_net.sh | 34 +++++++++++++++++-----------------
>  1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
> index 45c37a85ec..4c4a1c271e 100644
> --- a/testcases/lib/tst_net.sh
> +++ b/testcases/lib/tst_net.sh
> @@ -84,23 +84,6 @@ tst_brk_()
>  	[ -z "$TST_USE_LEGACY_API" ] && tst_brk $@ || tst_brkm $@
>  }
>  
> -if [ "$TST_PARSE_ARGS_CALLER" = "$TST_PARSE_ARGS" ]; then
> -	tst_res_ TWARN "TST_PARSE_ARGS_CALLER same as TST_PARSE_ARGS, unset it ($TST_PARSE_ARGS)"
> -	unset TST_PARSE_ARGS_CALLER
> -fi
> -if [ "$TST_SETUP_CALLER" = "$TST_SETUP" ]; then
> -	tst_res_ TWARN "TST_SETUP_CALLER same as TST_SETUP, unset it ($TST_SETUP)"
> -	unset TST_SETUP_CALLER
> -fi
> -if [ "$TST_USAGE_CALLER" = "$TST_USAGE" ]; then
> -	tst_res_ TWARN "TST_USAGE_CALLER same as TST_USAGE, unset it ($TST_USAGE)"
> -	unset TST_USAGE_CALLER
> -fi
> -
> -if [ -n "$TST_USE_LEGACY_API" ]; then
> -	tst_net_read_opts "$@"
> -fi
> -
>  # Detect IPv6 disabled via ipv6.disable=1 kernel cmdline parameter
>  # or via CONFIG_IPV6=y kernel configure option.
>  tst_net_detect_ipv6_cmdline()
> @@ -1067,6 +1050,23 @@ tst_net_setup_network()
>  
>  [ -n "$TST_USE_LEGACY_API" ] && . test.sh || . tst_test.sh
>  
> +if [ -n "$TST_USE_LEGACY_API" ]; then
> +	tst_net_read_opts "$@"
> +else
> +	if [ "$TST_PARSE_ARGS_CALLER" = "$TST_PARSE_ARGS" ]; then
> +		tst_res_ TWARN "TST_PARSE_ARGS_CALLER same as TST_PARSE_ARGS, unset it ($TST_PARSE_ARGS)"
> +		unset TST_PARSE_ARGS_CALLER
> +	fi
> +	if [ "$TST_SETUP_CALLER" = "$TST_SETUP" ]; then
> +		tst_res_ TWARN "TST_SETUP_CALLER same as TST_SETUP, unset it ($TST_SETUP)"
> +		unset TST_SETUP_CALLER
> +	fi
> +	if [ "$TST_USAGE_CALLER" = "$TST_USAGE" ]; then
> +		tst_res_ TWARN "TST_USAGE_CALLER same as TST_USAGE, unset it ($TST_USAGE)"
> +		unset TST_USAGE_CALLER
> +	fi
> +fi
> +
>  # detect IPv6 support on lhost for tests which don't use test links
>  tst_net_detect_ipv6_cmdline
>  
> -- 
> 2.39.1


-- 
Thank you,
Richard.


More information about the ltp mailing list