Skip to content

Commit 92d2563

Browse files
zhijianli88shuahkh
authored andcommitted
kselftest: signal all child processes
We have some many cases that will create child process as well, such as pidfd_wait. Previously, we will signal/kill the parent process when it is time out, but this signal will not be sent to its child process. In such case, if child process doesn't terminate itself, ksefltest framework will hang forever. Here we group all its child processes so that kill() can signal all of them in timeout. Fixed change log: Shuah Khan <[email protected]> Suggested-by: yang xu <[email protected]> Signed-off-by: Li Zhijian <[email protected]> Acked-by: Christian Brauner <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 40d70d4 commit 92d2563

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/testing/selftests/kselftest_harness.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,8 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext)
877877
}
878878

879879
t->timed_out = true;
880-
kill(t->pid, SIGKILL);
880+
// signal process group
881+
kill(-(t->pid), SIGKILL);
881882
}
882883

883884
void __wait_for_test(struct __test_metadata *t)
@@ -987,6 +988,7 @@ void __run_test(struct __fixture_metadata *f,
987988
ksft_print_msg("ERROR SPAWNING TEST CHILD\n");
988989
t->passed = 0;
989990
} else if (t->pid == 0) {
991+
setpgrp();
990992
t->fn(t, variant);
991993
if (t->skip)
992994
_exit(255);

0 commit comments

Comments
 (0)