[LTP] [PATCH 3/9] tst_net.sh: Remove unneeded $_tst_net_parse_variables

Petr Vorel pvorel@suse.cz
Thu Jan 26 22:53:55 CET 2023


$_tst_net_parse_variables guarder (originally introduced as
$TST_PARSE_VARIABLES in 9aab3ffd55) was not needed any more since
a93c34f914 which introduced $TST_LIB_NET_LOADED guarder at the top of
the file.

was used as a guarder to protect running
configuration in case tst_net.sh was loaded more times.

Fixes: a93c34f914 ("tst_net.sh: Introduce TST_LIB_NET_LOADED")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh | 54 ++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 30 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index b76734210a..1b3a7e6683 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -1005,47 +1005,41 @@ IPV6_RHOST="${IPV6_RHOST:-fd00:1:1:1::1/64}"
 # tst_net_ip_prefix -h
 # tst_net_iface_prefix -h
 # tst_net_vars -h
-if [ -z "$_tst_net_parse_variables" ]; then
-	eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?")
-	eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?")
+eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?")
+eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?")
 
-	[ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6 rhost
+[ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6 rhost
 
-	if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
-		eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")
-		eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?")
-	fi
+if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
+	eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")
+	eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?")
 fi
 
 [ -n "$TST_USE_NETNS" -a "$TST_INIT_NETNS" != "no" ] && init_ltp_netspace
 
-if [ -z "$_tst_net_parse_variables" ]; then
-	eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?")
-	eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \
-		|| echo "exit $?")
-
-	if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
-		eval $(tst_net_iface_prefix $IPV6_LHOST || echo "exit $?")
-		eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV6_RHOST \
-			|| echo "exit $?")
-	fi
-
-	eval $(tst_net_vars $IPV4_LHOST/$IPV4_LPREFIX \
-		$IPV4_RHOST/$IPV4_RPREFIX || echo "exit $?")
+eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?")
+eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \
+	|| echo "exit $?")
 
-	if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
-		eval $(tst_net_vars $IPV6_LHOST/$IPV6_LPREFIX \
-			$IPV6_RHOST/$IPV6_RPREFIX || echo "exit $?")
-	fi
+if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
+	eval $(tst_net_iface_prefix $IPV6_LHOST || echo "exit $?")
+	eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV6_RHOST \
+		|| echo "exit $?")
+fi
 
-	tst_res_ TINFO "Network config (local -- remote):"
-	tst_res_ TINFO "$LHOST_IFACES -- $RHOST_IFACES"
-	tst_res_ TINFO "$IPV4_LHOST/$IPV4_LPREFIX -- $IPV4_RHOST/$IPV4_RPREFIX"
-	tst_res_ TINFO "$IPV6_LHOST/$IPV6_LPREFIX -- $IPV6_RHOST/$IPV6_RPREFIX"
+eval $(tst_net_vars $IPV4_LHOST/$IPV4_LPREFIX \
+	$IPV4_RHOST/$IPV4_RPREFIX || echo "exit $?")
 
-	export _tst_net_parse_variables="yes"
+if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
+	eval $(tst_net_vars $IPV6_LHOST/$IPV6_LPREFIX \
+		$IPV6_RHOST/$IPV6_RPREFIX || echo "exit $?")
 fi
 
+tst_res_ TINFO "Network config (local -- remote):"
+tst_res_ TINFO "$LHOST_IFACES -- $RHOST_IFACES"
+tst_res_ TINFO "$IPV4_LHOST/$IPV4_LPREFIX -- $IPV4_RHOST/$IPV4_RPREFIX"
+tst_res_ TINFO "$IPV6_LHOST/$IPV6_LPREFIX -- $IPV6_RHOST/$IPV6_RPREFIX"
+
 export TST_NET_DATAROOT="$LTPROOT/testcases/bin/datafiles"
 
 export TST_NETLOAD_CLN_REQUESTS="${TST_NETLOAD_CLN_REQUESTS:-10000}"
-- 
2.39.1



More information about the ltp mailing list