Skip to content

Commit

Permalink
selftests: mptcp: diag: unique 'cestab' subtest names
Browse files Browse the repository at this point in the history
commit 4103d84 upstream.

It is important to have a unique (sub)test name in TAP, because some CI
environments drop tests with duplicated name.

Some 'cestab' subtests from the diag selftest had the same names, e.g.:

    ....chk 0 cestab

Now the previous value is taken, to have different names, e.g.:

    ....chk 2->0 cestab after flush

While at it, the 'after flush' info is added, similar to what is done
with the 'in use' subtests. Also inspired by these 'in use' subtests,
'many' is displayed instead of a large number:

    many msk socket present                           [  ok  ]
    ....chk many msk in use                           [  ok  ]
    ....chk many cestab                               [  ok  ]
    ....chk many->0 msk in use after flush            [  ok  ]
    ....chk many->0 cestab after flush                [  ok  ]

Fixes: 81ab772 ("selftests: mptcp: diag: check CURRESTAB counters")
Cc: stable@vger.kernel.org
Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
matttbe authored and gregkh committed Mar 1, 2024
1 parent 6b51994 commit a7f34a0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tools/testing/selftests/net/mptcp/diag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,15 @@ wait_local_port_listen()
# $1: cestab nr
chk_msk_cestab()
{
local cestab=$1
local expected=$1
local msg="....chk ${2:-${expected}} cestab"

if [ "${expected}" -eq 0 ]; then
msg+=" after flush"
fi

__chk_nr "mptcp_lib_get_counter ${ns} MPTcpExtMPCurrEstab" \
"${cestab}" "....chk ${cestab} cestab" ""
"${expected}" "${msg}" ""
}

wait_connected()
Expand Down Expand Up @@ -253,7 +258,7 @@ chk_msk_cestab 2
flush_pids

chk_msk_inuse 0 "2->0"
chk_msk_cestab 0
chk_msk_cestab 0 "2->0"

echo "a" | \
timeout ${timeout_test} \
Expand All @@ -273,7 +278,7 @@ chk_msk_cestab 1
flush_pids

chk_msk_inuse 0 "1->0"
chk_msk_cestab 0
chk_msk_cestab 0 "1->0"

NR_CLIENTS=100
for I in `seq 1 $NR_CLIENTS`; do
Expand All @@ -295,11 +300,11 @@ done

wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
chk_msk_inuse $((NR_CLIENTS*2)) "many"
chk_msk_cestab $((NR_CLIENTS*2))
chk_msk_cestab $((NR_CLIENTS*2)) "many"
flush_pids

chk_msk_inuse 0 "many->0"
chk_msk_cestab 0
chk_msk_cestab 0 "many->0"

mptcp_lib_result_print_all_tap
exit $ret

0 comments on commit a7f34a0

Please sign in to comment.