Skip to content

Commit 123e6db

Browse files
Cypresslinpevik
authored andcommitted
syscalls/quotactl04: add mkfs.ext4 package version check
The project quota feature was added in e2fsprogs 1.43 [1]: E2fsprogs 1.43 (May 17, 2016) Add support for the ext4 metadata checksum, checksum seed, inline data, encryption, project quota, and read-only features. The test should be skipped when running with older package, otherwise it will fail with: Invalid filesystem option set: quota,project Use popen and fscanf to get mkfs.ext4 -V output for version comparison. This version checking by adding digits together does not work with alphabets in the number like rc1, but in that case the test will still be tested. It will now be skipped with (tested with Ubuntu Xenial + 4.15 kernel): quotactl04.c:118: TCONF: Test needs mkfs.ext4 >= 1.43 for quota,project option, test skipped [1] http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.42.13 Signed-off-by: Po-Hsu Lin <[email protected]> Reviewed-by: Yang Xu <[email protected]> Reviewed-by: Petr Vorel <[email protected]>
1 parent 4706bf2 commit 123e6db

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

testcases/kernel/syscalls/quotactl/quotactl04.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* 7) quotactl(2) succeeds to get disk quota limit greater than or equal to
2020
* ID with Q_GETNEXTQUOTA flag for project.
2121
* 8) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for project.
22+
*
23+
* Minimum e2fsprogs version required is 1.43.
2224
*/
2325

2426
#include <errno.h>
@@ -28,6 +30,7 @@
2830
#include <sys/stat.h>
2931
#include "config.h"
3032
#include "lapi/quotactl.h"
33+
#include "tst_safe_stdio.h"
3134
#include "tst_test.h"
3235

3336
#ifndef QFMT_VFS_V1
@@ -102,9 +105,18 @@ static struct tcase {
102105

103106
static void setup(void)
104107
{
108+
FILE *f;
105109
const char *const fs_opts[] = {"-I 256", "-O quota,project", NULL};
110+
int rc, major, minor, patch;
106111

107112
test_id = geteuid();
113+
f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r");
114+
rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch);
115+
if (rc != 3)
116+
tst_res(TWARN, "Unable parse version number");
117+
else if (major * 10000 + minor * 100 + patch < 14300)
118+
tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for quota,project option, test skipped");
119+
pclose(f);
108120
SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
109121
SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "quota");
110122
mount_flag = 1;

0 commit comments

Comments
 (0)