lib/tst_test.c: Kill all children on timeout
* Run actuall test in a separate process group
* Deliver SIGKILL to all children on timeout
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
diff --git a/lib/tst_test.c b/lib/tst_test.c
index eef54e4..9122f57 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -660,7 +660,7 @@
static void alarm_handler(int sig LTP_ATTRIBUTE_UNUSED)
{
- kill(test_pid, SIGKILL);
+ kill(-test_pid, SIGKILL);
}
static void heartbeat_handler(int sig LTP_ATTRIBUTE_UNUSED)
@@ -702,8 +702,10 @@
if (test_pid < 0)
tst_brk(TBROK | TERRNO, "fork()");
- if (!test_pid)
+ if (!test_pid) {
+ SAFE_SETPGID(0, 0);
testrun();
+ }
SAFE_WAITPID(test_pid, &status, 0);