Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Matthew Bobrowski <repnop@google.com>, Jan Kara <jack@suse.cz>,
	ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 5/9] syscalls/fanotify10: Add more verifications and debug info
Date: Tue, 6 Sep 2022 19:01:42 +0200	[thread overview]
Message-ID: <Yxd89vLt8IBluyoI@pevik> (raw)
In-Reply-To: <20220905154239.2652169-6-amir73il@gmail.com>

Hi Amir, all,

> Check that non-evictable inode ignore marks exist as expected
> and print mask of unexpected events.

> Fix information printed for events from unexpected pid.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

...
> +++ b/testcases/kernel/syscalls/fanotify/fanotify10.c
...
> @@ -582,14 +591,18 @@ static void test_fanotify(unsigned int n)
>  	for (p = 1; p < num_classes && !tc->expected_mask_with_ignore; p++) {
>  		for (i = 0; i < GROUPS_PER_PRIO; i++) {
>  			ret = read(fd_notify[p][i], event_buf, EVENT_BUF_LEN);
> -			if (ret == 0) {
> +			if (ret >= 0 && ret < (int)FAN_EVENT_METADATA_LEN) {
>  				tst_brk(TBROK,
> -					"zero length read from fanotify fd");
> +					"short read when reading fanotify "
> +					"events (%d < %d)", ret,
> +					(int)EVENT_BUF_LEN);
Just for the record printing like this...

>  			}
> +			event = (struct fanotify_event_metadata *)event_buf;
>  			if (ret > 0) {
>  				tst_res(TFAIL, "group %d (%x) with %s and "
> -					"%s ignore mask got event",
> -					i, fanotify_class[p], mark->name, ignore_mark->name);
> +					"%s ignore mask got unexpected event (mask %llx)",
> +					i, fanotify_class[p], mark->name, ignore_mark->name,
> +					event->mask);
and this will be possible to avoid with macros include/tst_test_macros.h,
which prints them for free. FYI there can be also custom error text instead
of the failing syscall with parameters printed by default. But IMHO there should
be a reason to use it (mostly the default should be good enough, in case of
failure test reviewers will have to look into the test source anyway).

Kind regards,
Petr

>  				if (event->fd != FAN_NOFD)
>  					SAFE_CLOSE(event->fd);
>  			} else if (errno == EAGAIN) {

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

  reply	other threads:[~2022-09-06 17:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05 15:42 [LTP] [PATCH 0/9] Fanotify tests for FAN_MARK_IGNORE Amir Goldstein
2022-09-05 15:42 ` [LTP] [PATCH 1/9] syscalls/fanotify09: Add test cases " Amir Goldstein
2022-09-05 16:04   ` Petr Vorel
2022-09-06  5:08     ` Amir Goldstein
2022-09-06  5:58       ` Petr Vorel
2022-09-05 15:42 ` [LTP] [PATCH 2/9] syscalls/fanotify14: Require FAN_REPORT_FID support for entire test Amir Goldstein
2022-09-06  6:06   ` Petr Vorel
2022-09-05 15:42 ` [LTP] [PATCH 3/9] syscalls/fanotify14: Add test cases for FAN_MARK_IGNORE Amir Goldstein
2022-09-06  9:05   ` Petr Vorel
2022-09-05 15:42 ` [LTP] [PATCH 4/9] syscalls/fanotify10: Avoid undesired event in test Amir Goldstein
2022-09-06 16:51   ` Petr Vorel
2022-09-06 17:09   ` Petr Vorel
2022-09-05 15:42 ` [LTP] [PATCH 5/9] syscalls/fanotify10: Add more verifications and debug info Amir Goldstein
2022-09-06 17:01   ` Petr Vorel [this message]
2022-09-05 15:42 ` [LTP] [PATCH 6/9] syscalls/fanotify10: Use dedicated mark type for inode mark on parent Amir Goldstein
2022-09-06 17:03   ` Petr Vorel
2022-09-05 15:42 ` [LTP] [PATCH 7/9] syscalls/fanotify10: Run tests with two ignore mask variants Amir Goldstein
2022-09-06 17:07   ` Petr Vorel
2022-09-05 15:42 ` [LTP] [PATCH 8/9] syscalls/fanotify10: Test FAN_MARK_IGNORE with FAN_EVENT_ON_CHILD Amir Goldstein
2022-09-05 15:42 ` [LTP] [PATCH 9/9] syscalls/fanotify10: Test FAN_MARK_IGNORE with FAN_ONDIR Amir Goldstein
2022-09-06 15:38 ` [LTP] [PATCH 0/9] Fanotify tests for FAN_MARK_IGNORE Jan Kara
2022-09-06 17:28   ` Amir Goldstein
2022-09-07 10:45     ` 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=Yxd89vLt8IBluyoI@pevik \
    --to=pvorel@suse.cz \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --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