Commit 645c1dc9 authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by David S. Miller

selftests: mptcp: diag: unique 'in use' subtest names

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

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

    chk 0 msk in use after flush

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

    chk 2->0 msk in use after flush

While at it, avoid repeating the full message, declare it once in the
helper.

Fixes: ce990257 ("selftests: mptcp: diag: format subtests results in TAP")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarGeliang Tang <geliang@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2ef0d804
...@@ -166,9 +166,13 @@ chk_msk_listen() ...@@ -166,9 +166,13 @@ chk_msk_listen()
chk_msk_inuse() chk_msk_inuse()
{ {
local expected=$1 local expected=$1
local msg="$2" local msg="....chk ${2:-${expected}} msk in use"
local listen_nr local listen_nr
if [ "${expected}" -eq 0 ]; then
msg+=" after flush"
fi
listen_nr=$(ss -N "${ns}" -Ml | grep -c LISTEN) listen_nr=$(ss -N "${ns}" -Ml | grep -c LISTEN)
expected=$((expected + listen_nr)) expected=$((expected + listen_nr))
...@@ -179,7 +183,7 @@ chk_msk_inuse() ...@@ -179,7 +183,7 @@ chk_msk_inuse()
sleep 0.1 sleep 0.1
done done
__chk_nr get_msk_inuse $expected "$msg" 0 __chk_nr get_msk_inuse $expected "${msg}" 0
} }
# $1: cestab nr # $1: cestab nr
...@@ -227,11 +231,11 @@ wait_connected $ns 10000 ...@@ -227,11 +231,11 @@ wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake " chk_msk_nr 2 "after MPC handshake "
chk_msk_remote_key_nr 2 "....chk remote_key" chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback" chk_msk_fallback_nr 0 "....chk no fallback"
chk_msk_inuse 2 "....chk 2 msk in use" chk_msk_inuse 2
chk_msk_cestab 2 chk_msk_cestab 2
flush_pids flush_pids
chk_msk_inuse 0 "....chk 0 msk in use after flush" chk_msk_inuse 0 "2->0"
chk_msk_cestab 0 chk_msk_cestab 0
echo "a" | \ echo "a" | \
...@@ -247,11 +251,11 @@ echo "b" | \ ...@@ -247,11 +251,11 @@ echo "b" | \
127.0.0.1 >/dev/null & 127.0.0.1 >/dev/null &
wait_connected $ns 10001 wait_connected $ns 10001
chk_msk_fallback_nr 1 "check fallback" chk_msk_fallback_nr 1 "check fallback"
chk_msk_inuse 1 "....chk 1 msk in use" chk_msk_inuse 1
chk_msk_cestab 1 chk_msk_cestab 1
flush_pids flush_pids
chk_msk_inuse 0 "....chk 0 msk in use after flush" chk_msk_inuse 0 "1->0"
chk_msk_cestab 0 chk_msk_cestab 0
NR_CLIENTS=100 NR_CLIENTS=100
...@@ -273,11 +277,11 @@ for I in `seq 1 $NR_CLIENTS`; do ...@@ -273,11 +277,11 @@ for I in `seq 1 $NR_CLIENTS`; do
done done
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present" wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
chk_msk_inuse $((NR_CLIENTS*2)) "....chk many msk in use" chk_msk_inuse $((NR_CLIENTS*2)) "many"
chk_msk_cestab $((NR_CLIENTS*2)) chk_msk_cestab $((NR_CLIENTS*2))
flush_pids flush_pids
chk_msk_inuse 0 "....chk 0 msk in use after flush" chk_msk_inuse 0 "many->0"
chk_msk_cestab 0 chk_msk_cestab 0
mptcp_lib_result_print_all_tap mptcp_lib_result_print_all_tap
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment