Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: mptcp: wait for port instead of sleep

After having started mptcp_connect in listening mode,
'mptcp_lib_wait_local_port_listen' can be used to wait for the listening
socket to be ready.

This is better than using the 'sleep' command, not to pause for a fixed
amount of time, but waiting for an event. This helper is used in all
other MPTCP selftests, but not in these two.

Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20251114-net-next-mptcp-sft-count-cache-stats-timeout-v1-7-863cb04e1b7b@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Matthieu Baerts (NGI0) and committed by
Jakub Kicinski
39348f5f 8c1fe0a5

+3 -2
+1 -1
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
··· 178 178 ${local_addr} < "$sin" > "$sout" & 179 179 local spid=$! 180 180 181 - sleep 1 181 + mptcp_lib_wait_local_port_listen "${listener_ns}" "${port}" 182 182 183 183 timeout ${timeout_test} \ 184 184 ip netns exec ${connector_ns} \
+2 -1
tools/testing/selftests/net/mptcp/userspace_pm.sh
··· 211 211 ip netns exec "$ns1" \ 212 212 ./mptcp_connect -s MPTCP -w 300 -p $app_port -l $listen_addr > /dev/null 2>&1 & 213 213 local server_pid=$! 214 - sleep 0.5 214 + 215 + mptcp_lib_wait_local_port_listen "${ns1}" "${port}" 215 216 216 217 # Run the client, transfer $file and stay connected to the server 217 218 # to conduct tests