Commit fd959262 authored by Geliang Tang's avatar Geliang Tang Committed by Jakub Kicinski

selftests: mptcp: sockopt: print every test result

Only total test results are printed out in mptcp_sockopt.sh:

PASS: all packets had packet mark set
PASS: SOL_MPTCP getsockopt has expected information
PASS: TCP_INQ cmsg/ioctl -t tcp
PASS: TCP_INQ cmsg/ioctl -6 -t tcp
PASS: TCP_INQ cmsg/ioctl -r tcp
PASS: TCP_INQ cmsg/ioctl -6 -r tcp
PASS: TCP_INQ cmsg/ioctl -r tcp -t tcp

They mismatch with the test results:

ok 1 - mptcp_sockopt: mark ipv4
ok 2 - mptcp_sockopt: transfer ipv4
ok 3 - mptcp_sockopt: mark ipv6
ok 4 - mptcp_sockopt: transfer ipv6
ok 5 - mptcp_sockopt: sockopt v4
ok 6 - mptcp_sockopt: sockopt v6
ok 7 - mptcp_sockopt: TCP_INQ: -t tcp
ok 8 - mptcp_sockopt: TCP_INQ: -6 -t tcp
ok 9 - mptcp_sockopt: TCP_INQ: -r tcp
ok 10 - mptcp_sockopt: TCP_INQ: -6 -r tcp
ok 11 - mptcp_sockopt: TCP_INQ: -r tcp -t tcp

'mptcp_sockopt.sh' now display more detailed results + why (what you had
in a former patch from v6, merged here). It no longer displays 'PASS:',
because it is duplicated info now that the detailed are displayed:

Transfer v4                                       [ OK ]
Mark v4                                           [ OK ]
Transfer v6                                       [ OK ]
Mark v6                                           [ OK ]
SOL_MPTCP sockopt v4                              [ OK ]
SOL_MPTCP sockopt v6                              [ OK ]
TCP_INQ cmsg/ioctl -t tcp                         [ OK ]
TCP_INQ cmsg/ioctl -6 -t tcp                      [ OK ]
TCP_INQ cmsg/ioctl -r tcp                         [ OK ]
TCP_INQ cmsg/ioctl -6 -r tcp                      [ OK ]
TCP_INQ cmsg/ioctl -r tcp -t tcp                  [ OK ]

Also fix the TAP output:

