selftests: mptcp: add time per subtests in TAP output
Subsystems (3)
Matthieu Baerts (NGI0)
maintainercover 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.
---
Matthieu Baerts (NGI0) (3):
selftests: mptcp: lib: add time per subtests in TAP output
sefltests: mptcp: connect: remote time in TAP output
selftests: mptcp: reset the last TS before the first test
tools/testing/selftests/net/mptcp/mptcp_connect.sh | 3 ++- tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 17 ++++++++++++++++- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 1 + tools/testing/selftests/net/mptcp/pm_netlink.sh | 2 ++ tools/testing/selftests/net/mptcp/simult_flows.sh | 1 + tools/testing/selftests/net/mptcp/userspace_pm.sh | 1 + 7 files changed, 25 insertions(+), 3 deletions(-)
---
base-commit: 624d90dc5dcaee846a57aa0985789623f7c64f2e
change-id: 20240821-mptcp-ksft-time-db492f4ec4da
Best regards,
Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
Matthieu Baerts (NGI0)
maintainerPATCH 1/3 selftests: mptcp: lib: add time per subtests in TAP output
It adds '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 [1], TAP 14 [2] and KTAP [3] specifications. Let's then define this one here.
--- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_lib.sh +16 -1
@@ -25,6 +25,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
@@ -201,6 +202,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
@@ -215,13 +221,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
Signature · 1 line
2.45.2
Matthieu Baerts (NGI0)
maintainerPATCH 2/3 sefltests: mptcp: connect: remote time in TAP output
In reply to Matthieu Baerts (NGI0)It is now added by the MPTCP lib automatically, see the parent commit.
The time in the TAP output might be sligly different from the one displayed before, but that's OK.
--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +0 -1
@@ -431,7 +431,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"
Signature · 1 line
2.45.2
Matthieu Baerts (NGI0)
maintainerPATCH 3/3 selftests: mptcp: reset the last TS before the first test
In reply to Matthieu Baerts (NGI0)Just to slightly improve the precision of the duration of the first test.
In mptcp_join.sh, the last append_prev_results is now done as soon as the last test is over: this will add the last result in the list, and get a more precise time for this last test.
--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 2 ++ tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 1 + tools/testing/selftests/net/mptcp/pm_netlink.sh | 2 ++ tools/testing/selftests/net/mptcp/simult_flows.sh | 1 + tools/testing/selftests/net/mptcp/userspace_pm.sh | 1 + 6 files changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +2 -0
@@ -847,6 +847,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"
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -1
@@ -3868,9 +3868,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
@@ -3881,7 +3883,6 @@ if [ ${ret} -ne 0 ]; then echo fi -append_prev_results mptcp_lib_result_print_all_tap exit $ret
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +1 -0
@@ -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
tools/testing/selftests/net/mptcp/pm_netlink.sh +2 -0
@@ -137,6 +137,8 @@ check() fi } +mptcp_lib_subtests_last_ts_reset + check "show_endpoints" "" "defaults addr list" default_limits="$(get_limits)"
tools/testing/selftests/net/mptcp/simult_flows.sh +1 -0
@@ -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"
tools/testing/selftests/net/mptcp/userspace_pm.sh +1 -0
@@ -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"
Signature · 1 line
2.45.2
Hi Matthieu,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/10489178247
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/e69c1c7d48b1
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=881720
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Quoted 8 lines · On Wed, 21 Aug 2024, Matthieu Baerts (NGI0) wrote:
Patches here add 'time=<N>ms' in the diagnostic data of the TAP output, e.g.
ok 1 -
pm_netlink: defaults addr list # time=9msThis addition is useful to quickly identify which subtests are taking a longer time than the others, or more than expected.
Quoted 7 lines
Signed-off-by Matthieu Baerts (NGI0) <[email protected]>---
Matthieu Baerts (NGI0) (3):
selftests: mptcp: lib: add time per subtests in TAP output
sefltests: mptcp: connect: remote time in TAP output
selftests: mptcp: reset the last TS before the first test
Matthieu -
Series LGTM, thanks!
Matthieu Baerts
maintainerHi Mat,
Quoted 18 lines · Mat Martineau
Quoted 8 lines · On Wed, 21 Aug 2024, Matthieu Baerts (NGI0) wrote:
Patches here add 'time=<N>ms' in the diagnostic data of the TAP output, e.g.
ok 1 -
pm_netlink: defaults addr list # time=9msThis addition is useful to quickly identify which subtests are taking a longer time than the others, or more than expected.
Quoted 7 lines
Signed-off-by Matthieu Baerts (NGI0) <[email protected]>---
Matthieu Baerts (NGI0) (3):
selftests: mptcp: lib: add time per subtests in TAP output
sefltests: mptcp: connect: remote time in TAP output
selftests: mptcp: reset the last TS before the first test
Quoted 5 lines
Matthieu -
Series LGTM, thanks!
Reviewed-by Mat Martineau <[email protected]>
Thank you for the review!
New patches for t/upstream:
- 61eb92f67b13: selftests: mptcp: lib: add time per subtests in TAP output
- 301490f2d642: sefltests: mptcp: connect: remote time in TAP output
- 789ba8f8b57f: selftests: mptcp: reset the last TS before the first test
- Results: c94cd4e2e8ed..6b5502abeca5 (export)
Tests are now in progress:
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.