Linux Test Project
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	ltp@lists.linux.it, Matthew Bobrowski <repnop@google.com>
Subject: Re: [LTP] [PATCH 2/4] syscalls/fanotify09: Verify if no events are expected
Date: Mon, 20 Jun 2022 16:37:54 +0200	[thread overview]
Message-ID: <20220620143754.bplnp6bmasb36sj3@quack3.lan> (raw)
In-Reply-To: <20220620132737.2015073-3-amir73il@gmail.com>

On Mon 20-06-22 16:27:35, Amir Goldstein wrote:
> Some test cases expect no events for non-first groups and some expect
> one event on non-dir child for non-first groups, but it is not verified
> that non-first groups get the desired amount of events, so add this
> information to the test case definition.
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

									Honza

> ---
>  .../kernel/syscalls/fanotify/fanotify09.c     | 25 +++++++++----------
>  1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify09.c b/testcases/kernel/syscalls/fanotify/fanotify09.c
> index 60ffcb81b..a8d56c10b 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify09.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify09.c
> @@ -76,6 +76,7 @@ static struct tcase {
>  	unsigned int report_name;
>  	const char *close_nowrite;
>  	int nevents;
> +	unsigned int nonfirst_event;
>  } tcases[] = {
>  	{
>  		"Events on non-dir child with both parent and mount marks",
> @@ -83,7 +84,7 @@ static struct tcase {
>  		0,
>  		0,
>  		DIR_NAME,
> -		1,
> +		1, 0,
>  	},
>  	{
>  		"Events on non-dir child and subdir with both parent and mount marks",
> @@ -91,7 +92,7 @@ static struct tcase {
>  		FAN_ONDIR,
>  		0,
>  		DIR_NAME,
> -		2,
> +		2, 0,
>  	},
>  	{
>  		"Events on non-dir child and parent with both parent and mount marks",
> @@ -99,7 +100,7 @@ static struct tcase {
>  		FAN_ONDIR,
>  		0,
>  		".",
> -		2,
> +		2, 0
>  	},
>  	{
>  		"Events on non-dir child and subdir with both parent and subdir marks",
> @@ -107,7 +108,7 @@ static struct tcase {
>  		FAN_ONDIR,
>  		0,
>  		DIR_NAME,
> -		2,
> +		2, 0,
>  	},
>  	{
>  		"Events on non-dir children with both parent and mount marks",
> @@ -115,7 +116,7 @@ static struct tcase {
>  		0,
>  		0,
>  		FILE2_NAME,
> -		2,
> +		2, FAN_CLOSE_NOWRITE,
>  	},
>  	{
>  		"Events on non-dir child with both parent and mount marks and filename info",
> @@ -123,7 +124,7 @@ static struct tcase {
>  		0,
>  		FAN_REPORT_DFID_NAME,
>  		FILE2_NAME,
> -		2,
> +		2, FAN_CLOSE_NOWRITE,
>  	},
>  };
>  
> @@ -315,13 +316,8 @@ static void test_fanotify(unsigned int n)
>  	for (i = 1; i < NUM_GROUPS; i++) {
>  		ret = read(fd_notify[i], event_buf, EVENT_BUF_LEN);
>  		if (ret > 0) {
> -			uint32_t expect = 0;
> -
> -			if (tc->nevents > 1 && !tc->ondir)
> -				expect = FAN_CLOSE_NOWRITE;
> -
>  			event = (struct fanotify_event_metadata *)event_buf;
> -			verify_event(i, event, expect, "");
> +			verify_event(i, event, tc->nonfirst_event, "");
>  			event = FAN_EVENT_NEXT(event, ret);
>  
>  			close_event_fds(event, ret);
> @@ -338,7 +334,10 @@ static void test_fanotify(unsigned int n)
>  				"reading fanotify events failed");
>  		}
>  
> -		tst_res(TPASS, "group %d got no event", i);
> +		if (tc->nonfirst_event)
> +			tst_res(TFAIL, "group %d expected and got no event", i);
> +		else
> +			tst_res(TPASS, "group %d got no event as expected", i);
>  	}
>  	cleanup_fanotify_groups();
>  }
> -- 
> 2.25.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-06-20 14:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 13:27 [LTP] [PATCH 0/4] More fanotify tests for v5.19 Amir Goldstein
2022-06-20 13:27 ` [LTP] [PATCH 1/4] syscalls/fanotify09: Cleanup open event fds on error Amir Goldstein
2022-06-20 14:35   ` Jan Kara
2022-06-20 13:27 ` [LTP] [PATCH 2/4] syscalls/fanotify09: Verify if no events are expected Amir Goldstein
2022-06-20 14:37   ` Jan Kara [this message]
2022-06-20 13:27 ` [LTP] [PATCH 3/4] syscalls/fanotify09: Tidy up the test to make it more readable Amir Goldstein
2022-06-20 14:47   ` Jan Kara
2022-06-20 13:27 ` [LTP] [PATCH 4/4] syscalls/fanotify09: Add test cases for merge of ignore mask Amir Goldstein
2022-06-20 15:20   ` Jan Kara
2022-06-20 16:59     ` Amir Goldstein
2022-06-20 20:35       ` Jan Kara
2022-06-21  3:02         ` Amir Goldstein
2022-06-21  8:31           ` Jan Kara
2022-06-21  8:34   ` Jan Kara
2022-07-25 11:23     ` 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=20220620143754.bplnp6bmasb36sj3@quack3.lan \
    --to=jack@suse.cz \
    --cc=amir73il@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=repnop@google.com \
    /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