ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Avinesh Kumar <akumar@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] unlink07: use TST_EXP_FAIL() and turn comment into docparse, reword
Date: Thu, 1 Sep 2022 08:50:46 +0200	[thread overview]
Message-ID: <YxBWRndhRQRF69Cl@pevik> (raw)
In-Reply-To: <20220715061548.11574-1-akumar@suse.de>

Hi Avinesh,

> +++ b/testcases/kernel/syscalls/unlink/unlink07.c
> @@ -3,15 +3,17 @@
>   * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
Maybe adding copyright?
>   */

> +/*\
> + * [Description]
> + *
> + * Verify that unlink() fails with
> + * - ENOENT when file does not exist.
> + * - ENOENT when pathname is empty.
> + * - ENOENT when a component in pathname does not exist.
> + * - EFAULT when pathname points outside the accessible address space.
> + * - ENOTDIR when a component used as a directory in pathname is not,
> + * in fact, a directory.
> + * - ENAMETOOLONG when pathname is too long.
I'd remove dot in the end.
I don't like 'when', but I don't know anything better.
>   */

>  #include <errno.h>
> @@ -39,21 +41,9 @@ static void verify_unlink(unsigned int n)
>  {
>  	struct test_case_t *tc = &tcases[n];

> -	TEST(unlink(tc->name));
> -	if (TST_RET != -1) {
> -		tst_res(TFAIL, "unlink(<%s>) succeeded unexpectedly",
> -			tc->desc);
> -		return;
> -	}
> -
> -	if (TST_ERR == tc->exp_errno) {
> -		tst_res(TPASS | TTERRNO, "unlink(<%s>) failed as expected",
> -			tc->desc);
> -	} else {
> -		tst_res(TFAIL | TTERRNO,
> -			"unlink(<%s>) failed, expected errno: %s",
> -			tc->desc, tst_strerrno(tc->exp_errno));
> -	}
> +	TST_EXP_FAIL(unlink(tc->name),
> +				tc->exp_errno,
> +				"%s", tc->desc);
This should be on single line.
>  }

>  static void setup(void)

Other proposed changes:

* PATH_MAX is in limits.h + we usually don't put comments why it's included:
-#include <sys/param.h>	/* for PATH_MAX */
+#include <limits.h>

* use size_t in setup
 static void setup(void)
 {
-	unsigned int n;
+	size_t n;

BTW it'd build just with #include "tst_test.h", because all 4 headers are
included by headers which tst_test.h includes.

I guess most of that it applies to your patch unlink08.c as well, could you
please send v2?

Kind regards,
Petr

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

  reply	other threads:[~2022-09-01  6:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15  6:15 [LTP] [PATCH] unlink07: use TST_EXP_FAIL() and turn comment into docparse, reword Avinesh Kumar
2022-09-01  6:50 ` Petr Vorel [this message]
2022-09-02  6:26   ` Avinesh Kumar

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=YxBWRndhRQRF69Cl@pevik \
    --to=pvorel@suse.cz \
    --cc=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;
as well as URLs for NNTP newsgroup(s).