syscalls/quotactl07: add regresstion test for Q_XQTUOTARM
PATCH v2 1/1 syscalls/quotactl07: add regresstion test for Q_XQTUOTARM
This is a regresstion test to check Q_XQUOTARM whether has quota flags check.
---------------------
1.Simplify test code
2.add comment for invalid_type,
---------------------
--- include/lapi/quotactl.h | 4 ++ runtest/syscalls | 1 + testcases/kernel/syscalls/quotactl/.gitignore | 1 + .../kernel/syscalls/quotactl/quotactl07.c | 71 +++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 testcases/kernel/syscalls/quotactl/quotactl07.c
include/lapi/quotactl.h +4 -0
@@ -59,6 +59,10 @@ struct fs_quota_statv {# define PRJQUOTA 2#endif +#ifndef Q_XQUOTARM +# define Q_XQUOTARM XQM_CMD(6) +#endif +#ifndef Q_XGETQSTATV # define Q_XGETQSTATV XQM_CMD(8)#endif
runtest/syscalls +1 -0
@@ -958,6 +958,7 @@ quotactl03 quotactl03 quotactl04 quotactl04 quotactl05 quotactl05 quotactl06 quotactl06 +quotactl07 quotactl07 read01 read01 read02 read02
testcases/kernel/syscalls/quotactl/.gitignore +1 -0
@@ -4,3 +4,4 @@ /quotactl04 /quotactl05 /quotactl06 +/quotactl07
testcases/kernel/syscalls/quotactl/quotactl07.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH v2 1/1 syscalls/quotactl07: add regresstion test for Q_XQTUOTARM
Hi!
Quoted 9 lines
This is a regresstion test to check
Q_XQUOTARMwhether has quota flags check.Signed-off-by Yang Xu <[email protected]>---------------------
1.Simplify test code
2.add comment forinvalid_type,
---------------------
^
Btw this belongs under the three dashes below, otherwise it ends up in the commit message when applied.
...
testcases/kernel/syscalls/quotactl/quotactl07.c line 46
Quoted 10 lines
testcases/kernel/syscalls/quotactl/quotactl07.c new file +10
-0+static void setup (void ) +{ +TEST (quotactl (QCMD (Q_XQUOTAOFF ,USRQUOTA ), tst_device->dev,0 , (void *)&qflag_acct)); +if (TST_RET ==-1 ) +tst_brk (TBROK |TTERRNO ,"quotactl with Q_XQUOTAOFF failed" ); + +TEST (quotactl (QCMD (Q_XQUOTARM ,USRQUOTA ), tst_device->dev,0 , (void *)&valid_type)); +if (TST_ERR ==EINVAL ) { +tst_res (TCONF ,"current system doesn't support Q_XQUOTARM, skip it" ); +return ;
I've changed this to tst_brk() because doing return from setup has no efect here, and pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 1/1 syscalls/quotactl07: add regresstion test for Q_XQTUOTARM
Hi> Hi!
Quoted 5 lines
Quoted 5 lines
This is a regresstion test to check
Q_XQUOTARMwhether has quota flags check.Signed-off-by Yang Xu <[email protected]>
Quoted 8 lines
Quoted 4 lines
---------------------
1.Simplify test code
2.add comment forinvalid_type,
---------------------^
Btw this belongs under the three dashes below, otherwise it ends up in the commit message when applied.
OK. I will notice this next time.
Quoted 15 lines
...
testcases/kernel/syscalls/quotactl/quotactl07.c line 46
Quoted 10 lines
testcases/kernel/syscalls/quotactl/quotactl07.c new file +10
-0+static void setup (void ) +{ +TEST (quotactl (QCMD (Q_XQUOTAOFF ,USRQUOTA ), tst_device->dev,0 , (void *)&qflag_acct)); +if (TST_RET ==-1 ) +tst_brk (TBROK |TTERRNO ,"quotactl with Q_XQUOTAOFF failed" ); + +TEST (quotactl (QCMD (Q_XQUOTARM ,USRQUOTA ), tst_device->dev,0 , (void *)&valid_type)); +if (TST_ERR ==EINVAL ) { +tst_res (TCONF ,"current system doesn't support Q_XQUOTARM, skip it" ); +return ;I've changed this to
tst_brk()because doing return from setup has no efect here, and pushed, thanks.
Thanks for pushing.
Quoted 1 line
PATCH v2 1/1 syscalls/quotactl07: add regresstion test for Q_XQTUOTARM
In reply to Yang XuHi Cyril,
Thank you for pushing it.
Sorry, forgot to review and push the v2 patch.
Thanks,
Xiao Yang
Quoted 130 lines · Yang Xu
This is a regresstion test to check
Q_XQUOTARMwhether has quota flags check.Signed-off-by Yang Xu<[email protected]>---------------------
1.Simplify test code
2.add comment forinvalid_type,
------------------------ include/lapi/quotactl.h | 4 ++ runtest/syscalls | 1 + testcases/kernel/syscalls/quotactl/.gitignore | 1 + .../kernel/syscalls/quotactl/quotactl07.c | 71 +++++++++++++++++++ 4 files changed, 77 insertions(+)create mode 100644
testcases/kernel/syscalls/quotactl/quotactl07.cinclude/lapi/quotactl.h +4
-0@@ -59,6 +59,10 @@ struct fs_quota_statv {# define PRJQUOTA 2#endif +#ifndef Q_XQUOTARM +# define Q_XQUOTARM XQM_CMD(6) +#endif +#ifndef Q_XGETQSTATV # define Q_XGETQSTATV XQM_CMD(8)#endif runtest/syscalls +1
-0@@ -958,6 +958,7 @@ quotactl03 quotactl03 quotactl04 quotactl04 quotactl05 quotactl05 quotactl06 quotactl06 +quotactl07 quotactl07 read01 read01 read02 read02testcases/kernel/syscalls/quotactl/.gitignore +1
-0@@ -4,3 +4,4 @@ /quotactl04 /quotactl05 /quotactl06 +/quotactl07testcases/kernel/syscalls/quotactl/quotactl07.c new file +71
-0@@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. +* Author: Yang Xu<[email protected]> +* +* This is a regresstion test for kernel commit 3dd4d40b4208 +* ("xfs: Sanity check flags of Q_XQUOTARM call"). +*/ + +#include "config.h" +#include <errno.h> +#include <unistd.h> +#include <stdio.h> +#include <sys/quota.h> +#include "lapi/quotactl.h" +#include "tst_test.h" + +#ifdef HAVE_XFS_XQM_H +# include <xfs/xqm.h> + +#define MNTPOINT "mntpoint" + +static uint32_t qflag_acct =XFS_QUOTA_UDQ_ACCT ; +static unsigned int valid_type =XFS_USER_QUOTA ; +/*Include a valid quota type to avoid other EINVAL error*/ +static unsigned int invalid_type =XFS_GROUP_QUOTA <<1 |XFS_USER_QUOTA ; + +static void verify_quota (void ) +{ +TEST (quotactl (QCMD (Q_XQUOTARM ,USRQUOTA ), tst_device->dev,0 , (void *)&invalid_type)); +if (TST_ERR ==EINVAL ) +tst_res (TPASS ,"Q_XQUOTARM has quota type check" ); +else +tst_res (TFAIL ,"Q_XQUOTARM doesn't have quota type check" ); +} + +static void setup (void ) +{ +TEST (quotactl (QCMD (Q_XQUOTAOFF ,USRQUOTA ), tst_device->dev,0 , (void *)&qflag_acct)); +if (TST_RET ==-1 ) +tst_brk (TBROK |TTERRNO ,"quotactl with Q_XQUOTAOFF failed" ); + +TEST (quotactl (QCMD (Q_XQUOTARM ,USRQUOTA ), tst_device->dev,0 , (void *)&valid_type)); +if (TST_ERR ==EINVAL ) { +tst_res (TCONF ,"current system doesn't support Q_XQUOTARM, skip it" ); +return ; + } +} + +static const char *kconfigs[] = { +"CONFIG_XFS_QUOTA" , +NULL +}; + +static struct tst_test test = { + .setup = setup, + .needs_root =1 , + .needs_kconfigs = kconfigs, + .test_all = verify_quota, + .mount_device =1 , + .dev_fs_type ="xfs" , + .mnt_data ="usrquota" , + .mntpoint =MNTPOINT , + .tags = (const struct tst_tag []) { + {"linux-git" ,"3dd4d40b4208" }, + {} + } +}; +#else +TST_TEST_TCONF ("System doesn't have<xfs/xqm.h>" ); +#endif