Message ID | 20211217092955.9472-1-lizhijian@cn.fujitsu.com |
---|---|
State | Accepted |
Commit | 92d25637a3a45904292c93f1863c6bbda4e3e38f |
Headers | show |
Series | [v2] kselftest: signal all child processes | expand |
On 1/12/22 10:48 PM, lizhijian@fujitsu.com wrote: > kindly ping > > > On 17/12/2021 17:29, Li Zhijian wrote: >> 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. >> Thank you for the patch. Applied to linux-kselftest fixes for rc2/3 thanks, -- Shuah
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index ae0f0f33b2a6..c7251396e7ee 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -875,7 +875,8 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext) } t->timed_out = true; - kill(t->pid, SIGKILL); + // signal process group + kill(-(t->pid), SIGKILL); } void __wait_for_test(struct __test_metadata *t) @@ -985,6 +986,7 @@ void __run_test(struct __fixture_metadata *f, ksft_print_msg("ERROR SPAWNING TEST CHILD\n"); t->passed = 0; } else if (t->pid == 0) { + setpgrp(); t->fn(t, variant); if (t->skip) _exit(255);