[LTP] [PATCH v4 4/6] syscalls/quotactl04: Add quotactl_fd test variant
Yang Xu
xuyang2018.jy@fujitsu.com
Mon Dec 13 08:26:52 CET 2021
Also remove useless geteuid.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
testcases/kernel/syscalls/quotactl/quotactl04.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
index cc107a7e4..44273c35d 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl04.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -27,10 +27,10 @@
#include <sys/stat.h>
#include <sys/mount.h>
#include "tst_test.h"
-#include "lapi/quotactl.h"
+#include "quotactl_syscall_var.h"
#define FMTID QFMT_VFS_V1
-#define MNTPOINT "mntpoint"
+
static int32_t fmt_id = FMTID;
static int test_id, mount_flag;
static struct dqblk set_dq = {
@@ -121,13 +121,16 @@ static void setup(void)
{
const char *const fs_opts[] = {"-I 256", "-O quota,project", NULL};
- test_id = geteuid();
+ quotactl_info();
SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
+ fd = SAFE_OPEN(MNTPOINT, O_RDONLY);
}
static void cleanup(void)
{
+ if (fd > -1)
+ SAFE_CLOSE(fd);
if (mount_flag && tst_umount(MNTPOINT))
tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
}
@@ -142,7 +145,7 @@ static void verify_quota(unsigned int n)
tst_res(TINFO, "Test #%d: %s", n, tc->tname);
- TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, tc->addr));
+ TEST(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr));
if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des);
return;
@@ -172,6 +175,7 @@ static struct tst_test test = {
.needs_device = 1,
.dev_fs_type = "ext4",
.mntpoint = MNTPOINT,
+ .test_variants = QUOTACTL_SYSCALL_VARIANTS,
.needs_cmds = (const char *[]) {
"mkfs.ext4 >= 1.43.0",
NULL
--
2.23.0
More information about the ltp
mailing list