From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] lib/tst_test.c: Bugfix for heartbeat
Date: Tue, 13 Apr 2021 11:37:06 +0200 [thread overview]
Message-ID: <YHVmQvK6TnFod/tu@yuki> (raw)
In-Reply-To: <F3D3F6AC3820BB4C9FCA340DB5C32CB4038B47B3@dggeml531-mbx.china.huawei.com>
Hi!
> According to your review, is there any problems in the patch as follows:
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 45753d1ca..0a096d666 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -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");
>
> - 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);
> + } 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
chrubis@suse.cz
next prev parent reply other threads:[~2021-04-13 9:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-13 8:19 [LTP] [PATCH] lib/tst_test.c: Bugfix for heartbeat zhaogongyi
2021-04-13 9:37 ` Cyril Hrubis [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-04-15 12:11 zhaogongyi
2021-04-15 13:58 ` Petr Vorel
2021-04-13 11:54 zhaogongyi
2021-04-13 11:54 Zhao Gongyi
2021-04-15 11:32 ` Cyril Hrubis
2021-04-15 14:05 ` Cyril Hrubis
2021-04-13 10:52 zhaogongyi
2021-04-13 11:32 ` Cyril Hrubis
2021-04-13 6:42 zhaogongyi
2021-04-13 7:42 ` Cyril Hrubis
2021-03-23 13:56 Zhao Gongyi
2021-04-12 15:10 ` Cyril Hrubis
2021-04-15 7:52 ` Petr Vorel
2021-04-15 11:31 ` Cyril Hrubis
2021-04-15 14:03 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YHVmQvK6TnFod/tu@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox