Message ID | a8b3d8258a995034348b7e5fd370346fc3af368c.1712062199.git.tanggeliang@kylinos.cn (mailing list archive) |
---|---|
State | Accepted, archived |
Commit | 39e0a5698a69442505e86aa9ed72d1aa5e47ac66 |
Delegated to: | Matthieu Baerts |
Headers | show |
Series | display "last time" actions info | expand |
Context | Check | Description |
---|---|---|
matttbe/build | success | Build and static analysis OK |
matttbe/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 63 lines checked |
matttbe/shellcheck | success | No ShellCheck issues |
matttbe/KVM_Validation__normal | success | Success! ✅ |
matttbe/KVM_Validation__debug | success | Success! ✅ |
matttbe/KVM_Validation__btf__only_bpftest_all_ | success | Success! ✅ |
Hi Geliang, On 02/04/2024 14:52, Geliang Tang wrote: > From: Geliang Tang <tanggeliang@kylinos.cn> > > This patch adds a new helper chk_msk_info() to show the counters in > mptcp_info of the given info, and check that the timestamps move > forward. Use it to show newly added last_data_sent, last_data_recv > and last_ack_recv in mptcp_info in chk_last_time_info(). > > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> > --- > tools/testing/selftests/net/mptcp/diag.sh | 51 +++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh > index bc97ab33a00e..911920f3edbb 100755 > --- a/tools/testing/selftests/net/mptcp/diag.sh > +++ b/tools/testing/selftests/net/mptcp/diag.sh > @@ -200,6 +200,56 @@ chk_msk_cestab() > "${expected}" "${msg}" "" > } > > +msk_info_get_value() > +{ > + local port="${1}" > + local info="${2}" > + > + ss -N "${ns}" -inHM dport "${port}" | \ > + mptcp_lib_get_info_value "${info}" "${info}" > +} > + > +chk_msk_info() > +{ > + local port="${1}" > + local info="${2}" > + local cnt="${3}" > + local now delta_ms=250 > + > + now=$(msk_info_get_value "${port}" "${info}") > + > + mptcp_lib_print_title "....chk ${info}" One small detail: here the title printed here ... > + if { [ -z "${cnt}" ] || [ -z "${now}" ]; } && > + ! mptcp_lib_expect_all_features; then > + mptcp_lib_pr_skip "Feature probably not supported" > + mptcp_lib_result_skip "${info}" ... and the title used in the TAP format here ... > + elif [ "$((cnt + delta_ms))" -lt "${now}" ]; then > + mptcp_lib_pr_ok > + mptcp_lib_result_pass "${info}" ... here ... > + else > + mptcp_lib_pr_fail "value of ${info} changed by $((now - cnt))ms," \ > + "expected at least ${delta_ms}ms" > + mptcp_lib_result_fail "${info}" ... and here are different: Output: (...) # 06 after MPC handshake [ OK ] # 07 ....chk last_data_sent [ OK ] # 08 ....chk last_data_recv [ OK ] # 09 ....chk last_ack_recv [ OK ] # 10 ....chk remote_key [ OK ] # 11 ....chk no fallback [ OK ] # 12 ....chk 2 msk in use [ OK ] # 13 ....chk 2 cestab [ OK ] # 14 ....chk 2->0 msk in use after flush [ OK ] # 15 ....chk 2->0 cestab after flush [ OK ] (...) TAP: (...) # ok 6 - diag: after MPC handshake # ok 7 - diag: last_data_sent # ok 8 - diag: last_data_recv # ok 9 - diag: last_ack_recv # ok 10 - diag: ....chk remote_key # ok 11 - diag: ....chk no fallback # ok 12 - diag: ....chk 2 msk in use # ok 13 - diag: ....chk 2 cestab # ok 14 - diag: ....chk 2->0 msk in use after flush # ok 15 - diag: ....chk 2->0 cestab after flush (...) apart from that, the rest looks good to me. Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> If there are no other modifications needed after Mat's review, I can also fix that when applying the patches. > + ret=${KSFT_FAIL} > + fi > +} > + > +chk_last_time_info() > +{ > + local port="${1}" > + local data_sent data_recv ack_recv > + > + data_sent=$(msk_info_get_value "${port}" "last_data_sent") > + data_recv=$(msk_info_get_value "${port}" "last_data_recv") > + ack_recv=$(msk_info_get_value "${port}" "last_ack_recv") > + > + sleep 0.5 (while at it, maybe good to add a comment here) sleep 0.5 # wait to check after if the timestamps are bigger (and above) local delta_ms=250 # half what we waited before, just to be sure > + > + chk_msk_info "${port}" "last_data_sent" "${data_sent}" > + chk_msk_info "${port}" "last_data_recv" "${data_recv}" > + chk_msk_info "${port}" "last_ack_recv" "${ack_recv}" > +} > + > wait_connected() > { > local listener_ns="${1}" > @@ -233,6 +283,7 @@ echo "b" | \ > 127.0.0.1 >/dev/null & > wait_connected $ns 10000 > 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" > chk_msk_inuse 2 Cheers, Matt
diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index bc97ab33a00e..911920f3edbb 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -200,6 +200,56 @@ chk_msk_cestab() "${expected}" "${msg}" "" } +msk_info_get_value() +{ + local port="${1}" + local info="${2}" + + ss -N "${ns}" -inHM dport "${port}" | \ + mptcp_lib_get_info_value "${info}" "${info}" +} + +chk_msk_info() +{ + local port="${1}" + local info="${2}" + local cnt="${3}" + local now delta_ms=250 + + now=$(msk_info_get_value "${port}" "${info}") + + mptcp_lib_print_title "....chk ${info}" + if { [ -z "${cnt}" ] || [ -z "${now}" ]; } && + ! mptcp_lib_expect_all_features; then + mptcp_lib_pr_skip "Feature probably not supported" + mptcp_lib_result_skip "${info}" + elif [ "$((cnt + delta_ms))" -lt "${now}" ]; then + mptcp_lib_pr_ok + mptcp_lib_result_pass "${info}" + else + mptcp_lib_pr_fail "value of ${info} changed by $((now - cnt))ms," \ + "expected at least ${delta_ms}ms" + mptcp_lib_result_fail "${info}" + ret=${KSFT_FAIL} + fi +} + +chk_last_time_info() +{ + local port="${1}" + local data_sent data_recv ack_recv + + data_sent=$(msk_info_get_value "${port}" "last_data_sent") + data_recv=$(msk_info_get_value "${port}" "last_data_recv") + ack_recv=$(msk_info_get_value "${port}" "last_ack_recv") + + sleep 0.5 + + chk_msk_info "${port}" "last_data_sent" "${data_sent}" + chk_msk_info "${port}" "last_data_recv" "${data_recv}" + chk_msk_info "${port}" "last_ack_recv" "${ack_recv}" +} + wait_connected() { local listener_ns="${1}" @@ -233,6 +283,7 @@ echo "b" | \ 127.0.0.1 >/dev/null & wait_connected $ns 10000 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" chk_msk_inuse 2