lib/tst_test.c: Kill all children on timeout
PATCH 3/3 lib/tst_test.c: Kill all children on timeout
* Run actuall test in a separate process group
* Deliver SIGKILL to all children on timeout
--- lib/newlib_tests/.gitignore | 1 + lib/newlib_tests/test13.c | 37 +++++++++++++++++++++++++++++++++++++ lib/tst_test.c | 6 ++++-- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 lib/newlib_tests/test13.c
lib/newlib_tests/.gitignore +1 -0
@@ -10,3 +10,4 @@ test09 test10 test11 test12 +test13
lib/newlib_tests/test13.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (c) 2016 Linux Test Project +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +/* +* Test for timeout & children. +*/ + +#include "tst_test.h" + +static void do_test (void ) +{ +SAFE_FORK (); +SAFE_FORK (); +SAFE_FORK (); + +tst_res (TINFO ,"Pausing process pid %i" ,getpid ()); +pause (); +} + +static struct tst_test test = { + .tid ="test13" , + .timeout =1 , + .forks_child =1 , + .test_all = do_test, +};
lib/tst_test.c +4 -2
@@ -660,7 +660,7 @@ static unsigned int timeout = 300; 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 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)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 );
Signature · 6 lines
2.7.3 -- Cyril Hrubis [email protected]
PATCH 3/3 lib/tst_test.c: Kill all children on timeout
----- Original Message -----
Quoted 10 lines
From: "Cyril Hrubis" <[email protected]>
To: [email protected]
Sent: Tuesday, 7 June, 2016 2:45:07 PM
Subject: [LTP] [PATCH 3/3]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 <[email protected]>
ACK.
Is there a 2/3? I can't seem to find the series this patch belongs to. I assume 1/3 was "lib/tst_test.c: Run test in child process".
Regards,
Jan
PATCH 3/3 lib/tst_test.c: Kill all children on timeout
Hi!
Quoted 4 lines
ACK.
Is there a 2/3? I can't seem to find the series this patch belongs to. I assume 1/3 was "
lib/tst_test.c: Run test in child process".
I should have deleted the 3/3 in order to make it less confusing.
The 2/3 would have been the SAFE_SETPGID() patch that I deemed to be obvious enough to be commited directly.
Signature · 2 lines
Cyril Hrubis [email protected]