mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
Merge branch 'selftests-mptcp-add-time-per-subtests-in-tap-output'
Matthieu Baerts says: ==================== selftests: mptcp: add time per subtests in TAP output Patches here add 'time=<N>ms' in the diagnostic data of the TAP output, e.g. ok 1 - pm_netlink: defaults addr list # time=9ms This addition is useful to quickly identify which subtests are taking a longer time than the others, or more than expected. Note that there are no specific formats to follow to show this time according to the TAP 13, TAP 14 and KTAP specifications, but we follow the format being parsed by NIPA [1]. Patch 1 modifies mptcp_lib.sh to add this support to all MPTCP selftests. Patch 2 removes the now duplicated info in mptcp_connect.sh Patch 3 slightly improves the precision of the first subtests in all MPTCP subtests. Patches 4 and 5 remove duplicated spaces in TAP output, for the TAP parsers that cannot handle them properly. v1: https://lore.kernel.org/20240902-net-next-mptcp-ksft-subtest-time-v1-0-f1ed499a11b1@kernel.org Link: https://github.com/linux-netdev/nipa/pull/36 ==================== Link: https://patch.msgid.link/20240906-net-next-mptcp-ksft-subtest-time-v2-0-31d5ee4f3bdf@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
3e3353527f
|
|
@ -284,7 +284,7 @@ echo "b" | \
|
|||
./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} -w 20 \
|
||||
127.0.0.1 >/dev/null &
|
||||
wait_connected $ns 10000
|
||||
chk_msk_nr 2 "after MPC handshake "
|
||||
chk_msk_nr 2 "after MPC handshake"
|
||||
chk_last_time_info 10000
|
||||
chk_msk_remote_key_nr 2 "....chk remote_key"
|
||||
chk_msk_fallback_nr 0 "....chk no fallback"
|
||||
|
|
|
|||
|
|
@ -345,9 +345,11 @@ do_transfer()
|
|||
|
||||
local addr_port
|
||||
addr_port=$(printf "%s:%d" ${connect_addr} ${port})
|
||||
local result_msg
|
||||
result_msg="$(printf "%.3s %-5s -> %.3s (%-20s) %-5s" ${connector_ns} ${cl_proto} ${listener_ns} ${addr_port} ${srv_proto})"
|
||||
mptcp_lib_print_title "${result_msg}"
|
||||
local pretty_title
|
||||
pretty_title="$(printf "%.3s %-5s -> %.3s (%-20s) %-5s" ${connector_ns} ${cl_proto} ${listener_ns} ${addr_port} ${srv_proto})"
|
||||
mptcp_lib_print_title "${pretty_title}"
|
||||
|
||||
local tap_title="${connector_ns:0:3} ${cl_proto} -> ${listener_ns:0:3} (${addr_port}) ${srv_proto}"
|
||||
|
||||
if $capture; then
|
||||
local capuser
|
||||
|
|
@ -431,7 +433,6 @@ do_transfer()
|
|||
|
||||
local duration
|
||||
duration=$((stop-start))
|
||||
result_msg+=" # time=${duration}ms"
|
||||
printf "(duration %05sms) " "${duration}"
|
||||
if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
|
||||
mptcp_lib_pr_fail "client exit code $retc, server $rets"
|
||||
|
|
@ -444,7 +445,7 @@ do_transfer()
|
|||
|
||||
echo
|
||||
cat "$capout"
|
||||
mptcp_lib_result_fail "${TEST_GROUP}: ${result_msg}"
|
||||
mptcp_lib_result_fail "${TEST_GROUP}: ${tap_title}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
@ -544,12 +545,12 @@ do_transfer()
|
|||
|
||||
if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then
|
||||
mptcp_lib_pr_ok "${extra:1}"
|
||||
mptcp_lib_result_pass "${TEST_GROUP}: ${result_msg}"
|
||||
mptcp_lib_result_pass "${TEST_GROUP}: ${tap_title}"
|
||||
else
|
||||
if [ -n "${extra}" ]; then
|
||||
mptcp_lib_print_warn "${extra:1}"
|
||||
fi
|
||||
mptcp_lib_result_fail "${TEST_GROUP}: ${result_msg}"
|
||||
mptcp_lib_result_fail "${TEST_GROUP}: ${tap_title}"
|
||||
fi
|
||||
|
||||
cat "$capout"
|
||||
|
|
@ -848,6 +849,8 @@ stop_if_error()
|
|||
make_file "$cin" "client"
|
||||
make_file "$sin" "server"
|
||||
|
||||
mptcp_lib_subtests_last_ts_reset
|
||||
|
||||
check_mptcp_disabled
|
||||
|
||||
stop_if_error "The kernel configuration is not valid for MPTCP"
|
||||
|
|
|
|||
|
|
@ -3959,9 +3959,11 @@ if [ ${#tests[@]} -eq 0 ]; then
|
|||
tests=("${all_tests_names[@]}")
|
||||
fi
|
||||
|
||||
mptcp_lib_subtests_last_ts_reset
|
||||
for subtests in "${tests[@]}"; do
|
||||
"${subtests}"
|
||||
done
|
||||
append_prev_results
|
||||
|
||||
if [ ${ret} -ne 0 ]; then
|
||||
echo
|
||||
|
|
@ -3972,7 +3974,6 @@ if [ ${ret} -ne 0 ]; then
|
|||
echo
|
||||
fi
|
||||
|
||||
append_prev_results
|
||||
mptcp_lib_result_print_all_tap
|
||||
|
||||
exit $ret
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ declare -rx MPTCP_LIB_AF_INET6=10
|
|||
MPTCP_LIB_SUBTESTS=()
|
||||
MPTCP_LIB_SUBTESTS_DUPLICATED=0
|
||||
MPTCP_LIB_SUBTEST_FLAKY=0
|
||||
MPTCP_LIB_SUBTESTS_LAST_TS_MS=
|
||||
MPTCP_LIB_TEST_COUNTER=0
|
||||
MPTCP_LIB_TEST_FORMAT="%02u %-50s"
|
||||
MPTCP_LIB_IP_MPTCP=0
|
||||
|
|
@ -205,6 +206,11 @@ mptcp_lib_kversion_ge() {
|
|||
mptcp_lib_fail_if_expected_feature "kernel version ${1} lower than ${v}"
|
||||
}
|
||||
|
||||
mptcp_lib_subtests_last_ts_reset() {
|
||||
MPTCP_LIB_SUBTESTS_LAST_TS_MS="$(date +%s%3N)"
|
||||
}
|
||||
mptcp_lib_subtests_last_ts_reset
|
||||
|
||||
__mptcp_lib_result_check_duplicated() {
|
||||
local subtest
|
||||
|
||||
|
|
@ -219,13 +225,22 @@ __mptcp_lib_result_check_duplicated() {
|
|||
|
||||
__mptcp_lib_result_add() {
|
||||
local result="${1}"
|
||||
local time="time="
|
||||
local ts_prev_ms
|
||||
shift
|
||||
|
||||
local id=$((${#MPTCP_LIB_SUBTESTS[@]} + 1))
|
||||
|
||||
__mptcp_lib_result_check_duplicated "${*}"
|
||||
|
||||
MPTCP_LIB_SUBTESTS+=("${result} ${id} - ${KSFT_TEST}: ${*}")
|
||||
# not to add two '#'
|
||||
[[ "${*}" != *"#"* ]] && time="# ${time}"
|
||||
|
||||
ts_prev_ms="${MPTCP_LIB_SUBTESTS_LAST_TS_MS}"
|
||||
mptcp_lib_subtests_last_ts_reset
|
||||
time+="$((MPTCP_LIB_SUBTESTS_LAST_TS_MS - ts_prev_ms))ms"
|
||||
|
||||
MPTCP_LIB_SUBTESTS+=("${result} ${id} - ${KSFT_TEST}: ${*} ${time}")
|
||||
}
|
||||
|
||||
# $1: test name
|
||||
|
|
|
|||
|
|
@ -349,6 +349,7 @@ init
|
|||
make_file "$cin" "client" 1
|
||||
make_file "$sin" "server" 1
|
||||
trap cleanup EXIT
|
||||
mptcp_lib_subtests_last_ts_reset
|
||||
|
||||
run_tests $ns1 $ns2 10.0.1.1
|
||||
run_tests $ns1 $ns2 dead:beef:1::1
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ check()
|
|||
fi
|
||||
}
|
||||
|
||||
mptcp_lib_subtests_last_ts_reset
|
||||
|
||||
check "show_endpoints" "" "defaults addr list"
|
||||
|
||||
default_limits="$(get_limits)"
|
||||
|
|
|
|||
|
|
@ -286,6 +286,7 @@ while getopts "bcdhi" option;do
|
|||
done
|
||||
|
||||
setup
|
||||
mptcp_lib_subtests_last_ts_reset
|
||||
run_test 10 10 0 0 "balanced bwidth"
|
||||
run_test 10 10 1 25 "balanced bwidth with unbalanced delay"
|
||||
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ mptcp_lib_events "${ns2}" "${client_evts}" client_evts_pid
|
|||
server_evts=$(mktemp)
|
||||
mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid
|
||||
sleep 0.5
|
||||
mptcp_lib_subtests_last_ts_reset
|
||||
|
||||
print_title "Init"
|
||||
print_test "Created network namespaces ns1, ns2"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user