lib/tst_test.c: Bugfix for heartbeat
PATCH 1/1 lib/tst_test.c: Bugfix for heartbeat
When main process has been killed, its son process will be reaped by init, and son process will send SIGUSR1 to the init process.
In busybox, send SIGUSR1 to the init process will trigger shutdown.
--- lib/tst_test.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
lib/tst_test.c +9 -1
@@ -1156,7 +1156,15 @@ static void heartbeat(void)if (tst_clock_gettime (CLOCK_MONOTONIC , &tst_start_time))tst_res (TWARN |TERRNO ,"tst_clock_gettime() failed" ); -kill (getppid (),SIGUSR1 ); +if (getppid () ==1 ) { +tst_res (TFAIL ,"Main test process might have exit!" ); +/* +* We need kill the task group immediately since the +* main process has exit. +*/ +kill (0 ,SIGKILL ); + }else +kill (getppid (),SIGUSR1 ); }static void testrun (void )
--
2.17.1
PATCH 1/1 lib/tst_test.c: Bugfix for heartbeat
Hi!
Quoted 15 lines
When main process has been killed, its son process will be reaped by init, and son process will send SIGUSR1 to the init process.
In busybox, send SIGUSR1 to the init process will trigger shutdown.
Signed-off-by Zhao Gongyi <[email protected]>--- lib/tst_test.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)lib/tst_test.c +0
-0
lib/tst_test.c static void heartbeat(void) · line 1160
Quoted 6 lines
lib/tst_test.c +2
-1@@ -1156,7 +1156,15 @@ static void heartbeat(void)if (tst_clock_gettime (CLOCK_MONOTONIC , &tst_start_time))tst_res (TWARN |TERRNO ,"tst_clock_gettime() failed" ); -kill (getppid (),SIGUSR1 ); +if (getppid () ==1 ) { +tst_res (TFAIL ,"Main test process might have exit!" );
^
This should be TBROK I guess.
lib/tst_test.c static void heartbeat(void) · line 1165
Quoted 5 lines
lib/tst_test.c +5
-0+/* +* We need kill the task group immediately since the +* main process has exit. +*/ +kill (0 ,SIGKILL );
Shouldn't we call exit here? There is no point in continuing once we reached this point.
Quoted 11 lines
lib/tst_test.c +2
-1+ }else +kill (getppid (),SIGUSR1 ); }static void testrun (void ) --2.17.1
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 lib/tst_test.c: Bugfix for heartbeat
In reply to Zhao GongyiHi,
LGTM.
Quoted 1 line
When main process has been killed, its son process will be reaped by
=> nit: son/child
Quoted 1 line
init, and son process will send SIGUSR1 to the init process.
Kind regards,
Petr
PATCH 1/1 lib/tst_test.c: Bugfix for heartbeat
Hi!
There is a v2 already, can you have a look?
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 lib/tst_test.c: Bugfix for heartbeat
Quoted 2 lines
Hi!
There is a v2 already, can you have a look?
I'm sorry to reply to the old one. I looked at both versions, but meant to sent review to v2.
Kind regards,
Petr