mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-21 01:54:51 +08:00
selftests: mptcp: check MP_FAIL response mibs
This patch extends chk_fail_nr to check the MP_FAIL response mibs. Add 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 is 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> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
49fa1919d6
commit
1f7d325f7d
@ -1054,13 +1054,38 @@ chk_fail_nr()
|
|||||||
{
|
{
|
||||||
local fail_tx=$1
|
local fail_tx=$1
|
||||||
local fail_rx=$2
|
local fail_rx=$2
|
||||||
|
local ns_invert=${3:-""}
|
||||||
local count
|
local count
|
||||||
local dump_stats
|
local dump_stats
|
||||||
|
local ns_tx=$ns1
|
||||||
|
local ns_rx=$ns2
|
||||||
|
local extra_msg=""
|
||||||
|
local allow_tx_lost=0
|
||||||
|
local allow_rx_lost=0
|
||||||
|
|
||||||
|
if [[ $ns_invert = "invert" ]]; then
|
||||||
|
ns_tx=$ns2
|
||||||
|
ns_rx=$ns1
|
||||||
|
extra_msg=" invert"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${fail_tx}" = "-"* ]]; then
|
||||||
|
allow_tx_lost=1
|
||||||
|
fail_tx=${fail_tx:1}
|
||||||
|
fi
|
||||||
|
if [[ "${fail_rx}" = "-"* ]]; then
|
||||||
|
allow_rx_lost=1
|
||||||
|
fail_rx=${fail_rx:1}
|
||||||
|
fi
|
||||||
|
|
||||||
printf "%-${nr_blank}s %s" " " "ftx"
|
printf "%-${nr_blank}s %s" " " "ftx"
|
||||||
count=$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}')
|
count=$(ip netns exec $ns_tx nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}')
|
||||||
[ -z "$count" ] && count=0
|
[ -z "$count" ] && count=0
|
||||||
if [ "$count" != "$fail_tx" ]; then
|
if [ "$count" != "$fail_tx" ]; then
|
||||||
|
extra_msg="$extra_msg,tx=$count"
|
||||||
|
fi
|
||||||
|
if { [ "$count" != "$fail_tx" ] && [ $allow_tx_lost -eq 0 ]; } ||
|
||||||
|
{ [ "$count" -gt "$fail_tx" ] && [ $allow_tx_lost -eq 1 ]; }; then
|
||||||
echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx"
|
echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx"
|
||||||
fail_test
|
fail_test
|
||||||
dump_stats=1
|
dump_stats=1
|
||||||
@ -1069,17 +1094,23 @@ chk_fail_nr()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n " - failrx"
|
echo -n " - failrx"
|
||||||
count=$(ip netns exec $ns2 nstat -as | grep MPTcpExtMPFailRx | awk '{print $2}')
|
count=$(ip netns exec $ns_rx nstat -as | grep MPTcpExtMPFailRx | awk '{print $2}')
|
||||||
[ -z "$count" ] && count=0
|
[ -z "$count" ] && count=0
|
||||||
if [ "$count" != "$fail_rx" ]; then
|
if [ "$count" != "$fail_rx" ]; then
|
||||||
|
extra_msg="$extra_msg,rx=$count"
|
||||||
|
fi
|
||||||
|
if { [ "$count" != "$fail_rx" ] && [ $allow_rx_lost -eq 0 ]; } ||
|
||||||
|
{ [ "$count" -gt "$fail_rx" ] && [ $allow_rx_lost -eq 1 ]; }; then
|
||||||
echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx"
|
echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx"
|
||||||
fail_test
|
fail_test
|
||||||
dump_stats=1
|
dump_stats=1
|
||||||
else
|
else
|
||||||
echo "[ ok ]"
|
echo -n "[ ok ]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "${dump_stats}" = 1 ] && dump_stats
|
[ "${dump_stats}" = 1 ] && dump_stats
|
||||||
|
|
||||||
|
echo "$extra_msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
chk_fclose_nr()
|
chk_fclose_nr()
|
||||||
@ -2654,6 +2685,7 @@ fail_tests()
|
|||||||
if reset_with_fail "Infinite map" 1; then
|
if reset_with_fail "Infinite map" 1; then
|
||||||
run_tests $ns1 $ns2 10.0.1.1 128
|
run_tests $ns1 $ns2 10.0.1.1 128
|
||||||
chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)"
|
chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)"
|
||||||
|
chk_fail_nr 1 -1 invert
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user