Skip to contentSkip to conversation

tst_net.sh: Move run code after loading test lib

PATCH In review Petr Vorel 2 participants 3 messages Feb 1, 2023 – Feb 14, 2023

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

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

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")

---
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/[email protected]/
(non-applied patches starts from the 6th)

Kind regards,
Petr

 testcases/lib/tst_net.sh | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
testcases/lib/tst_net.sh +17 -17
index 45c37a85ec..4c4a1c271e 100644
@@ -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
 
Signature · 5 lines
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v1 1/1
#1 lore raw

Hello,

Quoted 7 lines · Petr Vorel

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")
Quoted 68 lines

---
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/[email protected]/
(non-applied patches starts from the 6th)

Kind regards,
Petr

 testcases/lib/tst_net.sh | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
testcases/lib/tst_net.sh +17 -17
index 45c37a85ec..4c4a1c271e 100644
@@ -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
 
Signature · 1 line
2.39.1
Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw

Hi Richie,

Quoted 4 lines
Quoted 4 lines

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/[email protected]/
(non-applied patches starts from the 6th)

Thanks! I rebased it and merged, because IPv6 fixes patchset needs v2.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp