selftests: mptcp: get counters from nstat history
Subsystems (3)
Matthieu Baerts (NGI0)
maintainercover selftests: mptcp: get counters from nstat history
When debugging MPTCP Join selftest with a "debug" kernel config, I noticed checking all the different counters was sometimes slower than the test itself. Fetching the counters once, then reading them from the history file that was already there seems to save more than 5 minutes when running the whole MPTCP Join selftest.
- Patch 1: move code to mptcp_lib.sh to prepare the new features.
- Patch 2: simplify mptcp_lib_pr_err_stats helper use.
- Patch 3: remove unused last column from nstat output.
- Patch 4: improve stats dump in mptcp_join.sh.
- Patch 5: get counters from nstat history.
Based-on: <[email protected]>
---
Matthieu Baerts (NGI0) (5):
selftests: mptcp: lib: introduce 'nstat_{init,get}'
selftests: mptcp: lib: remove stats files args
selftests: mptcp: lib: stats: remove nstat rate columns
selftests: mptcp: join: dump stats from history
selftests: mptcp: lib: get counters from nstat history
tools/testing/selftests/net/mptcp/mptcp_connect.sh | 100 ++++++++------------- tools/testing/selftests/net/mptcp/mptcp_join.sh | 31 ++++--- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 45 ++++++++-- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 15 ++-- tools/testing/selftests/net/mptcp/simult_flows.sh | 15 ++-- 5 files changed, 104 insertions(+), 102 deletions(-)
---
base-commit: 1b41f9e417a8db60baf3686b81346131d2d81f30
change-id: 20251101-slft-nstat-cache-db4d2962c5ce
Best regards,
Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
Matthieu Baerts (NGI0)
maintainerPATCH 1/5 selftests: mptcp: lib: introduce 'nstat_{init,get}'
These new helpers are easier to read than the long and multi lines commands. Plus it will ease the addition of new features related to that in the next commits.
No behavioural changes intended.
--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 12 ++++-------- tools/testing/selftests/net/mptcp/mptcp_join.sh | 12 ++++-------- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 14 ++++++++++++++ tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 12 ++++-------- tools/testing/selftests/net/mptcp/simult_flows.sh | 12 ++++-------- 5 files changed, 30 insertions(+), 32 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +4 -8
@@ -384,11 +384,9 @@ do_transfer() sleep 1 fi - NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ - nstat -n + mptcp_lib_nstat_init "${listener_ns}" if [ ${listener_ns} != ${connector_ns} ]; then - NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ - nstat -n + mptcp_lib_nstat_init "${connector_ns}" fi local stat_synrx_last_l
@@ -436,11 +434,9 @@ do_transfer() kill ${cappid_connector} fi - NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ - nstat | grep Tcp > /tmp/${listener_ns}.out + mptcp_lib_nstat_get "${listener_ns}" if [ ${listener_ns} != ${connector_ns} ]; then - NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ - nstat | grep Tcp > /tmp/${connector_ns}.out + mptcp_lib_nstat_get "${connector_ns}" fi local duration
tools/testing/selftests/net/mptcp/mptcp_join.sh +4 -8
@@ -1000,10 +1000,8 @@ do_transfer() cond_start_capture ${listener_ns} - NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ - nstat -n - NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ - nstat -n + mptcp_lib_nstat_init "${listener_ns}" + mptcp_lib_nstat_init "${connector_ns}" local extra_args if [ $speed = "fast" ]; then
@@ -1085,10 +1083,8 @@ do_transfer() cond_stop_capture - NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ - nstat | grep Tcp > /tmp/${listener_ns}.out - NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ - nstat | grep Tcp > /tmp/${connector_ns}.out + mptcp_lib_nstat_get "${listener_ns}" + mptcp_lib_nstat_get "${connector_ns}" if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then fail_test "client exit code $retc, server $rets"
tools/testing/selftests/net/mptcp/mptcp_lib.sh +14 -0
@@ -355,6 +355,20 @@ mptcp_lib_is_v6() { [ -z "${1##*:*}" ] } +mptcp_lib_nstat_init() { + local ns="${1}" + + NSTAT_HISTORY="/tmp/${ns}.nstat" ip netns exec "${ns}" nstat -n +} + +mptcp_lib_nstat_get() { + local ns="${1}" + + # filter out non-*TCP stats + NSTAT_HISTORY="/tmp/${ns}.nstat" ip netns exec "${ns}" nstat | + grep Tcp > "/tmp/${ns}.out" +} + # $1: ns, $2: MIB counter mptcp_lib_get_counter() { local ns="${1}"
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +4 -8
@@ -169,10 +169,8 @@ do_transfer() cmsg+=",TCPINQ" fi - NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ - nstat -n - NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ - nstat -n + mptcp_lib_nstat_init "${listener_ns}" + mptcp_lib_nstat_init "${connector_ns}" timeout ${timeout_test} \ ip netns exec ${listener_ns} \
@@ -194,10 +192,8 @@ do_transfer() wait $spid local rets=$? - NSTAT_HISTORY=/tmp/${listener_ns}.nstat ip netns exec ${listener_ns} \ - nstat | grep Tcp > /tmp/${listener_ns}.out - NSTAT_HISTORY=/tmp/${connector_ns}.nstat ip netns exec ${connector_ns} \ - nstat | grep Tcp > /tmp/${connector_ns}.out + mptcp_lib_nstat_get "${listener_ns}" + mptcp_lib_nstat_get "${connector_ns}" print_title "Transfer ${ip:2}" if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
tools/testing/selftests/net/mptcp/simult_flows.sh +4 -8
@@ -155,10 +155,8 @@ do_transfer() sleep 1 fi - NSTAT_HISTORY=/tmp/${ns3}.nstat ip netns exec ${ns3} \ - nstat -n - NSTAT_HISTORY=/tmp/${ns1}.nstat ip netns exec ${ns1} \ - nstat -n + mptcp_lib_nstat_init "${ns3}" + mptcp_lib_nstat_init "${ns1}" timeout ${timeout_test} \ ip netns exec ${ns3} \
@@ -185,10 +183,8 @@ do_transfer() kill ${cappid_connector} fi - NSTAT_HISTORY=/tmp/${ns3}.nstat ip netns exec ${ns3} \ - nstat | grep Tcp > /tmp/${ns3}.out - NSTAT_HISTORY=/tmp/${ns1}.nstat ip netns exec ${ns1} \ - nstat | grep Tcp > /tmp/${ns1}.out + mptcp_lib_nstat_get "${ns3}" + mptcp_lib_nstat_get "${ns1}" cmp $sin $cout > /dev/null 2>&1 local cmps=$?
Signature · 1 line
2.51.0
Matthieu Baerts (NGI0)
maintainerPATCH 2/5 selftests: mptcp: lib: remove stats files args
In reply to Matthieu Baerts (NGI0)Now that these files are written from MPTCP lib helpers, the stats file paths are uniformed. Then, no need to specify them from the each selftest.
No behavioural changes intended.
--- 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 | 15 ++++++++++----- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 3 +-- tools/testing/selftests/net/mptcp/simult_flows.sh | 3 +-- 5 files changed, 14 insertions(+), 13 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +1 -2
@@ -444,8 +444,7 @@ do_transfer() printf "(duration %05sms) " "${duration}" if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then mptcp_lib_pr_fail "client exit code $retc, server $rets" - mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}" \ - "/tmp/${listener_ns}.out" "/tmp/${connector_ns}.out" + mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}" echo cat "$capout"
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -2
@@ -1088,8 +1088,7 @@ do_transfer() if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then fail_test "client exit code $retc, server $rets" - mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}" \ - "/tmp/${listener_ns}.out" "/tmp/${connector_ns}.out" + mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}" return 1 fi
tools/testing/selftests/net/mptcp/mptcp_lib.sh +10 -5
@@ -106,23 +106,28 @@ mptcp_lib_pr_info() { mptcp_lib_print_info "INFO: ${*}" } -# $1-2: listener/connector ns ; $3 port ; $4-5 listener/connector stat file +mptcp_lib_pr_nstat() { + local ns="${1}" + local hist="/tmp/${ns}.out" + + cat "${hist}" +} + +# $1-2: listener/connector ns ; $3 port mptcp_lib_pr_err_stats() { local lns="${1}" local cns="${2}" local port="${3}" - local lstat="${4}" - local cstat="${5}" echo -en "${MPTCP_LIB_COLOR_RED}" { printf "\nnetns %s (listener) socket stat for %d:\n" "${lns}" "${port}" ip netns exec "${lns}" ss -Menitam -o "sport = :${port}" - cat "${lstat}" + mptcp_lib_pr_nstat "${lns}" printf "\nnetns %s (connector) socket stat for %d:\n" "${cns}" "${port}" ip netns exec "${cns}" ss -Menitam -o "dport = :${port}" - [ "${lstat}" != "${cstat}" ] && cat "${cstat}" + [ "${lns}" != "${cns}" ] && mptcp_lib_pr_nstat "${cns}" } 1>&2 echo -en "${MPTCP_LIB_COLOR_RESET}" }
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +1 -2
@@ -198,8 +198,7 @@ do_transfer() print_title "Transfer ${ip:2}" if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then mptcp_lib_pr_fail "client exit code $retc, server $rets" - mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}" \ - "/tmp/${listener_ns}.out" "/tmp/${connector_ns}.out" + mptcp_lib_pr_err_stats "${listener_ns}" "${connector_ns}" "${port}" mptcp_lib_result_fail "transfer ${ip}"
tools/testing/selftests/net/mptcp/simult_flows.sh +1 -2
@@ -200,8 +200,7 @@ do_transfer() fi mptcp_lib_pr_fail "client exit code $retc, server $rets" - mptcp_lib_pr_err_stats "${ns3}" "${ns1}" "${port}" \ - "/tmp/${ns3}.out" "/tmp/${ns1}.out" + mptcp_lib_pr_err_stats "${ns3}" "${ns1}" "${port}" ls -l $sin $cout ls -l $cin $sout
Signature · 1 line
2.51.0
Matthieu Baerts (NGI0)
maintainerPATCH 3/5 selftests: mptcp: lib: stats: remove nstat rate columns
In reply to Matthieu Baerts (NGI0)With the MPTCP selftests, the nstat daemon is not used. It means that the last column (the rate) is always 0.0, and that's not something interesting to display.
Then, this last column can be filtered out.
--- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_lib.sh +2 -2
@@ -369,9 +369,9 @@ mptcp_lib_nstat_init() { mptcp_lib_nstat_get() { local ns="${1}" - # filter out non-*TCP stats + # filter out non-*TCP stats, and the rate (last column) NSTAT_HISTORY="/tmp/${ns}.nstat" ip netns exec "${ns}" nstat | - grep Tcp > "/tmp/${ns}.out" + grep -o ".*Tcp\S\+\s\+[0-9]\+" > "/tmp/${ns}.out" } # $1: ns, $2: MIB counter
Signature · 1 line
2.51.0
Matthieu Baerts (NGI0)
maintainerPATCH 4/5 selftests: mptcp: join: dump stats from history
In reply to Matthieu Baerts (NGI0)In case of errors, dump the stats from history instead of using nstat.
There are multiple advantages to that:
- The same filters from pr_err_stats are used, e.g. the unused 'rate' column is not displayed.
- The counters are closer to the ones from when the test stopped.
- While at it, the errors can be better presented: error colours, a small indentation to distinguish the different parts, extra new lines.
Even if it should only happen in rare cases -- internal errors, or netns issues -- if no history is available, 'nstat' is used like before, just in case.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 16 ++++++++++++---- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 6 +++++- 2 files changed, 17 insertions(+), 5 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +12 -4
@@ -1163,12 +1163,20 @@ run_tests() do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} } +_dump_stats() +{ + local ns="${1}" + local side="${2}" + + mptcp_lib_print_err "${side} ns stats (${ns2})" + mptcp_lib_pr_nstat "${ns}" + echo +} + dump_stats() { - echo Server ns stats - ip netns exec $ns1 nstat -as | grep Tcp - echo Client ns stats - ip netns exec $ns2 nstat -as | grep Tcp + _dump_stats "${ns1}" "Server" + _dump_stats "${ns2}" "Client" } chk_csum_nr()
tools/testing/selftests/net/mptcp/mptcp_lib.sh +5 -1
@@ -110,7 +110,11 @@ mptcp_lib_pr_nstat() { local ns="${1}" local hist="/tmp/${ns}.out" - cat "${hist}" + if [ -f "${hist}" ]; then + awk '{ print " "$0 }' "${hist}" + else + ip netns exec "${ns}" nstat -as | grep Tcp + fi } # $1-2: listener/connector ns ; $3 port
Signature · 1 line
2.51.0
Matthieu Baerts (NGI0)
maintainerPATCH 5/5 selftests: mptcp: lib: get counters from nstat history
In reply to Matthieu Baerts (NGI0)Before, 'nstat' was used to retrieve each individual counter: this means querying 4 different sources from /proc/net and iterating over 100+ counters each time. Instead, the stats could be retrieved once, and the output file could be parsed for each counter. Even better, such file is already present: the nstat history file.
To be able to get this working, the nstat history file also needs to contains zero counters too, so it is still possible to know if a counter is missing or set to 0.
This also simplifies mptcp_connect.sh: instead of checking multiple counters before and after a test to compute the difference, the stats history files can be reset before each test, and nstat can display only the difference.
mptcp_lib_get_counter() continues to work when no history file is
available: by fetching nstat directly, like before. This is the case in diag.sh and userspace_pm.sh where there is no need to save the history file. This is also the case in mptcp_join.sh, when 'run_tests' is executed in the background: easier to continue fetching counters than updating the history each time it is needed.
Note: 'nstat' is called with '-s' in mptcp_lib_nstat_get(), so this helper can be called multiple times during the test if needed.
--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 85 +++++++++------------- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 16 +++- 2 files changed, 46 insertions(+), 55 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +34 -51
@@ -389,21 +389,6 @@ do_transfer() mptcp_lib_nstat_init "${connector_ns}" fi - local stat_synrx_last_l - local stat_ackrx_last_l - local stat_cookietx_last - local stat_cookierx_last - local stat_csum_err_s - local stat_csum_err_c - local stat_tcpfb_last_l - stat_synrx_last_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableSYNRX") - stat_ackrx_last_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableACKRX") - stat_cookietx_last=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesSent") - stat_cookierx_last=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesRecv") - stat_csum_err_s=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtDataCsumErr") - stat_csum_err_c=$(mptcp_lib_get_counter "${connector_ns}" "MPTcpExtDataCsumErr") - stat_tcpfb_last_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableFallbackACK") - timeout ${timeout_test} \ ip netns exec ${listener_ns} \ ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
@@ -458,38 +443,38 @@ do_transfer() rets=$? local extra="" - local stat_synrx_now_l - local stat_ackrx_now_l - local stat_cookietx_now - local stat_cookierx_now - local stat_ooo_now - local stat_tcpfb_now_l - stat_synrx_now_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableSYNRX") - stat_ackrx_now_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableACKRX") - stat_cookietx_now=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesSent") - stat_cookierx_now=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesRecv") - stat_ooo_now=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtTCPOFOQueue") - stat_tcpfb_now_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableFallbackACK") + local stat_synrx + local stat_ackrx + local stat_cookietx + local stat_cookierx + local stat_ooo + local stat_tcpfb + stat_synrx=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableSYNRX") + stat_ackrx=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableACKRX") + stat_cookietx=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesSent") + stat_cookierx=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesRecv") + stat_ooo=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtTCPOFOQueue") + stat_tcpfb=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableFallbackACK") - expect_synrx=$((stat_synrx_last_l)) - expect_ackrx=$((stat_ackrx_last_l)) + expect_synrx=0 + expect_ackrx=0 cookies=$(ip netns exec ${listener_ns} sysctl net.ipv4.tcp_syncookies) cookies=${cookies##*=} if [ ${cl_proto} = "MPTCP" ] && [ ${srv_proto} = "MPTCP" ]; then - expect_synrx=$((stat_synrx_last_l+connect_per_transfer)) - expect_ackrx=$((stat_ackrx_last_l+connect_per_transfer)) + expect_synrx=${connect_per_transfer} + expect_ackrx=${connect_per_transfer} fi - if [ ${stat_synrx_now_l} -lt ${expect_synrx} ]; then - mptcp_lib_pr_fail "lower MPC SYN rx (${stat_synrx_now_l})" \ + if [ ${stat_synrx} -lt ${expect_synrx} ]; then + mptcp_lib_pr_fail "lower MPC SYN rx (${stat_synrx})" \ "than expected (${expect_synrx})" retc=1 fi - if [ ${stat_ackrx_now_l} -lt ${expect_ackrx} ]; then - if [ ${stat_ooo_now} -eq 0 ]; then - mptcp_lib_pr_fail "lower MPC ACK rx (${stat_ackrx_now_l})" \ + if [ ${stat_ackrx} -lt ${expect_ackrx} ]; then + if [ ${stat_ooo} -eq 0 ]; then + mptcp_lib_pr_fail "lower MPC ACK rx (${stat_ackrx})" \ "than expected (${expect_ackrx})" rets=1 else
@@ -503,47 +488,45 @@ do_transfer() csum_err_s=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtDataCsumErr") csum_err_c=$(mptcp_lib_get_counter "${connector_ns}" "MPTcpExtDataCsumErr") - local csum_err_s_nr=$((csum_err_s - stat_csum_err_s)) - if [ $csum_err_s_nr -gt 0 ]; then - mptcp_lib_pr_fail "server got ${csum_err_s_nr} data checksum error[s]" + if [ $csum_err_s -gt 0 ]; then + mptcp_lib_pr_fail "server got ${csum_err_s} data checksum error[s]" rets=1 fi - local csum_err_c_nr=$((csum_err_c - stat_csum_err_c)) - if [ $csum_err_c_nr -gt 0 ]; then - mptcp_lib_pr_fail "client got ${csum_err_c_nr} data checksum error[s]" + if [ $csum_err_c -gt 0 ]; then + mptcp_lib_pr_fail "client got ${csum_err_c} data checksum error[s]" retc=1 fi fi - if [ ${stat_ooo_now} -eq 0 ] && [ ${stat_tcpfb_last_l} -ne ${stat_tcpfb_now_l} ]; then + if [ ${stat_ooo} -eq 0 ] && [ ${stat_tcpfb} -gt 0 ]; then mptcp_lib_pr_fail "unexpected fallback to TCP" rets=1 fi if [ $cookies -eq 2 ];then - if [ $stat_cookietx_last -ge $stat_cookietx_now ] ;then + if [ $stat_cookietx -eq 0 ] ;then extra+=" WARN: CookieSent: did not advance" fi - if [ $stat_cookierx_last -ge $stat_cookierx_now ] ;then + if [ $stat_cookierx -eq 0 ] ;then extra+=" WARN: CookieRecv: did not advance" fi else - if [ $stat_cookietx_last -ne $stat_cookietx_now ] ;then + if [ $stat_cookietx -gt 0 ] ;then extra+=" WARN: CookieSent: changed" fi - if [ $stat_cookierx_last -ne $stat_cookierx_now ] ;then + if [ $stat_cookierx -gt 0 ] ;then extra+=" WARN: CookieRecv: changed" fi fi - if [ ${stat_synrx_now_l} -gt ${expect_synrx} ]; then + if [ ${stat_synrx} -gt ${expect_synrx} ]; then extra+=" WARN: SYNRX: expect ${expect_synrx}," - extra+=" got ${stat_synrx_now_l} (probably retransmissions)" + extra+=" got ${stat_synrx} (probably retransmissions)" fi - if [ ${stat_ackrx_now_l} -gt ${expect_ackrx} ]; then + if [ ${stat_ackrx} -gt ${expect_ackrx} ]; then extra+=" WARN: ACKRX: expect ${expect_ackrx}," - extra+=" got ${stat_ackrx_now_l} (probably retransmissions)" + extra+=" got ${stat_ackrx} (probably retransmissions)" fi if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then
tools/testing/selftests/net/mptcp/mptcp_lib.sh +12 -4
@@ -111,7 +111,7 @@ mptcp_lib_pr_nstat() { local hist="/tmp/${ns}.out" if [ -f "${hist}" ]; then - awk '{ print " "$0 }' "${hist}" + awk '$2 != 0 { print " "$0 }' "${hist}" else ip netns exec "${ns}" nstat -as | grep Tcp fi
@@ -367,6 +367,7 @@ mptcp_lib_is_v6() { mptcp_lib_nstat_init() { local ns="${1}" + rm -f "/tmp/${ns}."{nstat,out} NSTAT_HISTORY="/tmp/${ns}.nstat" ip netns exec "${ns}" nstat -n }
@@ -374,18 +375,25 @@ mptcp_lib_nstat_get() { local ns="${1}" # filter out non-*TCP stats, and the rate (last column) - NSTAT_HISTORY="/tmp/${ns}.nstat" ip netns exec "${ns}" nstat | + NSTAT_HISTORY="/tmp/${ns}.nstat" ip netns exec "${ns}" nstat -sz | grep -o ".*Tcp\S\+\s\+[0-9]\+" > "/tmp/${ns}.out" } # $1: ns, $2: MIB counter +# Get the counter from the history (mptcp_lib_nstat_{init,get}()) if available. +# If not, get the counter from nstat ignoring any history. mptcp_lib_get_counter() { local ns="${1}" local counter="${2}" + local hist="/tmp/${ns}.out" local count - count=$(ip netns exec "${ns}" nstat -asz "${counter}" | - awk 'NR==1 {next} {print $2}') + if [[ -s "${hist}" && "${counter}" == *"Tcp"* ]]; then + count=$(awk "/^${counter} / {print \$2; exit}" "${hist}") + else + count=$(ip netns exec "${ns}" nstat -asz "${counter}" | + awk 'NR==1 {next} {print $2}') + fi if [ -z "${count}" ]; then mptcp_lib_fail_if_expected_feature "${counter} counter" return 1
Signature · 1 line
2.51.0
Hi Matthieu,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Unstable: 2 failed test(s): packetdrill_fastclose selftest_mptcp_connect_mmap 🔴
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Unstable: 1 failed test(s): packetdrill_regressions 🔴
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/19047087376
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/9e66ab4bc31b
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1019082
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)
Paolo Abeni
maintainerHi Mat,
The series LGTM! actually that ugly old syntax I introduced bothered me since a while, thanks for fixing it!
/P
Matthieu Baerts
maintainerHi Paolo,
Quoted 2 lines · Paolo Abeni
The series LGTM! actually that ugly old syntax I introduced bothered me since a while, thanks for fixing it!
Thank you for the review!
Now in our tree:
New patches for t/upstream:
- 5fc66ff0c21d: selftests: mptcp: lib: introduce 'nstat_{init,get}'
- 85c2658ab280: selftests: mptcp: lib: remove stats files args
- c03f469e66cd: selftests: mptcp: lib: stats: remove nstat rate columns
- 7c215cadfe13: selftests: mptcp: join: dump stats from history
- 1e8ac2ba9238: selftests: mptcp: lib: get counters from nstat history
- Results: 47634a71c01a..fdaf439eed61 (export)
Tests are now in progress:
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.