From: Geliang Tang Date: Fri, 4 Mar 2022 19:36:35 +0000 (-0800) Subject: selftests: mptcp: add more arguments for chk_join_nr X-Git-Tag: v6.6.17~7931^2~180^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26516e10c4335286df1cac9f8c874e08750054d2;p=platform%2Fkernel%2Flinux-rpi.git selftests: mptcp: add more arguments for chk_join_nr This patch added five more arguments for chk_join_nr(). The default values of them are all zero. The first two, csum_ns1 and csum_ns1, are passed to chk_csum_nr(), to check the mib counters of the checksum errors in ns1 and ns2. A '+' can be added into this two arguments to represent that multiple checksum errors are allowed when doing this check. For example, chk_csum_nr "" +2 +2 indicates that two or more checksum errors are allowed in both ns1 and ns2. The remaining two, fail_nr and rst_nr, are passed to chk_fail_nr() and chk_rst_nr() respectively, to check the sending and receiving mib counters of MP_FAIL and MP_RST. Also did some cleanups in chk_fail_nr(), renamed two local variables and updated the output message. Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski --- diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index f4812e8..2912289d 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -766,8 +766,21 @@ dump_stats() chk_csum_nr() { local msg=${1:-""} + local csum_ns1=${2:-0} + local csum_ns2=${3:-0} local count local dump_stats + local allow_multi_errors_ns1=0 + local allow_multi_errors_ns2=0 + + if [[ "${csum_ns1}" = "+"* ]]; then + allow_multi_errors_ns1=1 + csum_ns1=${csum_ns1:1} + fi + if [[ "${csum_ns2}" = "+"* ]]; then + allow_multi_errors_ns2=1 + csum_ns2=${csum_ns2:1} + fi if [ ! -z "$msg" ]; then printf "%03u" "$TEST_COUNT" @@ -777,8 +790,9 @@ chk_csum_nr() printf " %-36s %s" "$msg" "sum" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'` [ -z "$count" ] && count=0 - if [ "$count" != 0 ]; then - echo "[fail] got $count data checksum error[s] expected 0" + if [ "$count" != $csum_ns1 -a $allow_multi_errors_ns1 -eq 0 ] || + [ "$count" -lt $csum_ns1 -a $allow_multi_errors_ns1 -eq 1 ]; then + echo "[fail] got $count data checksum error[s] expected $csum_ns1" ret=1 dump_stats=1 else @@ -787,8 +801,9 @@ chk_csum_nr() echo -n " - csum " count=`ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'` [ -z "$count" ] && count=0 - if [ "$count" != 0 ]; then - echo "[fail] got $count data checksum error[s] expected 0" + if [ "$count" != $csum_ns2 -a $allow_multi_errors_ns2 -eq 0 ] || + [ "$count" -lt $csum_ns2 -a $allow_multi_errors_ns2 -eq 1 ]; then + echo "[fail] got $count data checksum error[s] expected $csum_ns2" ret=1 dump_stats=1 else @@ -799,27 +814,27 @@ chk_csum_nr() chk_fail_nr() { - local mp_fail_nr_tx=$1 - local mp_fail_nr_rx=$2 + local fail_tx=$1 + local fail_rx=$2 local count local dump_stats printf "%-${nr_blank}s %s" " " "ftx" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}'` [ -z "$count" ] && count=0 - if [ "$count" != "$mp_fail_nr_tx" ]; then - echo "[fail] got $count MP_FAIL[s] TX expected $mp_fail_nr_tx" + if [ "$count" != "$fail_tx" ]; then + echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx" ret=1 dump_stats=1 else echo -n "[ ok ]" fi - echo -n " - frx " + echo -n " - failrx" count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPFailRx | awk '{print $2}'` [ -z "$count" ] && count=0 - if [ "$count" != "$mp_fail_nr_rx" ]; then - echo "[fail] got $count MP_FAIL[s] RX expected $mp_fail_nr_rx" + if [ "$count" != "$fail_rx" ]; then + echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx" ret=1 dump_stats=1 else @@ -911,6 +926,10 @@ chk_join_nr() local syn_nr=$2 local syn_ack_nr=$3 local ack_nr=$4 + local csum_ns1=${5:-0} + local csum_ns2=${6:-0} + local fail_nr=${7:-0} + local rst_nr=${8:-0} local count local dump_stats local with_cookie @@ -957,9 +976,9 @@ chk_join_nr() fi [ "${dump_stats}" = 1 ] && dump_stats if [ $checksum -eq 1 ]; then - chk_csum_nr - chk_fail_nr 0 0 - chk_rst_nr 0 0 + chk_csum_nr "" $csum_ns1 $csum_ns2 + chk_fail_nr $fail_nr $fail_nr + chk_rst_nr $rst_nr $rst_nr fi }