public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/3] umount02: Simplify test using TST_ macros
Date: Thu, 26 Oct 2023 02:12:17 +0200	[thread overview]
Message-ID: <20231026001217.GD540370@pevik> (raw)
In-Reply-To: <1697100058-2859-2-git-send-email-xuyang2018.jy@fujitsu.com>

> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  testcases/kernel/syscalls/umount/umount02.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)

> diff --git a/testcases/kernel/syscalls/umount/umount02.c b/testcases/kernel/syscalls/umount/umount02.c
> index 34a38c998..40fed1fbd 100644
> --- a/testcases/kernel/syscalls/umount/umount02.c
> +++ b/testcases/kernel/syscalls/umount/umount02.c
> @@ -2,6 +2,7 @@
>  /*
>   * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
>   * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
> + * Copyright (c) Linux Test Project, 2003-2023
>   * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
>   *
>   * Check for basic errors returned by umount(2) system call.
> @@ -41,21 +42,14 @@ static void verify_umount(unsigned int n)
>  {
>  	struct tcase *tc = &tcases[n];

> -	TEST(umount(tc->mntpoint));
> -
> -	if (TST_RET != -1) {
> -		tst_res(TFAIL, "umount() succeeds unexpectedly");
> -		return;
> -	}
> +	TST_EXP_FAIL(umount(tc->mntpoint), tc->exp_errno,
> +		     "umount() fail with %s", tc->err_desc);

I'd prefer just:
TST_EXP_FAIL(umount(tc->mntpoint), tc->exp_errno);

>  	if (tc->exp_errno != TST_ERR) {
>  		tst_res(TFAIL | TTERRNO, "umount() should fail with %s",
>  			tst_strerrno(tc->exp_errno));
>  		return;
>  	}
Also this is redundant and should be removed.
With it removed you may add:
Reviewed-by: Petr Vorel <pvorel@suse.cz>

nit: #include <string.h> could be removed.
Also doc could be converted to docparse.

Kind regards,
Petr

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

  reply	other threads:[~2023-10-26  0:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12  8:40 [LTP] [PATCH 1/3] umount01: Simplify test using TST_ macros Yang Xu
2023-10-12  8:40 ` [LTP] [PATCH 2/3] umount02: " Yang Xu
2023-10-26  0:12   ` Petr Vorel [this message]
2023-10-26  5:40     ` [LTP] 回复: " Yang Xu (Fujitsu)
2023-10-12  8:40 ` [LTP] [PATCH 3/3] umount03: " Yang Xu
2023-10-26  0:05   ` Petr Vorel
2023-10-26  0:06     ` Petr Vorel
2023-10-26  6:07       ` [LTP] 回复: " Yang Xu (Fujitsu)
2023-10-26  6:05     ` Yang Xu (Fujitsu)
2023-10-20  9:49 ` [LTP] [PATCH 1/3] umount01: " Yang Xu (Fujitsu)

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=20231026001217.GD540370@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=xuyang2018.jy@fujitsu.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