MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH mptcp-next] Squash to "selftests: mptcp: get stats just before timing out"
@ 2025-11-13 11:11 Matthieu Baerts (NGI0)
  2025-11-13 12:33 ` MPTCP CI
  2025-11-14  1:30 ` Geliang Tang
  0 siblings, 2 replies; 4+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-11-13 11:11 UTC (permalink / raw)
  To: MPTCP Upstream; +Cc: Matthieu Baerts (NGI0)

Geliang reported that mptcp_connect.sh test runtime got increased after
this patch.

That's because the previous 'kill' command was only killing the
background job, but the 'sleep' command was still running.

It is not very clear to me why there was a delay at the end, but
switching to mptcp_lib_kill_group_wait to kill the background job and
the running command fixed the issue. The new code is also looking
clearer I think, so that's good.

Link: https://lore.kernel.org/2a6869ca39bda7ddf8b486cd03e0867b30e0d565.camel@kernel.org
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 7 ++++++-
 tools/testing/selftests/net/mptcp/mptcp_join.sh    | 7 ++++++-
 tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 7 ++++++-
 tools/testing/selftests/net/mptcp/simult_flows.sh  | 7 ++++++-
 4 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 458b07673910..a6447f7a31fe 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -415,7 +415,12 @@ do_transfer()
 	local retc=$?
 	wait $spid
 	local rets=$?
-	kill $timeout_pid 2>/dev/null && timeout_pid=0
+
+	if kill -0 $timeout_pid; then
+		# Finished before the timeout: kill the background job
+		mptcp_lib_kill_group_wait $timeout_pid
+		timeout_pid=0
+	fi
 
 	local stop
 	stop=$(date +%s%3N)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 222babd43682..7a72efcf1403 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1063,7 +1063,12 @@ do_transfer()
 	local retc=$?
 	wait $spid
 	local rets=$?
-	kill $timeout_pid 2>/dev/null && timeout_pid=0
+
+	if kill -0 $timeout_pid; then
+		# Finished before the timeout: kill the background job
+		mptcp_lib_kill_group_wait $timeout_pid
+		timeout_pid=0
+	fi
 
 	cond_stop_capture
 
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
index 326466f2f6eb..ab8bce06b262 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
@@ -193,7 +193,12 @@ do_transfer()
 	local retc=$?
 	wait $spid
 	local rets=$?
-	kill $timeout_pid 2>/dev/null && timeout_pid=0
+
+	if kill -0 $timeout_pid; then
+		# Finished before the timeout: kill the background job
+		mptcp_lib_kill_group_wait $timeout_pid
+		timeout_pid=0
+	fi
 
 	mptcp_lib_nstat_get "${listener_ns}"
 	mptcp_lib_nstat_get "${connector_ns}"
diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh
index cc4d40d149e2..806aaa7d2d61 100755
--- a/tools/testing/selftests/net/mptcp/simult_flows.sh
+++ b/tools/testing/selftests/net/mptcp/simult_flows.sh
@@ -178,7 +178,12 @@ do_transfer()
 	local retc=$?
 	wait $spid
 	local rets=$?
-	kill $timeout_pid 2>/dev/null && timeout_pid=0
+
+	if kill -0 $timeout_pid; then
+		# Finished before the timeout: kill the background job
+		mptcp_lib_kill_group_wait $timeout_pid
+		timeout_pid=0
+	fi
 
 	if $capture; then
 		sleep 1

---
base-commit: 6861f291b7a3bc40235e996f5605c477f55ce9e0
change-id: 20251113-slft-timeout-stats-kill-444931425af7

Best regards,
-- 
Matthieu Baerts (NGI0) <matttbe@kernel.org>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-14  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 11:11 [PATCH mptcp-next] Squash to "selftests: mptcp: get stats just before timing out" Matthieu Baerts (NGI0)
2025-11-13 12:33 ` MPTCP CI
2025-11-14  1:30 ` Geliang Tang
2025-11-14  9:22   ` Matthieu Baerts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox