Skip to content

Commit 9616cb3

Browse files
bjorn-rivosshuahkh
authored andcommitted
kselftest/runner.sh: Propagate SIGTERM to runner child
Timeouts in kselftest are done using the "timeout" command with the "--foreground" option. Without the "foreground" option, it is not possible for a user to cancel the runner using SIGINT, because the signal is not propagated to timeout which is running in a different process group. The "forground" options places the timeout in the same process group as its parent, but only sends the SIGTERM (on timeout) signal to the forked process. Unfortunately, this does not play nice with all kselftests, e.g. "net:fcnal-test.sh", where the child processes will linger because timeout does not send SIGTERM to the group. Some users have noted these hangs [1]. Fix this by nesting the timeout with an additional timeout without the foreground option. Link: https://lore.kernel.org/all/7650b2eb-0aee-a2b0-2e64-c9bc63210f67@alu.unizg.hr/ # [1] Fixes: 651e0d8 ("kselftest/runner: allow to properly deliver signals to tests") Signed-off-by: Björn Töpel <bjorn@rivosinc.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent f4e4ada commit 9616cb3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/testing/selftests/kselftest/runner.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ tap_timeout()
3636
{
3737
# Make sure tests will time out if utility is available.
3838
if [ -x /usr/bin/timeout ] ; then
39-
/usr/bin/timeout --foreground "$kselftest_timeout" $1
39+
/usr/bin/timeout --foreground "$kselftest_timeout" \
40+
/usr/bin/timeout "$kselftest_timeout" $1
4041
else
4142
$1
4243
fi

0 commit comments

Comments
 (0)