public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] syscalls/quotatcl01.c: Rewrite && Convert to new API
Date: Mon, 31 Oct 2016 18:20:32 +0800	[thread overview]
Message-ID: <58171AF0.5000209@cn.fujitsu.com> (raw)
In-Reply-To: <20161031101104.GD30590@rei.lan>

On 2016/10/31 18:11, Cyril Hrubis wrote:
> Hi!
> Pushed with follwing diff, thanks.
>
> Apart from cosmetic things like removing useless cast to caddrt_t I've
> changed it to handle missing quotacheck command gracefully. I.e. we have
> to set the mount flag right after we mount the device otherwise the test
> cleanup in library will fail when we call tst_brk() because the
> tst_run_cmd() has failed since the test haven't umounted it. And also
> tst_run_cmd returns 255 on ENOENT which should be mapped to TCONF
> instead of TBROK.
>
> Also can you pretty please resend the second patch? I cannot find it in
> my mailbox anymore (possibly accidentally deleted).
Hi Cyril
Thanks for your review.   I will resend th second patch:-) .

Thanks
Xiao Yang.
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
> index 9e1ff36..89b5dc2 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl01.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
> @@ -63,16 +63,16 @@
>   #  ifndef QFMT_VFS_V0
>   #   define QFMT_VFS_V0     2
>   #  endif
> -#  define USRPATH MNTPOINT "/" "aquota.user"
> -#  define GRPPATH MNTPOINT "/" "aquota.group"
> +#  define USRPATH MNTPOINT "/aquota.user"
> +#  define GRPPATH MNTPOINT "/aquota.group"
>   #  define FMTID	QFMT_VFS_V0
>   # else
>   #  define _LINUX_QUOTA_VERSION  1
>   #  ifndef QFMT_VFS_OLD
>   #   define QFMT_VFS_OLD    1
>   #  endif
> -#  define USRPATH MNTPOINT "/" "quota.user"
> -#  define GRPPATH MNTPOINT "/" "quota.group"
> +#  define USRPATH MNTPOINT "/quota.user"
> +#  define GRPPATH MNTPOINT "/quota.group"
>   #  define FMTID	QFMT_VFS_OLD
>   # endif
>
> @@ -145,14 +145,24 @@ static struct tcase {
>   static void setup(void)
>   {
>   	const char *const cmd[] = {"quotacheck", "-ug", MNTPOINT, NULL};
> +	int ret;
>
>   	SAFE_MKDIR(MNTPOINT, 0755);
>
>   	SAFE_MKFS(tst_device->dev, "ext4", NULL, NULL);
>
>   	SAFE_MOUNT(tst_device->dev, MNTPOINT, "ext4", 0, "usrquota,grpquota");
> +	mount_flag = 1;
>
> -	tst_run_cmd(cmd, NULL, NULL, 0);
> +	ret = tst_run_cmd(cmd, NULL, NULL, 1);
> +	switch (ret) {
> +	case 255:
> +		tst_brk(TCONF, "quotacheck binary not installed");
> +	default:
> +		tst_brk(TBROK, "quotacheck exited with %i", ret);
> +	case 0:
> +	break;
> +	}
>
>   	test_id = geteuid();
>
> @@ -161,8 +171,6 @@ static void setup(void)
>
>   	if (access(GRPPATH, F_OK) == -1)
>   		tst_brk(TFAIL | TERRNO, "group quotafile didn't exist");
> -
> -	mount_flag = 1;
>   }
>
>   static void cleanup(void)
> @@ -179,7 +187,7 @@ static void verify_quota(unsigned int n)
>   	res_qf.dqi_igrace = 0;
>   	memset(fmt_buf, 0, sizeof(fmt_buf));
>
> -	TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, (caddr_t) tc->addr));
> +	TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, tc->addr));
>   	if (TEST_RETURN == -1) {
>   		tst_res(TFAIL | TERRNO, "quotactl failed to %s", tc->des);
>   		return;
>




  reply	other threads:[~2016-10-31 10:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21  6:53 [LTP] [PATCH 1/2] syscalls/quotatcl01.c: Rewrite && Convert to new API Xiao Yang
2016-10-21  6:53 ` [LTP] [PATCH 2/2] syscalls/quotactl02.c: Reconstruct and " Xiao Yang
2016-10-24 10:49 ` [LTP] [PATCH 1/2] syscalls/quotatcl01.c: Rewrite && " Cyril Hrubis
2016-10-25  6:08   ` Xiao Yang
2016-10-25  6:15   ` [LTP] [PATCH v2] " Xiao Yang
2016-10-31 10:11     ` Cyril Hrubis
2016-10-31 10:20       ` Xiao Yang [this message]
2016-10-31 11:33       ` [LTP] [PATCH] syscalls/quotactl02.c: Reconstruct and " Xiao Yang
2016-10-31 13:25         ` Cyril Hrubis
2016-11-01  8:33           ` [LTP] [PATCH v2] syscalls/quotactl02.c: Reconstruct && " Xiao Yang
2016-11-01 15:52             ` Cyril Hrubis

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=58171AF0.5000209@cn.fujitsu.com \
    --to=yangx.jy@cn.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