tst_net.sh: Allow to skip initialization
PATCH 1/2 tst_net.sh: Allow to skip initialization
with TST_NET_SKIP_VARIABLE_INIT=1.
Useful for testing the library itself.
--- testcases/lib/tst_net.sh | 2 ++ testcases/lib/tst_test.sh | 1 + 2 files changed, 3 insertions(+)
testcases/lib/tst_net.sh +2 -0
@@ -933,6 +933,8 @@ tst_default_max_pkt() echo "$((mtu + mtu / 10))" } +[ -n "$TST_NET_SKIP_VARIABLE_INIT" ] && return 0 + # Management Link [ -z "$RHOST" ] && TST_USE_NETNS="yes" export RHOST="$RHOST"
testcases/lib/tst_test.sh +1 -0
@@ -559,6 +559,7 @@ tst_run() IPV6|IPV6_FLAG|IPVER|TEST_DATA|TEST_DATA_IFS);; RETRY_FUNC|RETRY_FN_EXP_BACKOFF|TIMEOUT);; NET_DATAROOT|NET_MAX_PKT|NET_RHOST_RUN_DEBUG|NETLOAD_CLN_NUMBER);; + NET_SKIP_VARIABLE_INIT);; *) tst_res TWARN "Reserved variable TST_$_tst_i used!";; esac done
Signature · 1 line
2.31.1
PATCH 2/2 tst_ipaddr_un.sh: Properly disable netns initialization
It stopped working due 40110018e, but even before there were issues:
tst_ipaddr_un 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24 tst_ipaddr_un 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64
cat: /sys/class/net/eth0/mtu: No such file or directory
cat: /sys/class/net/eth0/address: No such file or directory
--- lib/newlib_tests/shell/net/tst_ipaddr_un.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/newlib_tests/shell/net/tst_ipaddr_un.sh +5 -2
@@ -7,8 +7,11 @@ TST_CNT=2 PATH="$(dirname $0)/../../../../testcases/lib/:$PATH" -# workaround to disable netns initialization -RHOST="foo" +TST_NET_SKIP_VARIABLE_INIT=1 + +# from tst_net_vars.c +IPV4_NET16_UNUSED="10.23" +IPV6_NET32_UNUSED="fd00:23" . tst_net.sh
Signature · 1 line
2.31.1
PATCH 2/2 tst_ipaddr_un.sh: Properly disable netns initialization
Hi Petr,
Quoted 19 lines · Petr Vorel
It stopped working due
40110018e, but even before there were issues:
tst_ipaddr_un1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24tst_ipaddr_un1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64
cat:/sys/class/net/eth0/mtu: No such file or directory
cat:/sys/class/net/eth0/address: No such file or directoryFixes 807d60628 ("net: Add tst_ipaddr_un.sh test")Signed-off-by Petr Vorel <[email protected]>--- lib/newlib_tests/shell/net/tst_ipaddr_un.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)lib/newlib_tests/shell/net/tst_ipaddr_un.sh +0
-0
lib/newlib_tests/shell/net/tst_ipaddr_un.sh TST_CNT=2 · line 11
Quoted 5 lines
lib/newlib_tests/shell/net/tst_ipaddr_un.sh +0
-2@@ -7,8 +7,11 @@ TST_CNT=2 PATH="$(dirname $0)/../../../../testcases/lib/:$PATH" -# workaround to disable netns initialization -RHOST="foo"
Could be TST_INIT_NETNS="no"
lib/newlib_tests/shell/net/tst_ipaddr_un.sh TST_CNT=2 · line 11
Quoted 2 lines
lib/newlib_tests/shell/net/tst_ipaddr_un.sh +2
-0+TST_NET_SKIP_VARIABLE_INIT=1 +
OK, I think it's better than setting TST_INIT_NETNS and other vars (e.g. private _tst_net_parse_variables) here to actually skip init.
lib/newlib_tests/shell/net/tst_ipaddr_un.sh TST_CNT=2 · line 17
Quoted 7 lines
lib/newlib_tests/shell/net/tst_ipaddr_un.sh +3
-0+# from tst_net_vars.c +IPV4_NET16_UNUSED="10.23" +IPV6_NET32_UNUSED="fd00:23" . tst_net.sh
PATCH 2/2 tst_ipaddr_un.sh: Properly disable netns initialization
Hi Alexey,
Quoted 4 lines
lib/newlib_tests/shell/net/tst_ipaddr_un.sh TST_CNT=2 · line 11
Quoted 2 lines
lib/newlib_tests/shell/net/tst_ipaddr_un.sh +0
-2-# workaround to disable netns initialization -RHOST="foo"Could be TST_INIT_NETNS="no"
Good point.
Quoted 5 lines
lib/newlib_tests/shell/net/tst_ipaddr_un.sh TST_CNT=2 · line 11
Quoted 2 lines
lib/newlib_tests/shell/net/tst_ipaddr_un.sh +2
-0+TST_NET_SKIP_VARIABLE_INIT=1 +OK, I think it's better than setting
TST_INIT_NETNSand other vars (e.g. private_tst_net_parse_variables) here to actually skip init.
+1. Patchset merged with your Reviewed-by: tag. Thanks!
Kind regards,
Petr