ok 1 - mptcp_sockopt: transfer ipv4
ok 2 - mptcp_sockopt: mark ipv4
ok 3 - mptcp_sockopt: transfer ipv6
ok 4 - mptcp_sockopt: mark ipv6
ok 5 - mptcp_sockopt: sockopt v4
ok 6 - mptcp_sockopt: sockopt v6
ok 7 - mptcp_sockopt: TCP_INQ: -t tcp
ok 8 - mptcp_sockopt: TCP_INQ: -6 -t tcp
ok 9 - mptcp_sockopt: TCP_INQ: -r tcp
ok 10 - mptcp_sockopt: TCP_INQ: -6 -r tcp
ok 11 - mptcp_sockopt: TCP_INQ: -r tcp -t tcp
Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240308-upstream-net-next-20240308-selftests-mptcp-unification-v1-4-4f42c347b653@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c9161a0f
...@@ -113,6 +113,11 @@ check_mark() ...@@ -113,6 +113,11 @@ check_mark()
return 0 return 0
} }
print_title()
{
printf "%-50s" "${@}"
}
do_transfer() do_transfer()
{ {
local listener_ns="$1" local listener_ns="$1"
...@@ -162,8 +167,9 @@ do_transfer() ...@@ -162,8 +167,9 @@ do_transfer()
wait $spid wait $spid
local rets=$? local rets=$?
print_title "Transfer ${ip:2}"
if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
echo " client exit code $retc, server $rets" echo "[FAIL] client exit code $retc, server $rets"
echo -e "\nnetns ${listener_ns} socket stat for ${port}:" 1>&2 echo -e "\nnetns ${listener_ns} socket stat for ${port}:" 1>&2
ip netns exec ${listener_ns} ss -Menita 1>&2 -o "sport = :$port" ip netns exec ${listener_ns} ss -Menita 1>&2 -o "sport = :$port"
...@@ -175,7 +181,14 @@ do_transfer() ...@@ -175,7 +181,14 @@ do_transfer()
ret=1 ret=1
return 1 return 1
fi fi
if ! mptcp_lib_check_transfer $cin $sout "file received by server"; then
rets=1
else
echo "[ OK ]"
fi
mptcp_lib_result_code "${rets}" "transfer ${ip}"
print_title "Mark ${ip:2}"
if [ $local_addr = "::" ];then if [ $local_addr = "::" ];then
check_mark $listener_ns 6 || retc=1 check_mark $listener_ns 6 || retc=1
check_mark $connector_ns 6 || retc=1 check_mark $connector_ns 6 || retc=1
...@@ -184,15 +197,13 @@ do_transfer() ...@@ -184,15 +197,13 @@ do_transfer()
check_mark $connector_ns 4 || retc=1 check_mark $connector_ns 4 || retc=1
fi fi
mptcp_lib_check_transfer $cin $sout "file received by server"
rets=$?
mptcp_lib_result_code "${retc}" "mark ${ip}" mptcp_lib_result_code "${retc}" "mark ${ip}"
mptcp_lib_result_code "${rets}" "transfer ${ip}"
if [ $retc -eq 0 ] && [ $rets -eq 0 ];then if [ $retc -eq 0 ] && [ $rets -eq 0 ];then
echo "[ OK ]"
return 0 return 0
fi fi
echo "[FAIL]"
return 1 return 1
} }
...@@ -221,23 +232,27 @@ do_mptcp_sockopt_tests() ...@@ -221,23 +232,27 @@ do_mptcp_sockopt_tests()
ip netns exec "$ns_sbox" ./mptcp_sockopt ip netns exec "$ns_sbox" ./mptcp_sockopt
lret=$? lret=$?
print_title "SOL_MPTCP sockopt v4"
if [ $lret -ne 0 ]; then if [ $lret -ne 0 ]; then
echo "FAIL: SOL_MPTCP getsockopt" echo "[FAIL]"
mptcp_lib_result_fail "sockopt v4" mptcp_lib_result_fail "sockopt v4"
ret=$lret ret=$lret
return return
fi fi
echo "[ OK ]"
mptcp_lib_result_pass "sockopt v4" mptcp_lib_result_pass "sockopt v4"
ip netns exec "$ns_sbox" ./mptcp_sockopt -6 ip netns exec "$ns_sbox" ./mptcp_sockopt -6
lret=$? lret=$?
print_title "SOL_MPTCP sockopt v6"
if [ $lret -ne 0 ]; then if [ $lret -ne 0 ]; then
echo "FAIL: SOL_MPTCP getsockopt (ipv6)" echo "[FAIL]"
mptcp_lib_result_fail "sockopt v6" mptcp_lib_result_fail "sockopt v6"
ret=$lret ret=$lret
return return
fi fi
echo "[ OK ]"
mptcp_lib_result_pass "sockopt v6" mptcp_lib_result_pass "sockopt v6"
} }
...@@ -260,16 +275,17 @@ run_tests() ...@@ -260,16 +275,17 @@ run_tests()
do_tcpinq_test() do_tcpinq_test()
{ {
print_title "TCP_INQ cmsg/ioctl $*"
ip netns exec "$ns_sbox" ./mptcp_inq "$@" ip netns exec "$ns_sbox" ./mptcp_inq "$@"
local lret=$? local lret=$?
if [ $lret -ne 0 ];then if [ $lret -ne 0 ];then
ret=$lret ret=$lret
echo "FAIL: mptcp_inq $*" echo "[FAIL]"
mptcp_lib_result_fail "TCP_INQ: $*" mptcp_lib_result_fail "TCP_INQ: $*"
return $lret return $lret
fi fi
echo "PASS: TCP_INQ cmsg/ioctl $*" echo "[ OK ]"
mptcp_lib_result_pass "TCP_INQ: $*" mptcp_lib_result_pass "TCP_INQ: $*"
return $lret return $lret
} }
...@@ -315,15 +331,7 @@ trap cleanup EXIT ...@@ -315,15 +331,7 @@ trap cleanup EXIT
run_tests $ns1 $ns2 10.0.1.1 run_tests $ns1 $ns2 10.0.1.1
run_tests $ns1 $ns2 dead:beef:1::1 run_tests $ns1 $ns2 dead:beef:1::1
if [ $ret -eq 0 ];then
echo "PASS: all packets had packet mark set"
fi
do_mptcp_sockopt_tests do_mptcp_sockopt_tests
if [ $ret -eq 0 ];then
echo "PASS: SOL_MPTCP getsockopt has expected information"
fi
do_tcpinq_tests do_tcpinq_tests
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