Skip to content

Commit

Permalink
selftests: mptcp: sockopt: save nstat infos
Browse files Browse the repository at this point in the history
Similar to the way nstat information is stored in mptcp_connect.sh
and mptcp_join.sh scripts, this patch adds a similar way for
mptcp_sockopt.sh and displays the nstat information when errors
occur.

Please apply this patch before the commit

"selftests: mptcp: simult_flows: unify errors msgs"

when merging it.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Jan 10, 2025
1 parent dabd9bd commit 2399c14
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ 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

timeout ${timeout_test} \
ip netns exec ${listener_ns} \
$mptcp_connect -t ${timeout_poll} -l -M 1 -p $port -s ${srv_proto} -c "${cmsg}" \
Expand All @@ -189,14 +194,20 @@ 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

print_title "Transfer ${ip:2}"
if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
mptcp_lib_pr_fail "client exit code $retc, server $rets"
echo -e "\nnetns ${listener_ns} socket stat for ${port}:" 1>&2
ip netns exec ${listener_ns} ss -Menita 1>&2 -o "sport = :$port"

cat /tmp/${listener_ns}.out
echo -e "\nnetns ${connector_ns} socket stat for ${port}:" 1>&2
ip netns exec ${connector_ns} ss -Menita 1>&2 -o "dport = :$port"
cat /tmp/${connector_ns}.out

mptcp_lib_result_fail "transfer ${ip}"

Expand Down

0 comments on commit 2399c14

Please sign in to comment.