lib/tst_test.c: Bugfix for heartbeat
PATCH 1/1 lib/tst_test.c: Bugfix for heartbeat
Hi Cyril,
Thanks for your review!
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ } else + kill(getppid(), SIGUSR1);No need for the else branch here now that we do
exit()a the end of the if () block.
Generally speaking, It seems that we also need the else branch since we need to send heart beat to the main process.
Best Regards,
Gongyi
Quoted 36 lines
Hi!
lib/tst_test.c static void heartbeat(void) · line 1157
Quoted 9 lines
According to your review, is there any problems in the patch as follows:
lib/tst_test.c index renamed from lib/tst_test.c +0
-0
45753d1ca..0a096d666100644lib/tst_test.c +0
-0@@ -1156,7 +1156,16 @@ static void heartbeat(void)if (tst_clock_gettime (CLOCK_MONOTONIC , &tst_start_time)) tst_res(TWARN | TERRNO, "tst_clock_gettime()failed");
lib/tst_test.c static void heartbeat(void) · line 1165
Quoted 10 lines
lib/tst_test.c +8
-1-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 ); +exit (-1 );Not that it matters that much, but I would do exit(TBROK);
lib/tst_test.c static void heartbeat(void) · line 1167
Quoted 2 lines
lib/tst_test.c +2
-0+ }else +kill (getppid (),SIGUSR1 );No need for the else branch here now that we do
exit()a the end of the if () block.Other than that it looks good.
--
Cyril Hrubis
[email protected]
PATCH 1/1 lib/tst_test.c: Bugfix for heartbeat
Hi!
Quoted 10 lines
Thanks for your review!
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ } else + kill(getppid(), SIGUSR1);No need for the else branch here now that we do
exit()a the end of the if () block.Generally speaking, It seems that we also need the else branch since we need to send heart beat to the main process.
What I meant was that the code could be structured as:
if (getppid() == 1) {
...
exit(TBROK);
}
kill(getppid(), SIGUSR1);Hence there is no need for the else branch.
Signature · 2 lines
Cyril Hrubis [email protected]