Skip to content

Commit d41a9ef

Browse files
matttbeintel-lab-lkp
authored andcommitted
Squash to "selftests: mptcp: get stats just before timing out"
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/[email protected] Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 6861f29 commit d41a9ef

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

tools/testing/selftests/net/mptcp/mptcp_connect.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,12 @@ do_transfer()
415415
local retc=$?
416416
wait $spid
417417
local rets=$?
418-
kill $timeout_pid 2>/dev/null && timeout_pid=0
418+
419+
if kill -0 $timeout_pid; then
420+
# Finished before the timeout: kill the background job
421+
mptcp_lib_kill_group_wait $timeout_pid
422+
timeout_pid=0
423+
fi
419424

420425
local stop
421426
stop=$(date +%s%3N)

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,12 @@ do_transfer()
10631063
local retc=$?
10641064
wait $spid
10651065
local rets=$?
1066-
kill $timeout_pid 2>/dev/null && timeout_pid=0
1066+
1067+
if kill -0 $timeout_pid; then
1068+
# Finished before the timeout: kill the background job
1069+
mptcp_lib_kill_group_wait $timeout_pid
1070+
timeout_pid=0
1071+
fi
10671072

10681073
cond_stop_capture
10691074

tools/testing/selftests/net/mptcp/mptcp_sockopt.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ do_transfer()
193193
local retc=$?
194194
wait $spid
195195
local rets=$?
196-
kill $timeout_pid 2>/dev/null && timeout_pid=0
196+
197+
if kill -0 $timeout_pid; then
198+
# Finished before the timeout: kill the background job
199+
mptcp_lib_kill_group_wait $timeout_pid
200+
timeout_pid=0
201+
fi
197202

198203
mptcp_lib_nstat_get "${listener_ns}"
199204
mptcp_lib_nstat_get "${connector_ns}"

tools/testing/selftests/net/mptcp/simult_flows.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ do_transfer()
178178
local retc=$?
179179
wait $spid
180180
local rets=$?
181-
kill $timeout_pid 2>/dev/null && timeout_pid=0
181+
182+
if kill -0 $timeout_pid; then
183+
# Finished before the timeout: kill the background job
184+
mptcp_lib_kill_group_wait $timeout_pid
185+
timeout_pid=0
186+
fi
182187

183188
if $capture; then
184189
sleep 1

0 commit comments

Comments
 (0)