Skip to content

Commit

Permalink
syscalls: quotactl: Move mkfs opts into tst_test
Browse files Browse the repository at this point in the history
Reviewed-by: Avinesh Kumar <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Acked-by: Andrea Cervesato <[email protected]>
Signed-off-by: Cyril Hrubis <[email protected]>
  • Loading branch information
metan-ucw committed Jul 4, 2024
1 parent cce6188 commit 361f6ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
19 changes: 9 additions & 10 deletions testcases/kernel/syscalls/quotactl/quotactl04.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define FMTID QFMT_VFS_V1

static int32_t fmt_id = FMTID;
static int test_id, mount_flag;
static int test_id;
static struct dqblk set_dq = {
.dqb_bsoftlimit = 100,
.dqb_valid = QIF_BLIMITS
Expand Down Expand Up @@ -98,12 +98,8 @@ static struct tcase {

static void setup(void)
{
const char *const fs_opts[] = {"-I 256", "-O quota,project", NULL};

quotactl_info();
SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
mount_flag = 1;

fd = SAFE_OPEN(MNTPOINT, O_RDONLY);

TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, PRJQUOTA), tst_device->dev,
Expand All @@ -116,8 +112,6 @@ static void cleanup(void)
{
if (fd > -1)
SAFE_CLOSE(fd);
if (mount_flag && tst_umount(MNTPOINT))
tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
}

static void verify_quota(unsigned int n)
Expand Down Expand Up @@ -161,9 +155,14 @@ static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcases),
.setup = setup,
.cleanup = cleanup,
.needs_device = 1,
.mount_device = 1,
.filesystems = (struct tst_fs []) {
{.type = "ext4"},
{
.type = "ext4",
.mkfs_opts = (const char *const[]) {
"-I 256", "-O quota,project", NULL
},
},
{}
},
.mntpoint = MNTPOINT,
Expand Down
19 changes: 8 additions & 11 deletions testcases/kernel/syscalls/quotactl/quotactl08.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#define MNTPOINT "mntpoint"

static int32_t fmt_id = QFMT_VFS_V1;
static int test_id, mount_flag;
static int test_id;
static struct dqblk set_dq = {
.dqb_bsoftlimit = 100,
.dqb_valid = QIF_BLIMITS
Expand Down Expand Up @@ -153,14 +153,8 @@ static struct tcase {

static void setup(void)
{
const char *const fs_opts[] = { "-O quota", NULL};

quotactl_info();

SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
mount_flag = 1;

fd = SAFE_OPEN(MNTPOINT, O_RDONLY);
TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev,
0, (void *) &res_ndq));
Expand All @@ -172,8 +166,6 @@ static void cleanup(void)
{
if (fd > -1)
SAFE_CLOSE(fd);
if (mount_flag && tst_umount(MNTPOINT))
tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
}

static void verify_quota(unsigned int n)
Expand Down Expand Up @@ -217,10 +209,15 @@ static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcases),
.mntpoint = MNTPOINT,
.filesystems = (struct tst_fs []) {
{.type = "ext4"},
{
.type = "ext4",
.mkfs_opts = (const char *const[]){
"-O quota", NULL
},
},
{}
},
.needs_device = 1,
.mount_device = 1,
.setup = setup,
.cleanup = cleanup,
.test_variants = QUOTACTL_SYSCALL_VARIANTS,
Expand Down

0 comments on commit 361f6ad

Please sign in to comment.