From: Yang Xu <xuyang2018.jy@fujitsu.com>
To: <ltp@lists.linux.it>
Subject: [LTP] [PATCH v1 09/11] syscalls/quotactl03: Add quotactl_fd test variant
Date: Mon, 18 Oct 2021 21:14:46 +0800 [thread overview]
Message-ID: <1634562888-5987-4-git-send-email-xuyang2018.jy@fujitsu.com> (raw)
In-Reply-To: <1634562888-5987-1-git-send-email-xuyang2018.jy@fujitsu.com>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
.../kernel/syscalls/quotactl/quotactl03.c | 28 +++++++++++++++----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c
index 9711b7f07..019e7c646 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl03.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl03.c
@@ -28,15 +28,18 @@
#include <unistd.h>
#include <stdio.h>
#include <sys/quota.h>
-
#include "tst_test.h"
#include "lapi/quotactl.h"
+#include "quotactl_var.h"
#ifdef HAVE_XFS_XQM_H
# include <xfs/xqm.h>
-static const char mntpoint[] = "mnt_point";
+#define MNTPOINT "mnt_point"
+#define TESTFILE MNTPOINT "/testfile"
+
static uint32_t test_id = 0xfffffffc;
+static int fd = -1;
static void verify_quota(void)
{
@@ -44,7 +47,7 @@ static void verify_quota(void)
res_dquota.d_id = 1;
- TEST(quotactl(QCMD(Q_XGETNEXTQUOTA, USRQUOTA), tst_device->dev,
+ TEST(do_quotactl(fd, QCMD(Q_XGETNEXTQUOTA, USRQUOTA), tst_device->dev,
test_id, (void *)&res_dquota));
if (TST_RET != -1) {
tst_res(TFAIL, "quotactl() found the next active ID: %u unexpectedly",
@@ -63,6 +66,18 @@ static void verify_quota(void)
tst_res(TPASS, "quotactl() failed with ENOENT as expected");
}
+static void setup(void)
+{
+ quotactl_info();
+ fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0666);
+}
+
+static void cleanup(void)
+{
+ if (fd > -1)
+ SAFE_CLOSE(fd);
+}
+
static struct tst_test test = {
.needs_root = 1,
.needs_kconfigs = (const char *[]) {
@@ -72,8 +87,11 @@ static struct tst_test test = {
.test_all = verify_quota,
.mount_device = 1,
.dev_fs_type = "xfs",
- .mntpoint = mntpoint,
- .mnt_data = "usrquota",
+ .mntpoint = MNTPOINT,
+ .mnt_data = "usrquota,grpquota",
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_variants = 2,
};
#else
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2021-10-18 13:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 13:14 [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Yang Xu
2021-10-18 13:14 ` [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem Yang Xu
2021-10-26 14:21 ` Cyril Hrubis
2021-10-27 3:04 ` xuyang2018.jy
2021-10-18 13:14 ` [LTP] [PATCH v1 08/11] syscalls/quotaclt02, 5: Add quotactl_fd test variant Yang Xu
2021-10-26 14:23 ` Cyril Hrubis
2021-10-18 13:14 ` Yang Xu [this message]
2021-10-26 14:25 ` [LTP] [PATCH v1 09/11] syscalls/quotactl03: " Cyril Hrubis
2021-10-18 13:14 ` [LTP] [PATCH v1 10/11] syscalls/quotactl04: " Yang Xu
2021-10-26 14:26 ` Cyril Hrubis
2021-10-26 14:13 ` [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Cyril Hrubis
2021-10-27 2:58 ` 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=1634562888-5987-4-git-send-email-xuyang2018.jy@fujitsu.com \
--to=xuyang2018.jy@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;
as well as URLs for NNTP newsgroup(s).