Commit 39aab882 authored by Matthieu Baerts's avatar Matthieu Baerts Committed by Jakub Kicinski

selftests: mptcp: join: list failure at the end

With ~100 tests, it helps to have this summary at the end not to scroll
to find which one has failed.

It is especially interseting when looking at the output produced by the
CI where the kernel logs from the serial are mixed together.
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c7d49c03
...@@ -22,6 +22,7 @@ init=0 ...@@ -22,6 +22,7 @@ init=0
declare -A all_tests declare -A all_tests
declare -a only_tests_ids declare -a only_tests_ids
declare -a only_tests_names declare -a only_tests_names
declare -A failed_tests
TEST_COUNT=0 TEST_COUNT=0
TEST_NAME="" TEST_NAME=""
nr_blank=40 nr_blank=40
...@@ -251,6 +252,21 @@ reset_with_allow_join_id0() ...@@ -251,6 +252,21 @@ reset_with_allow_join_id0()
ip netns exec $ns2 sysctl -q net.mptcp.allow_join_initial_addr_port=$ns2_enable ip netns exec $ns2 sysctl -q net.mptcp.allow_join_initial_addr_port=$ns2_enable
} }
fail_test()
{
ret=1
failed_tests[${TEST_COUNT}]="${TEST_NAME}"
}
get_failed_tests_ids()
{
# sorted
local i
for i in "${!failed_tests[@]}"; do
echo "${i}"
done | sort -n
}
print_file_err() print_file_err()
{ {
ls -l "$1" 1>&2 ls -l "$1" 1>&2
...@@ -272,7 +288,7 @@ check_transfer() ...@@ -272,7 +288,7 @@ check_transfer()
echo "[ FAIL ] $what does not match (in, out):" echo "[ FAIL ] $what does not match (in, out):"
print_file_err "$in" print_file_err "$in"
print_file_err "$out" print_file_err "$out"
ret=1 fail_test
return 1 return 1
else else
...@@ -292,7 +308,7 @@ do_ping() ...@@ -292,7 +308,7 @@ do_ping()
ip netns exec ${connector_ns} ping -q -c 1 $connect_addr >/dev/null ip netns exec ${connector_ns} ping -q -c 1 $connect_addr >/dev/null
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echo "$listener_ns -> $connect_addr connectivity [ FAIL ]" 1>&2 echo "$listener_ns -> $connect_addr connectivity [ FAIL ]" 1>&2
ret=1 fail_test
fi fi
} }
...@@ -541,7 +557,7 @@ pm_nl_check_endpoint() ...@@ -541,7 +557,7 @@ pm_nl_check_endpoint()
echo "[ ok ]" echo "[ ok ]"
else else
echo "[fail] expected '$expected_line' found '$line'" echo "[fail] expected '$expected_line' found '$line'"
ret=1 fail_test
fi fi
} }
...@@ -795,7 +811,7 @@ do_transfer() ...@@ -795,7 +811,7 @@ do_transfer()
cat /tmp/${connector_ns}.out cat /tmp/${connector_ns}.out
cat "$capout" cat "$capout"
ret=1 fail_test
return 1 return 1
fi fi
...@@ -920,7 +936,7 @@ chk_csum_nr() ...@@ -920,7 +936,7 @@ chk_csum_nr()
if [ "$count" != $csum_ns1 -a $allow_multi_errors_ns1 -eq 0 ] || if [ "$count" != $csum_ns1 -a $allow_multi_errors_ns1 -eq 0 ] ||
[ "$count" -lt $csum_ns1 -a $allow_multi_errors_ns1 -eq 1 ]; then [ "$count" -lt $csum_ns1 -a $allow_multi_errors_ns1 -eq 1 ]; then
echo "[fail] got $count data checksum error[s] expected $csum_ns1" echo "[fail] got $count data checksum error[s] expected $csum_ns1"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -931,7 +947,7 @@ chk_csum_nr() ...@@ -931,7 +947,7 @@ chk_csum_nr()
if [ "$count" != $csum_ns2 -a $allow_multi_errors_ns2 -eq 0 ] || if [ "$count" != $csum_ns2 -a $allow_multi_errors_ns2 -eq 0 ] ||
[ "$count" -lt $csum_ns2 -a $allow_multi_errors_ns2 -eq 1 ]; then [ "$count" -lt $csum_ns2 -a $allow_multi_errors_ns2 -eq 1 ]; then
echo "[fail] got $count data checksum error[s] expected $csum_ns2" echo "[fail] got $count data checksum error[s] expected $csum_ns2"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -951,7 +967,7 @@ chk_fail_nr() ...@@ -951,7 +967,7 @@ chk_fail_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$fail_tx" ]; then if [ "$count" != "$fail_tx" ]; then
echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx" echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -962,7 +978,7 @@ chk_fail_nr() ...@@ -962,7 +978,7 @@ chk_fail_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$fail_rx" ]; then if [ "$count" != "$fail_rx" ]; then
echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx" echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -983,7 +999,7 @@ chk_fclose_nr() ...@@ -983,7 +999,7 @@ chk_fclose_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$fclose_tx" ]; then if [ "$count" != "$fclose_tx" ]; then
echo "[fail] got $count MP_FASTCLOSE[s] TX expected $fclose_tx" echo "[fail] got $count MP_FASTCLOSE[s] TX expected $fclose_tx"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -994,7 +1010,7 @@ chk_fclose_nr() ...@@ -994,7 +1010,7 @@ chk_fclose_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$fclose_rx" ]; then if [ "$count" != "$fclose_rx" ]; then
echo "[fail] got $count MP_FASTCLOSE[s] RX expected $fclose_rx" echo "[fail] got $count MP_FASTCLOSE[s] RX expected $fclose_rx"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -1025,7 +1041,7 @@ chk_rst_nr() ...@@ -1025,7 +1041,7 @@ chk_rst_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$rst_tx" ]; then if [ "$count" != "$rst_tx" ]; then
echo "[fail] got $count MP_RST[s] TX expected $rst_tx" echo "[fail] got $count MP_RST[s] TX expected $rst_tx"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1036,7 +1052,7 @@ chk_rst_nr() ...@@ -1036,7 +1052,7 @@ chk_rst_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$rst_rx" ]; then if [ "$count" != "$rst_rx" ]; then
echo "[fail] got $count MP_RST[s] RX expected $rst_rx" echo "[fail] got $count MP_RST[s] RX expected $rst_rx"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1071,7 +1087,7 @@ chk_join_nr() ...@@ -1071,7 +1087,7 @@ chk_join_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$syn_nr" ]; then if [ "$count" != "$syn_nr" ]; then
echo "[fail] got $count JOIN[s] syn expected $syn_nr" echo "[fail] got $count JOIN[s] syn expected $syn_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1089,7 +1105,7 @@ chk_join_nr() ...@@ -1089,7 +1105,7 @@ chk_join_nr()
echo -n "[ ok ]" echo -n "[ ok ]"
else else
echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr" echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
fi fi
else else
...@@ -1101,7 +1117,7 @@ chk_join_nr() ...@@ -1101,7 +1117,7 @@ chk_join_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$ack_nr" ]; then if [ "$count" != "$ack_nr" ]; then
echo "[fail] got $count JOIN[s] ack expected $ack_nr" echo "[fail] got $count JOIN[s] ack expected $ack_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -1141,7 +1157,7 @@ chk_stale_nr() ...@@ -1141,7 +1157,7 @@ chk_stale_nr()
echo "[fail] got $stale_nr stale[s] $recover_nr recover[s], " \ echo "[fail] got $stale_nr stale[s] $recover_nr recover[s], " \
" expected stale in range [$stale_min..$stale_max]," \ " expected stale in range [$stale_min..$stale_max]," \
" stale-recover delta $stale_delta " " stale-recover delta $stale_delta "
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -1178,7 +1194,7 @@ chk_add_nr() ...@@ -1178,7 +1194,7 @@ chk_add_nr()
# add addrs options, due to retransmissions # add addrs options, due to retransmissions
if [ "$count" != "$add_nr" ] && [ "$timeout" -gt 1 -o "$count" -lt "$add_nr" ]; then if [ "$count" != "$add_nr" ] && [ "$timeout" -gt 1 -o "$count" -lt "$add_nr" ]; then
echo "[fail] got $count ADD_ADDR[s] expected $add_nr" echo "[fail] got $count ADD_ADDR[s] expected $add_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1189,7 +1205,7 @@ chk_add_nr() ...@@ -1189,7 +1205,7 @@ chk_add_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$echo_nr" ]; then if [ "$count" != "$echo_nr" ]; then
echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr" echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1201,7 +1217,7 @@ chk_add_nr() ...@@ -1201,7 +1217,7 @@ chk_add_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$port_nr" ]; then if [ "$count" != "$port_nr" ]; then
echo "[fail] got $count ADD_ADDR[s] with a port-number expected $port_nr" echo "[fail] got $count ADD_ADDR[s] with a port-number expected $port_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -1214,7 +1230,7 @@ chk_add_nr() ...@@ -1214,7 +1230,7 @@ chk_add_nr()
if [ "$count" != "$syn_nr" ]; then if [ "$count" != "$syn_nr" ]; then
echo "[fail] got $count JOIN[s] syn with a different \ echo "[fail] got $count JOIN[s] syn with a different \
port-number expected $syn_nr" port-number expected $syn_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1227,7 +1243,7 @@ chk_add_nr() ...@@ -1227,7 +1243,7 @@ chk_add_nr()
if [ "$count" != "$syn_ack_nr" ]; then if [ "$count" != "$syn_ack_nr" ]; then
echo "[fail] got $count JOIN[s] synack with a different \ echo "[fail] got $count JOIN[s] synack with a different \
port-number expected $syn_ack_nr" port-number expected $syn_ack_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1240,7 +1256,7 @@ chk_add_nr() ...@@ -1240,7 +1256,7 @@ chk_add_nr()
if [ "$count" != "$ack_nr" ]; then if [ "$count" != "$ack_nr" ]; then
echo "[fail] got $count JOIN[s] ack with a different \ echo "[fail] got $count JOIN[s] ack with a different \
port-number expected $ack_nr" port-number expected $ack_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -1253,7 +1269,7 @@ chk_add_nr() ...@@ -1253,7 +1269,7 @@ chk_add_nr()
if [ "$count" != "$mis_syn_nr" ]; then if [ "$count" != "$mis_syn_nr" ]; then
echo "[fail] got $count JOIN[s] syn with a mismatched \ echo "[fail] got $count JOIN[s] syn with a mismatched \
port-number expected $mis_syn_nr" port-number expected $mis_syn_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1266,7 +1282,7 @@ chk_add_nr() ...@@ -1266,7 +1282,7 @@ chk_add_nr()
if [ "$count" != "$mis_ack_nr" ]; then if [ "$count" != "$mis_ack_nr" ]; then
echo "[fail] got $count JOIN[s] ack with a mismatched \ echo "[fail] got $count JOIN[s] ack with a mismatched \
port-number expected $mis_ack_nr" port-number expected $mis_ack_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -1311,7 +1327,7 @@ chk_rm_nr() ...@@ -1311,7 +1327,7 @@ chk_rm_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$rm_addr_nr" ]; then if [ "$count" != "$rm_addr_nr" ]; then
echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1334,14 +1350,14 @@ chk_rm_nr() ...@@ -1334,14 +1350,14 @@ chk_rm_nr()
echo "[ ok ] $suffix" echo "[ ok ] $suffix"
else else
echo "[fail] got $count RM_SUBFLOW[s] expected in range [$rm_subflow_nr:$((rm_subflow_nr*2))]" echo "[fail] got $count RM_SUBFLOW[s] expected in range [$rm_subflow_nr:$((rm_subflow_nr*2))]"
ret=1 fail_test
dump_stats=1 dump_stats=1
fi fi
return return
fi fi
if [ "$count" != "$rm_subflow_nr" ]; then if [ "$count" != "$rm_subflow_nr" ]; then
echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr" echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1364,7 +1380,7 @@ chk_prio_nr() ...@@ -1364,7 +1380,7 @@ chk_prio_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$mp_prio_nr_tx" ]; then if [ "$count" != "$mp_prio_nr_tx" ]; then
echo "[fail] got $count MP_PRIO[s] TX expected $mp_prio_nr_tx" echo "[fail] got $count MP_PRIO[s] TX expected $mp_prio_nr_tx"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo -n "[ ok ]" echo -n "[ ok ]"
...@@ -1375,7 +1391,7 @@ chk_prio_nr() ...@@ -1375,7 +1391,7 @@ chk_prio_nr()
[ -z "$count" ] && count=0 [ -z "$count" ] && count=0
if [ "$count" != "$mp_prio_nr_rx" ]; then if [ "$count" != "$mp_prio_nr_rx" ]; then
echo "[fail] got $count MP_PRIO[s] RX expected $mp_prio_nr_rx" echo "[fail] got $count MP_PRIO[s] RX expected $mp_prio_nr_rx"
ret=1 fail_test
dump_stats=1 dump_stats=1
else else
echo "[ ok ]" echo "[ ok ]"
...@@ -1399,7 +1415,7 @@ chk_link_usage() ...@@ -1399,7 +1415,7 @@ chk_link_usage()
if [ $tx_rate -lt $((expected_rate - $tolerance)) -o \ if [ $tx_rate -lt $((expected_rate - $tolerance)) -o \
$tx_rate -gt $((expected_rate + $tolerance)) ]; then $tx_rate -gt $((expected_rate + $tolerance)) ]; then
echo "[fail] got $tx_rate% usage, expected $expected_rate%" echo "[fail] got $tx_rate% usage, expected $expected_rate%"
ret=1 fail_test
else else
echo "[ ok ]" echo "[ ok ]"
fi fi
...@@ -2616,4 +2632,13 @@ for subtests in "${tests[@]}"; do ...@@ -2616,4 +2632,13 @@ for subtests in "${tests[@]}"; do
"${subtests}" "${subtests}"
done done
if [ ${ret} -ne 0 ]; then
echo
echo "${#failed_tests[@]} failure(s) has(ve) been detected:"
for i in $(get_failed_tests_ids); do
echo -e "\t- ${i}: ${failed_tests[${i}]}"
done
echo
fi
exit $ret exit $ret
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