public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/4] fanotify14: Print human-readable test case flags
Date: Fri, 14 Oct 2022 18:17:09 +0200	[thread overview]
Message-ID: <Y0mLhaBlmhcsFjIV@pevik> (raw)
In-Reply-To: <275830ad-6830-c9b1-3573-3c97b1d1f21a@suse.cz>

> On 13. 10. 22 23:36, Petr Vorel wrote:
> > Hi Martin,

> > > It's hard to tell which test case is failing from the current fanotify14
> > > output. Print test case flags to make failure analysis easier.

> > > Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> > > ---
> > >   .../kernel/syscalls/fanotify/fanotify14.c     | 194 ++++++++++--------
> > >   1 file changed, 108 insertions(+), 86 deletions(-)

> > > diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
> > > index 594259ccf..ee42aaf68 100644
> > > --- a/testcases/kernel/syscalls/fanotify/fanotify14.c
> > > +++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
> > > @@ -38,6 +38,8 @@
> > >   #define INODE_EVENTS (FAN_ATTRIB | FAN_CREATE | FAN_DELETE | FAN_MOVE | \
> > >   		      FAN_DELETE_SELF | FAN_MOVE_SELF)

> > > +#define FLAGS_DESC(flags) (flags), (#flags)
> > +1 for add ing description. But macro like this gets false positive in make
> > check:

> > fanotify14.c:41: ERROR: Macros with complex values should be enclosed in parentheses

> > Also quite recently, in dbb9db6ec ("syscalls/fanotify09: Make test case
> > definitions more readable") was single test migrated to use
> > .foo = value, .bar = value struct setup. This is about source code readability,
> > you aim for test output readability, IMHO both is important.

> I can't use that approach here because I'm using the macro to initialize 3
> different pairs of attributes in the same structure. What I could do is
> change the flags/desc pairs into a nested struct of
> {unsigned long, const char *} and the macro would change to
> #define FLAGS_DESC(flags) {(flags), (#flags)}

+1, but it's not important. Amir's comments are what is important.

> > > @@ -155,8 +169,14 @@ static void do_test(unsigned int number)
> > >   		return;
> > >   	}

> > > -	TST_EXP_FD_OR_FAIL(fanotify_fd = fanotify_init(tc->init_flags, O_RDONLY),
> > > -			   !tc->mask && tc->expected_errno ? tc->expected_errno : 0);
> > TST_EXP_FD_OR_FAIL was added only to be used by fanotify tests.
> > What's wrong with it?

> I got a headache trying to figure out when this call was expected to pass
> and when it was expected to fail. The more verbose version below is far
> easier to understand.

Sure, thanks for an explanation.

Kind regards,
Petr

> > > +	if (!tc->mask && tc->expected_errno) {
> > > +		TST_EXP_FAIL(fanotify_init(tc->init_flags, O_RDONLY),
> > > +			tc->expected_errno);
> > > +	} else {
> > > +		TST_EXP_FD(fanotify_init(tc->init_flags, O_RDONLY));
> > > +	}
> > > +
> > > +	fanotify_fd = TST_RET;

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

  reply	other threads:[~2022-10-14 16:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 15:49 [LTP] [PATCH 0/4] Fix fanotify14 Martin Doucha
2022-10-13 15:49 ` [LTP] [PATCH 1/4] fanotify14: Print human-readable test case flags Martin Doucha
2022-10-13 21:36   ` Petr Vorel
2022-10-14 15:49     ` Martin Doucha
2022-10-14 16:17       ` Petr Vorel [this message]
2022-10-13 15:49 ` [LTP] [PATCH 2/4] Move fanotify fallback constants and structs to LAPI header Martin Doucha
2022-10-13 22:08   ` Petr Vorel
2022-10-14 15:56     ` Martin Doucha
2022-10-14 16:20       ` Petr Vorel
2022-10-13 15:49 ` [LTP] [PATCH 3/4] Add fanotify_get_supported_init_flags() helper function Martin Doucha
2022-10-14  6:15   ` Petr Vorel
2022-10-14  6:50   ` Amir Goldstein
2022-10-13 15:49 ` [LTP] [PATCH 4/4] fanotify14: Improve check for unsupported init flags Martin Doucha
2022-10-14  6:20   ` 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=Y0mLhaBlmhcsFjIV@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /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