Linux Test Project
 help / color / mirror / Atom feed
From: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
To: "daisl.fnst@fujitsu.com" <daisl.fnst@fujitsu.com>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2 2/3] Make use of SAFE_ACCESS
Date: Fri, 18 Mar 2022 04:02:26 +0000	[thread overview]
Message-ID: <6234047F.70901@fujitsu.com> (raw)
In-Reply-To: <1647550813-1958-2-git-send-email-daisl.fnst@fujitsu.com>

Hi Dai

Looks good to me,
Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>

just some small nits:
Since quotactl01 use tst_brk(TFAIL | TERRNO), we should also
mention it ie commit 706d412a quotactl06: Replace tst_brk(TFAIL) with
TBROK does.

Also this patch need rebase since commit 26d117f8 ("syscalls/quotactl:
Remove tst_require_quota_support") break this source code.


Best Regards
Yang Xu
> Signed-off-by: Dai Shili<daisl.fnst@fujitsu.com>
> ---
>   testcases/kernel/mem/tunable/max_map_count.c    | 4 +---
>   testcases/kernel/syscalls/fanotify/fanotify17.c | 3 +--
>   testcases/kernel/syscalls/getxattr/getxattr05.c | 3 +--
>   testcases/kernel/syscalls/madvise/madvise08.c   | 3 +--
>   testcases/kernel/syscalls/quotactl/quotactl01.c | 6 ++----
>   testcases/kernel/syscalls/quotactl/quotactl06.c | 3 +--
>   6 files changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/testcases/kernel/mem/tunable/max_map_count.c b/testcases/kernel/mem/tunable/max_map_count.c
> index a4c3dbf..caf8972 100644
> --- a/testcases/kernel/mem/tunable/max_map_count.c
> +++ b/testcases/kernel/mem/tunable/max_map_count.c
> @@ -58,9 +58,7 @@ static long old_overcommit = -1;
> 
>   static void setup(void)
>   {
> -	if (access(PATH_SYSVM "max_map_count", F_OK) != 0)
> -		tst_brk(TBROK | TERRNO,
> -			 "Can't support to test max_map_count");
> +	SAFE_ACCESS(PATH_SYSVM "max_map_count", F_OK);
> 
>   	old_max_map_count = get_sys_tune("max_map_count");
>   	old_overcommit = get_sys_tune("overcommit_memory");
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify17.c b/testcases/kernel/syscalls/fanotify/fanotify17.c
> index 35beb53..7d74b25 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify17.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify17.c
> @@ -159,8 +159,7 @@ static void do_unshare(int map_root)
>   		 * uid_map file should exist since Linux 3.8 because
>   		 * it is available on Linux 3.5
>   		 */
> -		if (access(UID_MAP, F_OK))
> -			tst_brk(TBROK, "file %s didn't exist", UID_MAP);
> +		SAFE_ACCESS(UID_MAP, F_OK);
> 
>   		SAFE_FILE_PRINTF(UID_MAP, "%d %d %d", 0, 0, 1);
>   	}
> diff --git a/testcases/kernel/syscalls/getxattr/getxattr05.c b/testcases/kernel/syscalls/getxattr/getxattr05.c
> index c0d339f..3e73cc5 100644
> --- a/testcases/kernel/syscalls/getxattr/getxattr05.c
> +++ b/testcases/kernel/syscalls/getxattr/getxattr05.c
> @@ -100,8 +100,7 @@ static void do_unshare(int map_root)
>   		/* uid_map file should exist since Linux 3.8 because
>   		 * it is available on Linux 3.5
>   		 */
> -		if (access(UID_MAP, F_OK))
> -			tst_brk(TBROK, "file %s didn't exist", UID_MAP);
> +		SAFE_ACCESS(UID_MAP, F_OK);
> 
>   		SAFE_FILE_PRINTF(UID_MAP, "%d %d %d", 0, 0, 1);
>   	}
> diff --git a/testcases/kernel/syscalls/madvise/madvise08.c b/testcases/kernel/syscalls/madvise/madvise08.c
> index 30f3604..10549f4 100644
> --- a/testcases/kernel/syscalls/madvise/madvise08.c
> +++ b/testcases/kernel/syscalls/madvise/madvise08.c
> @@ -110,8 +110,7 @@ static int find_sequence(int pid)
> 
>   	snprintf(dumpname, 256, "dump-%d", pid);
>   	tst_res(TINFO, "Dump file should be %s", dumpname);
> -	if (access(dumpname, F_OK))
> -		tst_brk(TBROK | TERRNO, "Dump file was not found.");
> +	SAFE_ACCESS(dumpname, F_OK);
> 
>   	dfd = SAFE_OPEN(dumpname, O_RDONLY);
> 
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
> index 63f6e91..56c4f2f 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl01.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
> @@ -160,11 +160,9 @@ static void setup(void)
>   	SAFE_CMD(cmd, NULL, NULL);
>   	fmt_id = var->fmt_id;
> 
> -	if (access(USRPATH, F_OK) == -1)
> -		tst_brk(TFAIL | TERRNO, "user quotafile didn't exist");
> +	SAFE_ACCESS(USRPATH, F_OK);
> 
> -	if (access(GRPPATH, F_OK) == -1)
> -		tst_brk(TFAIL | TERRNO, "group quotafile didn't exist");
> +	SAFE_ACCESS(GRPPATH, F_OK);
> 
>   	tst_require_quota_support(tst_device->dev, fmt_id, usrpath);
> 
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
> index feb4750..0ac099b 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl06.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
> @@ -186,8 +186,7 @@ static void setup(void)
>   	/* vfsv0 block limit 2^42, vfsv1 block limit 2^63 - 1 */
>   	set_dqmax.dqb_bsoftlimit = tst_variant ? 0x20000000000000 : 0x100000000;
> 
> -	if (access(USRPATH, F_OK) == -1)
> -		tst_brk(TBROK | TERRNO, "user quotafile didn't exist");
> +	SAFE_ACCESS(USRPATH, F_OK);
> 
>   	tst_require_quota_support(tst_device->dev, fmt_id, usrpath);
> 

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

  reply	other threads:[~2022-03-18  4:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 17:28 [LTP] [PATCH 1/2] Add SAFE_ACCESS macro Dai Shili
2022-03-14 17:28 ` [LTP] [PATCH 2/2] Make use of SAFE_ACCESS Dai Shili
2022-03-14  6:43   ` xuyang2018.jy
2022-03-17 21:00     ` [LTP] [PATCH v2 1/3] Add SAFE_ACCESS macro Dai Shili
2022-03-17 21:00       ` [LTP] [PATCH v2 2/3] Make use of SAFE_ACCESS Dai Shili
2022-03-18  4:02         ` xuyang2018.jy [this message]
2022-03-17 21:00       ` [LTP] [PATCH v2 3/3] syscalls/umount2: Convert to new API and use SAFE_ACCESS Dai Shili
2022-03-18  4:03         ` xuyang2018.jy
2022-03-18  5:11           ` xuyang2018.jy
2022-03-18 18:55             ` [LTP] [PATCH v3 1/3] Add SAFE_ACCESS macro Dai Shili
2022-03-18 18:55               ` [LTP] [PATCH v3 2/3] Make use of SAFE_ACCESS Dai Shili
2022-03-23 19:30                 ` Petr Vorel
2022-03-23 19:33                 ` Petr Vorel
2022-03-18 18:55               ` [LTP] [PATCH v3 3/3] syscalls/umount2: Convert to new API and use SAFE_ACCESS Dai Shili
2022-03-23 19:36                 ` Petr Vorel
2022-03-24  2:23                   ` daisl.fnst
2022-03-24 15:35                   ` [LTP] [PATCH v4] " Dai Shili
2022-03-24  9:11                     ` Petr Vorel
2022-03-25  3:00                       ` daisl.fnst
2022-03-25 17:29                       ` [LTP] [PATCH v5] " Dai Shili
2022-03-25  8:46                         ` Petr Vorel
2022-03-24  1:37                 ` [LTP] [PATCH v3 3/3] " xuyang2018.jy
2022-03-23 19:24               ` [LTP] [PATCH v3 1/3] Add SAFE_ACCESS macro Petr Vorel
2022-03-24  2:22                 ` daisl.fnst
2022-03-23 19:27               ` Petr Vorel
2022-03-23 19:33               ` Petr Vorel
2022-03-18  3:56       ` [LTP] [PATCH v2 " xuyang2018.jy

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=6234047F.70901@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=daisl.fnst@fujitsu.com \
    --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