Linux Test Project
 help / color / mirror / Atom feed
From: Avinesh Kumar <akumar@suse.de>
To: ltp@lists.linux.it
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] open08.c: Use TST_EXP_FAIL2() and SAFE_CLOSE()
Date: Mon, 11 Jul 2022 14:29:40 +0530	[thread overview]
Message-ID: <3415287.WrLqWuVBv1@localhost> (raw)
In-Reply-To: <YsvF+aZqnjNB0G0j@pevik>

Hi Petr, 

On Monday, July 11, 2022 12:10:57 PM IST Petr Vorel wrote:
> Hi Avinesh,
> 
> > Make use of TST_EXP_FAIL2() macro with testcase descriptions
> +1
> 
> Also +1 for static :).
> 
> ...
> > +++ b/testcases/kernel/syscalls/open/open08.c
> > @@ -33,34 +33,20 @@ static struct test_case_t {
> >  	char **fname;
> >  	int flags;
> >  	int error;
> > +	const char *desc;
> >  } tcases[] = {
> > -	{&existing_fname, O_CREAT | O_EXCL, EEXIST},
> > -	{&dir_fname, O_RDWR, EISDIR},
> > -	{&existing_fname, O_DIRECTORY, ENOTDIR},
> > -	{&toolong_fname, O_RDWR, ENAMETOOLONG},
> > -	{&user2_fname, O_WRONLY, EACCES},
> > -	{&unmapped_fname, O_CREAT, EFAULT}
> > +	{&existing_fname, O_CREAT | O_EXCL, EEXIST, "open() existing file with 'O_CREAT | O_EXCL'"},
> > +	{&dir_fname, O_RDWR, EISDIR, "open() existing directory with write access"},
> > +	{&existing_fname, O_DIRECTORY, ENOTDIR, "open() non-directory pathname with O_DIRECTORY"},
> > +	{&toolong_fname, O_RDWR, ENAMETOOLONG, "open() too long pathname"},
> > +	{&user2_fname, O_WRONLY, EACCES, "open() file without requested access rights"},
> > +	{&unmapped_fname, O_CREAT, EFAULT, "open() pathname with bad address"}
> >  };
> 
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
> Instead of text descriptions I'd just print flags:
> 
> #define FLAGS_DESC(x) .flags = x, .desc = #x
> 
> static struct test_case_t {
> 	char **fname;
> 	int flags;
> 	const char *desc;
> 	int error;
> } tcases[] = {
> 	{&existing_fname, FLAGS_DESC(O_CREAT | O_EXCL), EEXIST},
> 	{&dir_fname, FLAGS_DESC(O_RDWR), EISDIR},
> 	{&existing_fname, FLAGS_DESC(O_DIRECTORY), ENOTDIR},
> 	{&toolong_fname, FLAGS_DESC(O_RDWR), ENAMETOOLONG},
> 	{&user2_fname, FLAGS_DESC(O_WRONLY), EACCES},
> 	{&unmapped_fname, FLAGS_DESC(O_CREAT), EFAULT},
> };
> 
> # ./open08 
> tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
> open08.c:52: TPASS: O_CREAT | O_EXCL : EEXIST (17)
> open08.c:52: TPASS: O_RDWR : EISDIR (21)
> open08.c:52: TPASS: O_DIRECTORY : ENOTDIR (20)
> open08.c:52: TPASS: O_RDWR : ENAMETOOLONG (36)
> open08.c:52: TPASS: O_WRONLY : EACCES (13)
> open08.c:52: TPASS: O_CREAT : EFAULT (14)
> 
> If you agree, I can merge it with this change.
Yes, this is nice, please go ahead.

> 
> Kind regards,
> Petr
> 

Thanks,
Avinesh



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

  reply	other threads:[~2022-07-11  8:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10 10:44 [LTP] [PATCH v2] open08.c: Use TST_EXP_FAIL2() and SAFE_CLOSE() Avinesh Kumar
2022-07-11  6:40 ` Petr Vorel
2022-07-11  8:59   ` Avinesh Kumar [this message]
2022-07-11 14:59     ` 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=3415287.WrLqWuVBv1@localhost \
    --to=akumar@suse.de \
    --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