@@ -9,7 +9,6 @@
. "$(dirname "${0}")/mptcp_lib.sh"
ns=""
-test_cnt=1
timeout_poll=30
timeout_test=$((timeout_poll * 2 + 1))
ret=0
@@ -69,7 +68,7 @@ __chk_nr()
echo "[ ok ]"
mptcp_lib_result_pass "${msg}"
fi
- test_cnt=$((test_cnt+1))
+ MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1))
}
__chk_msk_nr()
@@ -127,7 +126,7 @@ wait_msk_nr()
echo "[ ok ]"
mptcp_lib_result_pass "${msg}"
fi
- test_cnt=$((test_cnt+1))
+ MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1))
}
chk_msk_fallback_nr()
@@ -131,7 +131,6 @@ ns2=""
ns3=""
ns4=""
-TEST_COUNT=0
TEST_GROUP=""
# This function is used in the cleanup trap
@@ -321,7 +320,7 @@ do_transfer()
local extra_args="$7"
port=$((port + 1))
- TEST_COUNT=$((TEST_COUNT+1))
+ MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1))
if [ "$rcvbuf" -gt 0 ]; then
extra_args="$extra_args -R $rcvbuf"
@@ -48,7 +48,6 @@ declare -A all_tests
declare -a only_tests_ids
declare -a only_tests_names
declare -A failed_tests
-TEST_COUNT=0
TEST_NAME=""
nr_blank=6
@@ -172,7 +171,7 @@ cleanup()
print_title()
{
- printf "%03u %s\n" "${TEST_COUNT}" "${TEST_NAME}"
+ printf "%03u %s\n" "${MPTCP_LIB_TEST_COUNTER}" "${TEST_NAME}"
}
print_check()
@@ -233,7 +232,7 @@ skip_test()
local i
for i in "${only_tests_ids[@]}"; do
- if [ "${TEST_COUNT}" -eq "${i}" ]; then
+ if [ "${MPTCP_LIB_TEST_COUNTER}" -eq "${i}" ]; then
return 1
fi
done
@@ -268,7 +267,7 @@ reset()
TEST_NAME="${1}"
- TEST_COUNT=$((TEST_COUNT+1))
+ MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1))
if skip_test; then
last_test_ignored=1
@@ -462,7 +461,7 @@ fail_test()
# just in case a test is marked twice as failed
if [ ${last_test_failed} -eq 0 ]; then
- failed_tests[${TEST_COUNT}]="${TEST_NAME}"
+ failed_tests[${MPTCP_LIB_TEST_COUNTER}]="${TEST_NAME}"
dump_stats
last_test_failed=1
fi
@@ -973,7 +972,7 @@ do_transfer()
local srv_proto="$4"
local connect_addr="$5"
- local port=$((10000 + TEST_COUNT - 1))
+ local port=$((10000 + MPTCP_LIB_TEST_COUNTER - 1))
local cappid
local FAILING_LINKS=${FAILING_LINKS:-""}
local fastclose=${fastclose:-""}
@@ -991,9 +990,9 @@ do_transfer()
capuser="-Z $SUDO_USER"
fi
- capfile=$(printf "mp_join-%02u-%s.pcap" "$TEST_COUNT" "${listener_ns}")
+ capfile=$(printf "mp_join-%02u-%s.pcap" "$MPTCP_LIB_TEST_COUNTER" "${listener_ns}")
- echo "Capturing traffic for test $TEST_COUNT into $capfile"
+ echo "Capturing traffic for test $MPTCP_LIB_TEST_COUNTER into $capfile"
ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &
cappid=$!
@@ -10,6 +10,8 @@ readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}"
MPTCP_LIB_SUBTESTS=()
MPTCP_LIB_SUBTESTS_DUPLICATED=0
+# shellcheck disable=SC2034 # unused at this moment
+MPTCP_LIB_TEST_COUNTER=0
# only if supported (or forced) and not disabled, see no-color.org
if { [ -t 1 ] || [ "${SELFTESTS_MPTCP_LIB_COLOR_FORCE:-}" = "1" ]; } &&
@@ -14,7 +14,6 @@ ns3=""
capture=false
timeout_poll=30
timeout_test=$((timeout_poll * 2 + 1))
-test_cnt=1
ret=0
bail=0
slack=50
@@ -126,8 +125,8 @@ do_transfer()
local sin=$2
local max_time=$3
local port
- port=$((10000+test_cnt))
- test_cnt=$((test_cnt+1))
+ port=$((10000+MPTCP_LIB_TEST_COUNTER))
+ MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1))
:> "$cout"
:> "$sout"