Skip to content

Commit eeb8251

Browse files
geliangtangintel-lab-lkp
authored andcommitted
selftests: mptcp: check MP_FAIL response mibs
This patch extended chk_fail_nr to check the MP_FAIL response mibs. Added a new argument invert for chk_fail_nr to allow it can check the MP_FAIL TX and RX mibs from the opposite direction. When the infinite map was received before the MP_FAIL response, the response will be lost. A '-' can be added into fail_tx or fail_rx to represent that MP_FAIL response TX or RX can be lost when doing the checks. Signed-off-by: Geliang Tang <geliang.tang@suse.com>
1 parent 77d5f71 commit eeb8251

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,13 +1055,38 @@ chk_fail_nr()
10551055
{
10561056
local fail_tx=$1
10571057
local fail_rx=$2
1058+
local ns_invert=${3:-""}
10581059
local count
10591060
local dump_stats
1061+
local ns_tx=$ns1
1062+
local ns_rx=$ns2
1063+
local extra_msg=""
1064+
local allow_tx_lost=0
1065+
local allow_rx_lost=0
1066+
1067+
if [[ $ns_invert = "invert" ]]; then
1068+
ns_tx=$ns2
1069+
ns_rx=$ns1
1070+
extra_msg=" invert"
1071+
fi
1072+
1073+
if [[ "${fail_tx}" = "-"* ]]; then
1074+
allow_tx_lost=1
1075+
fail_tx=${fail_tx:1}
1076+
fi
1077+
if [[ "${fail_rx}" = "-"* ]]; then
1078+
allow_rx_lost=1
1079+
fail_rx=${fail_rx:1}
1080+
fi
10601081

10611082
printf "%-${nr_blank}s %s" " " "ftx"
1062-
count=$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}')
1083+
count=$(ip netns exec $ns_tx nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}')
10631084
[ -z "$count" ] && count=0
10641085
if [ "$count" != "$fail_tx" ]; then
1086+
extra_msg="$extra_msg,tx=$count"
1087+
fi
1088+
if { [ "$count" != "$fail_tx" ] && [ $allow_tx_lost -eq 0 ]; } ||
1089+
{ [ "$count" -gt "$fail_tx" ] && [ $allow_tx_lost -eq 1 ]; }; then
10651090
echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx"
10661091
fail_test
10671092
dump_stats=1
@@ -1070,17 +1095,23 @@ chk_fail_nr()
10701095
fi
10711096

10721097
echo -n " - failrx"
1073-
count=$(ip netns exec $ns2 nstat -as | grep MPTcpExtMPFailRx | awk '{print $2}')
1098+
count=$(ip netns exec $ns_rx nstat -as | grep MPTcpExtMPFailRx | awk '{print $2}')
10741099
[ -z "$count" ] && count=0
10751100
if [ "$count" != "$fail_rx" ]; then
1101+
extra_msg="$extra_msg,rx=$count"
1102+
fi
1103+
if { [ "$count" != "$fail_rx" ] && [ $allow_rx_lost -eq 0 ]; } ||
1104+
{ [ "$count" -gt "$fail_rx" ] && [ $allow_rx_lost -eq 1 ]; }; then
10761105
echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx"
10771106
fail_test
10781107
dump_stats=1
10791108
else
1080-
echo "[ ok ]"
1109+
echo -n "[ ok ]"
10811110
fi
10821111

10831112
[ "${dump_stats}" = 1 ] && dump_stats
1113+
1114+
echo "$extra_msg"
10841115
}
10851116

10861117
chk_fclose_nr()
@@ -2672,6 +2703,7 @@ fail_tests()
26722703
if reset_with_fail "Infinite map" 1; then
26732704
run_tests $ns1 $ns2 10.0.1.1 128
26742705
chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)"
2706+
chk_fail_nr 1 -1 invert
26752707
fi
26762708
}
26772709

0 commit comments

Comments
 (0)