From: Jan Kara <jack@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] syscalls/inotify06: Terminate child process on test error
Date: Wed, 5 May 2021 18:48:57 +0200 [thread overview]
Message-ID: <20210505164857.GD9615@quack2.suse.cz> (raw)
In-Reply-To: <20210505153847.6106-1-mdoucha@suse.cz>
On Wed 05-05-21 17:38:46, Martin Doucha wrote:
> If the main test process exits early, the child would keep running and
> interfere with tmpdir cleanup.
>
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
> testcases/kernel/syscalls/inotify/inotify06.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
Thanks for the patch. It looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
>
> diff --git a/testcases/kernel/syscalls/inotify/inotify06.c b/testcases/kernel/syscalls/inotify/inotify06.c
> index 96189b082..f39ab46a1 100644
> --- a/testcases/kernel/syscalls/inotify/inotify06.c
> +++ b/testcases/kernel/syscalls/inotify/inotify06.c
> @@ -38,7 +38,8 @@
> /* Number of files to test (must be > 1) */
> #define FILES 5
>
> -char names[FILES][PATH_MAX];
> +static char names[FILES][PATH_MAX];
> +static pid_t pid;
>
> static void setup(void)
> {
> @@ -51,7 +52,6 @@ static void setup(void)
> static void verify_inotify(void)
> {
> int inotify_fd, fd;
> - pid_t pid;
> int i, tests;
>
> pid = SAFE_FORK();
> @@ -85,14 +85,24 @@ static void verify_inotify(void)
>
> /* Kill the child creating / deleting files and wait for it */
> SAFE_KILL(pid, SIGKILL);
> + pid = 0;
> SAFE_WAIT(NULL);
> }
>
> +static void cleanup(void)
> +{
> + if (pid) {
> + SAFE_KILL(pid, SIGKILL);
> + SAFE_WAIT(NULL);
> + }
> +}
> +
> static struct tst_test test = {
> .timeout = 600,
> .needs_tmpdir = 1,
> .forks_child = 1,
> .setup = setup,
> + .cleanup = cleanup,
> .test_all = verify_inotify,
> };
>
> --
> 2.31.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2021-05-05 16:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 15:38 [LTP] [PATCH 1/2] syscalls/inotify06: Terminate child process on test error Martin Doucha
2021-05-05 15:38 ` [LTP] [PATCH 2/2] syscalls/inotify06: Raise inotify instance limit in /proc Martin Doucha
2021-05-05 16:47 ` Jan Kara
2021-05-06 15:27 ` Martin Doucha
2021-05-07 15:02 ` Petr Vorel
2021-05-05 16:48 ` Jan Kara [this message]
2021-05-06 6:56 ` [LTP] [PATCH 1/2] syscalls/inotify06: Terminate child process on test error 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=20210505164857.GD9615@quack2.suse.cz \
--to=jack@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