Commit 662aa22d authored by Geliang Tang's avatar Geliang Tang Committed by Jakub Kicinski

selftests: mptcp: set all env vars as local ones

It would be better to move the declaration of all the env variables to
do_transfer(), run_tests(), or pm_nl_set_endpoint() as local variables,
instead of exporting them globally at the beginning of the file.
Signed-off-by: default avatarGeliang Tang <geliang.tang@suse.com>
Reviewed-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Link: https://lore.kernel.org/r/20230712-upstream-net-next-20230712-selftests-mptcp-use-local-env-v1-1-f1c8b62fbf95@tessares.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d2afa89f
...@@ -49,11 +49,12 @@ TEST_COUNT=0 ...@@ -49,11 +49,12 @@ TEST_COUNT=0
TEST_NAME="" TEST_NAME=""
nr_blank=40 nr_blank=40
export FAILING_LINKS="" # These var are used only in some tests, make sure they are not already set
export test_linkfail=0 unset FAILING_LINKS
export addr_nr_ns1=0 unset test_linkfail
export addr_nr_ns2=0 unset addr_nr_ns1
export sflags="" unset addr_nr_ns2
unset sflags
# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || # generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
# (ip6 && (ip6[74] & 0xf0) == 0x30)'" # (ip6 && (ip6[74] & 0xf0) == 0x30)'"
...@@ -100,7 +101,6 @@ init_partial() ...@@ -100,7 +101,6 @@ init_partial()
stats_dumped=0 stats_dumped=0
check_invert=0 check_invert=0
validate_checksum=$checksum validate_checksum=$checksum
FAILING_LINKS=""
# ns1 ns2 # ns1 ns2
# ns1eth1 ns2eth1 # ns1eth1 ns2eth1
...@@ -828,6 +828,10 @@ pm_nl_set_endpoint() ...@@ -828,6 +828,10 @@ pm_nl_set_endpoint()
local connector_ns="$2" local connector_ns="$2"
local connect_addr="$3" local connect_addr="$3"
local addr_nr_ns1=${addr_nr_ns1:-0}
local addr_nr_ns2=${addr_nr_ns2:-0}
local sflags=${sflags:-""}
# let the mptcp subflow be established in background before # let the mptcp subflow be established in background before
# do endpoint manipulation # do endpoint manipulation
if [ $addr_nr_ns1 != "0" ] || [ $addr_nr_ns2 != "0" ]; then if [ $addr_nr_ns1 != "0" ] || [ $addr_nr_ns2 != "0" ]; then
...@@ -979,6 +983,7 @@ do_transfer() ...@@ -979,6 +983,7 @@ do_transfer()
local port=$((10000 + TEST_COUNT - 1)) local port=$((10000 + TEST_COUNT - 1))
local cappid local cappid
local FAILING_LINKS=${FAILING_LINKS:-""}
:> "$cout" :> "$cout"
:> "$sout" :> "$sout"
...@@ -1158,6 +1163,7 @@ run_tests() ...@@ -1158,6 +1163,7 @@ run_tests()
local speed="${4:-fast}" local speed="${4:-fast}"
local size local size
local test_linkfail=${test_linkfail:-0}
# The values above 2 are reused to make test files # The values above 2 are reused to make test files
# with the given sizes (KB) # with the given sizes (KB)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment