tst_test per FS options and small cleanup
v2 cover tst_test per FS options and small cleanup
Add per FS mkfs and mount options and move mkfs_opts to the tst_test struct in two quotactl tests.
v2:
- put everything into a single filesystems array
- change fs_type to type in the doc header for struct tst_fs
Cyril Hrubis (2):
lib: tst_test: Add per filesystem mkfs and mount opts
syscalls: quotactl: Move mkfs opts into tst_test
include/tst_test.h | 66 ++++++---- lib/tst_test.c | 117 ++++++++++++++---- .../kernel/syscalls/fanotify/fanotify22.c | 5 +- .../kernel/syscalls/fanotify/fanotify23.c | 5 +- .../kernel/syscalls/getxattr/getxattr04.c | 5 +- testcases/kernel/syscalls/ioctl/ioctl08.c | 5 +- testcases/kernel/syscalls/mmap/mmap16.c | 22 ++-- .../kernel/syscalls/quotactl/quotactl01.c | 9 +- .../kernel/syscalls/quotactl/quotactl02.c | 9 +- .../kernel/syscalls/quotactl/quotactl03.c | 9 +- .../kernel/syscalls/quotactl/quotactl04.c | 22 ++-- .../kernel/syscalls/quotactl/quotactl05.c | 9 +- .../kernel/syscalls/quotactl/quotactl06.c | 9 +- .../kernel/syscalls/quotactl/quotactl07.c | 5 +- .../kernel/syscalls/quotactl/quotactl08.c | 22 ++-- .../kernel/syscalls/quotactl/quotactl09.c | 9 +- testcases/kernel/syscalls/statx/statx05.c | 5 +- testcases/kernel/syscalls/statx/statx06.c | 11 +- testcases/kernel/syscalls/statx/statx07.c | 5 +- testcases/kernel/syscalls/statx/statx09.c | 5 +- 20 files changed, 249 insertions(+), 105 deletions(-)
Signature · 5 lines
2.44.2 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/2 lib: tst_test: Add per filesystem mkfs and mount opts
This commit does:
* Group the filesystem type, mkfs and mount options into a separate structure
* Add an array of these structures to be able to define per filesystem mkfs and mount options
The details on the usage should be hopefully clear from the documentation comments for the struct tst_test.
--- include/tst_test.h | 66 ++++++---- lib/tst_test.c | 117 ++++++++++++++---- .../kernel/syscalls/fanotify/fanotify22.c | 5 +- .../kernel/syscalls/fanotify/fanotify23.c | 5 +- .../kernel/syscalls/getxattr/getxattr04.c | 5 +- testcases/kernel/syscalls/ioctl/ioctl08.c | 5 +- testcases/kernel/syscalls/mmap/mmap16.c | 22 ++-- .../kernel/syscalls/quotactl/quotactl01.c | 9 +- .../kernel/syscalls/quotactl/quotactl02.c | 9 +- .../kernel/syscalls/quotactl/quotactl03.c | 9 +- .../kernel/syscalls/quotactl/quotactl04.c | 5 +- .../kernel/syscalls/quotactl/quotactl05.c | 9 +- .../kernel/syscalls/quotactl/quotactl06.c | 9 +- .../kernel/syscalls/quotactl/quotactl07.c | 5 +- .../kernel/syscalls/quotactl/quotactl08.c | 5 +- .../kernel/syscalls/quotactl/quotactl09.c | 9 +- testcases/kernel/syscalls/statx/statx05.c | 5 +- testcases/kernel/syscalls/statx/statx06.c | 11 +- testcases/kernel/syscalls/statx/statx07.c | 5 +- testcases/kernel/syscalls/statx/statx09.c | 5 +- 20 files changed, 234 insertions(+), 86 deletions(-)
include/tst_test.h +42 -24
@@ -247,6 +247,36 @@ struct tst_ulimit_val {rlim_t rlim_cur; }; +/** +* struct tst_fs - A file system type, mkfs and mount options +* +* @type A filesystem type to use. +* +* @mkfs_opts: A NULL terminated array of options passed to mkfs in the case +* of 'tst_test.format_device'. These options are passed to mkfs +* before the device path. +* +* @mkfs_size_opt: An option passed to mkfs in the case of +* 'tst_test.format_device'. The device size in blocks is +* passed to mkfs after the device path and can be used to +* limit the file system not to use the whole block device. +* +* @mnt_flags: MS_* flags passed to mount(2) when the test library mounts a +* device in the case of 'tst_test.mount_device'. +* +* @mnt_data: The data passed to mount(2) when the test library mounts a device +* in the case of 'tst_test.mount_device'. +*/ +struct tst_fs { +const char *type; + +const char *const *mkfs_opts; +const char *mkfs_size_opt; + +const unsigned int mnt_flags; +const void *mnt_data; +}; +/** * struct tst_test - A test description. *
@@ -377,29 +407,22 @@ struct tst_ulimit_val {* * @dev_min_size: A minimal device size in megabytes. * -* @dev_fs_type: If set overrides the default file system type for the device and -* sets the tst_device.fs_type. -* -* @dev_fs_opts: A NULL terminated array of options passed to mkfs in the case -* of 'tst_test.format_device'. These options are passed to mkfs -* before the device path. -* -* @dev_extra_opts: A NULL terminated array of extra options passed to mkfs in -* the case of 'tst_test.format_device'. Extra options are -* passed to mkfs after the device path. Commonly the option -* after mkfs is the number of blocks and can be used to limit -* the file system not to use the whole block device. +* @filesystems: A NULL type terminated array of per file system type +* parameters for mkfs and mount. If the first entry type is NULL +* it describes a default parameters for all file system tests. +* The rest of the entries the describes per file system type +* parameters. If tst_test.all_filesystems is set, the test runs +* for all filesystems and uses the array to lookup the mkfs +* and mount options. If tst_test.all_filesystems is not set +* the test iterates over file system types defined in the array. +* If there is only a single entry in the array with a NULL type, +* the test runs just once for the default file sytem i.e. +* $TST_FS_TYPE. * * @mntpoint: A mount point where the test library mounts requested file system. * The directory is created by the library, the test must not create * it itself. * -* @mnt_flags: MS_* flags passed to mount(2) when the test library mounts a -* device in the case of 'tst_test.mount_device'. -* -* @mnt_data: The data passed to mount(2) when the test library mounts a device -* in the case of 'tst_test.mount_device'. -* * @max_runtime: Maximal test runtime in seconds. Any test that runs for more * than a second or two should set this and also use * tst_remaining_runtime() to exit when runtime was used up.
@@ -516,14 +539,9 @@ struct tst_ulimit_val {unsigned int dev_min_size; -const char *dev_fs_type; - -const char *const *dev_fs_opts; -const char *const *dev_extra_opts; +struct tst_fs *filesystems;const char *mntpoint; -unsigned int mnt_flags; -void *mnt_data;int max_runtime;
lib/tst_test.c +93 -24
169 lines not on this page · raw message
testcases/kernel/syscalls/fanotify/fanotify22.c +4 -1
@@ -319,7 +319,10 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = MOUNT_PATH, .needs_root = 1, - .dev_fs_type = "ext4", + .filesystems = (struct tst_fs []){ + {.type ="ext4" }, + {} + }, .tags = (const struct tst_tag []) { {"linux-git" ,"124e7c61deb2" }, {}
testcases/kernel/syscalls/fanotify/fanotify23.c +4 -1
@@ -256,7 +256,10 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = MOUNT_PATH,/* Shrinkers on other fs do not work reliably enough to guarantee mark eviction on drop_caches */ - .dev_fs_type = "ext2", + .filesystems = (struct tst_fs []){ + {.type ="ext2" }, + {} + }, };#else
testcases/kernel/syscalls/getxattr/getxattr04.c +4 -1
@@ -105,7 +105,10 @@ static void setup(void)static struct tst_test test = { .needs_root =1 , .mount_device =1 , - .dev_fs_type ="xfs" , + .filesystems = (struct tst_fs []){ + {.type ="xfs" }, + {} + }, .mntpoint =MNTPOINT , .forks_child =1 , .test_all = verify_getxattr,
testcases/kernel/syscalls/ioctl/ioctl08.c +4 -1
@@ -126,7 +126,10 @@ static struct tst_test test = { .needs_root = 1, .mount_device = 1, .mntpoint = MNTPOINT, - .dev_fs_type = "btrfs", + .filesystems = (struct tst_fs []) { + {.type ="btrfs" }, + {} + }, .needs_drivers = (const char *const []) {"btrfs" ,NULL ,
testcases/kernel/syscalls/mmap/mmap16.c +9 -13
@@ -176,19 +176,15 @@ static struct tst_test test = { .needs_checkpoints = 1, .mount_device = 1, .mntpoint = MNTPOINT, - .dev_fs_type = "ext4", - .dev_fs_opts = (const char *const []){ -"-b" , -"1024" , -NULL , - }, - .dev_extra_opts = (const char *const []){ -"10240" , -NULL , - }, - .needs_cmds = (const char *const []){ -"mkfs.ext4" , -NULL , + .filesystems = (struct tst_fs []) { + { + .type ="ext4" , + .mkfs_opts = (const char *const []){ +"-b" ,"1024" ,NULL + }, + .mkfs_size_opt ="10240" , + }, + {} }, .tags = (const struct tst_tag []){ {"linux-git" ,"d6320cbfc929" },
testcases/kernel/syscalls/quotactl/quotactl01.c +7 -2
@@ -216,9 +216,14 @@ static struct tst_test test = { .test = verify_quota, .tcnt = ARRAY_SIZE(tcases), .mount_device = 1, - .dev_fs_type = "ext4", + .filesystems = (struct tst_fs []) { + { + .type ="ext4" , + .mnt_data ="usrquota,grpquota" , + }, + {} + }, .mntpoint = MNTPOINT, - .mnt_data = "usrquota,grpquota", .needs_cmds = (const char *const []) {"quotacheck" ,NULL
testcases/kernel/syscalls/quotactl/quotactl02.c +7 -2
@@ -150,9 +150,14 @@ static struct tst_test test = { .test = verify_quota, .tcnt = ARRAY_SIZE(tcases), .mount_device = 1, - .dev_fs_type = "xfs", + .filesystems = (struct tst_fs []) { + { + .type ="xfs" , + .mnt_data ="usrquota,grpquota" , + }, + {} + }, .mntpoint = MNTPOINT, - .mnt_data = "usrquota,grpquota", .setup = setup, .cleanup = cleanup, .test_variants = QUOTACTL_SYSCALL_VARIANTS,
testcases/kernel/syscalls/quotactl/quotactl03.c +7 -2
@@ -83,9 +83,14 @@ static struct tst_test test = { }, .test_all = verify_quota, .mount_device = 1, - .dev_fs_type = "xfs", + .filesystems = (struct tst_fs []) { + { + .type ="xfs" , + .mnt_data ="usrquota" , + }, + {} + }, .mntpoint = MNTPOINT, - .mnt_data = "usrquota", .test_variants = QUOTACTL_SYSCALL_VARIANTS, .tags = (const struct tst_tag []) { {"linux-git" ,"657bdfb7f5e6" },
testcases/kernel/syscalls/quotactl/quotactl04.c +4 -1
@@ -162,7 +162,10 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .needs_device = 1, - .dev_fs_type = "ext4", + .filesystems = (struct tst_fs []) { + {.type ="ext4" }, + {} + }, .mntpoint = MNTPOINT, .test_variants = QUOTACTL_SYSCALL_VARIANTS, .needs_cmds = (const char *[]) {
testcases/kernel/syscalls/quotactl/quotactl05.c +7 -2
@@ -113,9 +113,14 @@ static struct tst_test test = { .test = verify_quota, .tcnt = ARRAY_SIZE(tcases), .mount_device = 1, - .dev_fs_type = "xfs", + .filesystems = (struct tst_fs []) { + { + .type ="xfs" , + .mnt_data ="prjquota" , + }, + {} + }, .mntpoint = MNTPOINT, - .mnt_data = "prjquota", .setup = setup, .cleanup = cleanup, .test_variants = QUOTACTL_SYSCALL_VARIANTS,
testcases/kernel/syscalls/quotactl/quotactl06.c +7 -2
@@ -219,10 +219,15 @@ static struct tst_test test = { }, .tcnt = ARRAY_SIZE(tcases), .test = verify_quotactl, - .dev_fs_type = "ext4", + .filesystems = (struct tst_fs []) { + { + .type ="ext4" , + .mnt_data ="usrquota" , + }, + {} + }, .mntpoint = MNTPOINT, .mount_device = 1, - .mnt_data = "usrquota", .needs_cmds = (const char *const []) {"quotacheck" ,NULL
testcases/kernel/syscalls/quotactl/quotactl07.c +4 -1
@@ -83,7 +83,10 @@ static struct tst_test test = { }, .test_all = verify_quota, .format_device = 1, - .dev_fs_type = "xfs", + .filesystems = (struct tst_fs []) { + {.type ="xfs" }, + {} + }, .mntpoint = MNTPOINT, .test_variants = QUOTACTL_SYSCALL_VARIANTS, .tags = (const struct tst_tag []) {
testcases/kernel/syscalls/quotactl/quotactl08.c +4 -1
@@ -216,7 +216,10 @@ static struct tst_test test = { .test = verify_quota, .tcnt = ARRAY_SIZE(tcases), .mntpoint = MNTPOINT, - .dev_fs_type = "ext4", + .filesystems = (struct tst_fs []) { + {.type ="ext4" }, + {} + }, .needs_device = 1, .setup = setup, .cleanup = cleanup,
testcases/kernel/syscalls/quotactl/quotactl09.c +7 -2
@@ -176,8 +176,13 @@ static struct tst_test test = { }, .tcnt = ARRAY_SIZE(tcases), .test = verify_quotactl, - .dev_fs_opts = (const char *const[]){"-O quota", NULL}, - .dev_fs_type = "ext4", + .filesystems = (struct tst_fs []) { + { + .type ="ext4" , + .mkfs_opts = (const char *const []){"-O quota" ,NULL }, + }, + {} + }, .mntpoint = MNTPOINT, .mount_device = 1, .needs_root = 1,
testcases/kernel/syscalls/statx/statx05.c +4 -1
@@ -121,7 +121,10 @@ static struct tst_test test = { .needs_root = 1, .needs_device = 1, .mntpoint = MNTPOINT, - .dev_fs_type = "ext4", + .filesystems = (struct tst_fs []) { + {.type ="ext4" }, + {} + }, .needs_cmds = (const char *[]) {"mkfs.ext4 >= 1.43.0" ,"e4crypt" ,
testcases/kernel/syscalls/statx/statx06.c +8 -3
@@ -155,7 +155,12 @@ static struct tst_test test = { .needs_root = 1, .mntpoint = MOUNT_POINT, .mount_device = 1, - .dev_fs_type = "ext4", - .dev_fs_opts = (const char *const []){"-I", "256", NULL}, - .mnt_flags = MS_STRICTATIME, + .filesystems = (struct tst_fs []) { + { + .type ="ext4" , + .mkfs_opts = (const char *const []){"-I" ,"256" ,NULL }, + .mnt_flags =MS_STRICTATIME , + }, + {} + }, };
testcases/kernel/syscalls/statx/statx07.c +4 -1
@@ -168,7 +168,10 @@ static struct tst_test test = { .cleanup = cleanup, .min_kver = "4.16", .needs_tmpdir = 1, - .dev_fs_type = "nfs", + .filesystems = (struct tst_fs []) { + {.type ="nfs" }, + {} + }, .needs_root = 1, .needs_cmds = (const char *[]) {"exportfs" ,
testcases/kernel/syscalls/statx/statx09.c +4 -1
@@ -156,7 +156,10 @@ static struct tst_test test = { .needs_root = 1, .needs_device = 1, .mntpoint = MNTPOINT, - .dev_fs_type = "ext4", + .filesystems = (struct tst_fs []) { + {.type ="ext4" }, + {} + }, .needs_kconfigs = (const char *[]) {"CONFIG_FS_VERITY" ,NULL
Signature · 5 lines
2.44.2 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 1/2] lib: tst_test: Add per filesystem mkfs and mount opts
Hi,
include/tst_test.h struct tst_ulimit_val { · line 381
Quoted 9 lines
/**
* structtst_test- A test description.
*include/tst_test.h +0
-2@@ -377,29 +407,22 @@ struct tst_ulimit_val {* * @dev_min_size: A minimal device size in megabytes. * -* @dev_fs_type: If set overrides the default file system type for the device and -* sets the tst_device.fs_type.
* @format_device: Does all tst_test.needs_device would do and also formats
* the device with tst_test.dev_fs_type file system as well.
We should also update 'format_device' documentation according to these changes.
Quoted 5 lines
include/tst_test.h +0
-5-* -* @dev_fs_opts: A NULL terminated array of options passed to mkfs in the case -* of 'tst_test.format_device'. These options are passed to mkfs -* before the device path. -*
...
...
lib/tst_test.c static void set_ulimit_(const char *file, const int lineno, const struct tst_uli · line 1171
Quoted 13 lines
lib/tst_test.c +9
-0@@ -1160,6 +1160,38 @@ static void set_ulimit_(const char *file, const int lineno, const struct tst_ulisafe_setrlimit (file, lineno, conf->resource, &rlim); } +static unsigned int count_fs_descs (void ) +{ +unsigned int ret =0 ; + +if (!tst_test->filesystems) +return 0 ; + +/* +* First entry is special, if it has zero type is the it's the default
this sentence seems a bit off.
with these,
for both patches.
lib/tst_test.c static void set_ulimit_(const char *file, const int lineno, const struct tst_uli · line 1183
Quoted 12 lines
lib/tst_test.c +12
-0+* entry and is either followed by a terminating entry or by filesystem +* description(s) plus terminating entry. +*/ +if (!tst_test->filesystems[0 ].type) + ret =1 ; + +while (tst_test->filesystems[ret].type) + ret++; + +return ret; +} +
Regards,
Avinesh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 1/2] lib: tst_test: Add per filesystem mkfs and mount opts
Hi!
Quoted 4 lines
Quoted 4 lines
/**
* structtst_test- A test description.
*(quoted diff) +0
-0@@ -377,29 +407,22 @@ struct tst_ulimit_val {
Quoted 8 lines
include/tst_test.h struct tst_ulimit_val { · line 381
Quoted 5 lines
include/tst_test.h +0
-2* * @dev_min_size: A minimal device size in megabytes. * -* @dev_fs_type: If set overrides the default file system type for the device and -* sets the tst_device.fs_type. * @format_device: Does all tst_test.needs_device would do and also formats
* the device with tst_test.dev_fs_type file system as well.
We should also update 'format_device' documentation according to these changes.
I've removed the tst_test.dev_fs_type and kept it just as "... with file system as well."
Quoted 22 lines
Quoted 5 lines
include/tst_test.h +0
-5-* -* @dev_fs_opts: A NULL terminated array of options passed to mkfs in the case -* of 'tst_test.format_device'. These options are passed to mkfs -* before the device path. -* ...
...lib/tst_test.c static void set_ulimit_(const char *file, const int lineno, const struct tst_uli · line 1171
Quoted 13 lines
lib/tst_test.c +9
-0@@ -1160,6 +1160,38 @@ static void set_ulimit_(const char *file, const int lineno, const struct tst_ulisafe_setrlimit (file, lineno, conf->resource, &rlim); } +static unsigned int count_fs_descs (void ) +{ +unsigned int ret =0 ; + +if (!tst_test->filesystems) +return 0 ; + +/* +* First entry is special, if it has zero type is the it's the default this sentence seems a bit off.
Quoted 3 lines
with these,
Reviewed-by Avinesh Kumar <[email protected]>for both patches.
Fixed this one as well and pushed.
Thanks everyone for the reviews!
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 1/2] lib: tst_test: Add per filesystem mkfs and mount opts
In reply to Cyril HrubisHi Cyril, all,
Quoted 10 lines
This commit does:
* Group the filesystem type, mkfs and mount options into a separate structure
* Add an array of these structures to be able to define per filesystem mkfs and mount options
The details on the usage should be hopefully clear from the documentation comments for the struct
tst_test.
FYI, this merged as cce6188916 ("lib: tst_test: Add per filesystem mkfs and mount opts") causes this behavior of none testing run when there is no suitable filesystem. I found it when trying to bisect something with rapido-linux and compile kernel without Btrfs and XFS. Don't we want to add some TCONF?
Kind regards,
Petr
ioctl_ficlone03.c:
.filesystems = (struct tst_fs []) {
{.type = "btrfs"},
{.type = "bcachefs"},
{
.type = "xfs",
.min_kver = "4.16",
.mkfs_ver = "mkfs.xfs >= 1.5.0",
.mkfs_opts = (const char *const []) {"-m", "reflink=1", NULL},
},
{}
},rapido1:/opt/ltp/testcases/bin# ./ioctl_ficlone03; echo $? tst_buffers.c:57: TINFO: Test is using guarded buffers tst_tmpdir.c:317: TINFO: Using /tmp/LTP_iocSKLS9l as tmpdir (tmpfs filesystem) tst_device.c:99: TINFO: Found free device 0 '/dev/loop0' tst_test.c:1900: TINFO: LTP version: 20250130-166-g17960d952 tst_test.c:1904: TINFO: Tested kernel: 4.5.0-00002-g22bd332f11d4 #162 SMP Thu Mar 20 18:00:10 CET 2025 x86_64 tst_kconfig.c:88: TINFO: Parsing kernel config '/.config' tst_test.c:1724: TINFO: Overall timeout per run is 0h 00m 31s tst_supported_fs_types.c:97: TINFO: Kernel supports ext2 tst_supported_fs_types.c:62: TINFO: mkfs.ext2 does exist tst_supported_fs_types.c:97: TINFO: Kernel supports ext3 tst_supported_fs_types.c:62: TINFO: mkfs.ext3 does exist tst_supported_fs_types.c:97: TINFO: Kernel supports ext4 tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist tst_supported_fs_types.c:105: TINFO: Skipping bcachefs because of FUSE blacklist tst_supported_fs_types.c:97: TINFO: Kernel supports vfat tst_supported_fs_types.c:62: TINFO: mkfs.vfat does exist tst_supported_fs_types.c:97: TINFO: Kernel supports tmpfs tst_supported_fs_types.c:49: TINFO: mkfs is not needed for tmpfs
Summary:
passed 0 failed 0 broken 0 skipped 0
warnings 0
0
rapido1:/opt/ltp/testcases/bin# grep -e CONFIG_BTRFS_FS -e CONFIG_XFS_FS /.config + grep -e CONFIG_BTRFS_FS -e CONFIG_XFS_FS /.config # CONFIG_XFS_FS is not set # CONFIG_BTRFS_FS is not set
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 1/2] lib: tst_test: Add per filesystem mkfs and mount opts
Quoted 13 lines · Petr Vorel
Hi Cyril, all,
Quoted 10 lines
This commit does:
* Group the filesystem type, mkfs and mount options into a separate structure
* Add an array of these structures to be able to define per filesystem mkfs and mount options
The details on the usage should be hopefully clear from the documentation comments for the struct
tst_test.
Quoted 7 lines
FYI, this merged as
cce6188916("lib:tst_test: Add per filesystem mkfs and mount opts") causes this behavior of none testing run when there is no suitable
filesystem. I found it when trying to bisect something with rapido-linux and
compile kernel without Btrfs and XFS. Don't we want to add some TCONF?
I think we need TCONF there. Can you confirm below change makes sense?
lib/tst_test.c +0 -0
@@ -1856,6 +1856,7 @@ static int run_tcases_per_fs(void)int ret =0 ;unsigned int i; const char *const *filesystems =
tst_get_supported_fs_types(tst_test->skip_filesystems);
+ bool found_valid_fs = false;
if (!filesystems[0])
tst_brk(TCONF, "There are no supported filesystems");
@@ -1866,6 +1867,7 @@ static int run_tcases_per_fs(void)
if (!fs)
continue;+ found_valid_fs = true;
ret = run_tcase_on_fs(fs, filesystems[i]);
if (ret == TCONF)
@@ -1877,6 +1879,9 @@ static int run_tcases_per_fs(void)
do_exit(ret);
}+ if (!found_valid_fs)
+ tst_brk(TCONF, "No required filesystems are available");
+
return ret;
}
Quoted 56 lines
Kind regards,
Petr
ioctl_ficlone03.c:.filesystems = (struct tst_fs []) { {.type = "btrfs"}, {.type = "bcachefs"}, { .type = "xfs", .min_kver = "4.16", .mkfs_ver = "mkfs.xfs >= 1.5.0", .mkfs_opts = (const char *const []) {"-m", "reflink=1", NULL}, }, {} },rapido1:/opt/ltp/testcases/bin# ./ioctl_ficlone03; echo $? tst_buffers.c:57: TINFO: Test is using guarded buffers tst_tmpdir.c:317: TINFO: Using /tmp/LTP_iocSKLS9l as tmpdir (tmpfs filesystem) tst_device.c:99: TINFO: Found free device 0 '/dev/loop0' tst_test.c:1900: TINFO: LTP version: 20250130-166-g17960d952 tst_test.c:1904: TINFO: Tested kernel: 4.5.0-00002-g22bd332f11d4 #162 SMP Thu Mar 20 18:00:10 CET 2025 x86_64 tst_kconfig.c:88: TINFO: Parsing kernel config '/.config' tst_test.c:1724: TINFO: Overall timeout per run is 0h 00m 31s tst_supported_fs_types.c:97: TINFO: Kernel supports ext2 tst_supported_fs_types.c:62: TINFO: mkfs.ext2 does exist tst_supported_fs_types.c:97: TINFO: Kernel supports ext3 tst_supported_fs_types.c:62: TINFO: mkfs.ext3 does exist tst_supported_fs_types.c:97: TINFO: Kernel supports ext4 tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist tst_supported_fs_types.c:105: TINFO: Skipping bcachefs because of FUSE blacklist tst_supported_fs_types.c:97: TINFO: Kernel supports vfat tst_supported_fs_types.c:62: TINFO: mkfs.vfat does exist tst_supported_fs_types.c:97: TINFO: Kernel supports tmpfs tst_supported_fs_types.c:49: TINFO: mkfs is not needed for tmpfsSummary:
passed 0 failed 0 broken 0 skipped 0warnings 0
0rapido1:/opt/ltp/testcases/bin# grep -e CONFIG_BTRFS_FS -e CONFIG_XFS_FS /.config + grep -e CONFIG_BTRFS_FS -e CONFIG_XFS_FS /.config # CONFIG_XFS_FS is not set # CONFIG_BTRFS_FS is not set
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 1/2] lib: tst_test: Add per filesystem mkfs and mount opts
Hi Li,
Quoted 23 lines · Petr Vorel
Quoted 14 lines
Hi Cyril, all,
Quoted 10 lines
This commit does:
* Group the filesystem type, mkfs and mount options into a separate structure
* Add an array of these structures to be able to define per filesystem mkfs and mount options
The details on the usage should be hopefully clear from the documentation comments for the struct
tst_test.Quoted 6 lines
FYI, this merged as
cce6188916("lib:tst_test: Add per filesystem mkfs and mount opts") causes this behavior of none testing run when there is no suitable
filesystem. I found it when trying to bisect something with rapido-linux and
compile kernel without Btrfs and XFS. Don't we want to add some TCONF?
Quoted 1 line
I think we need TCONF there. Can you confirm below change makes sense?
Thanks! LGTM (untested). Can you please send a patch? (I'll test it).
Kind regards,
Petr
Quoted 85 lines
lib/tst_test.c +1
-0@@ -1856,6 +1856,7 @@ static int run_tcases_per_fs(void)int ret =0 ;unsigned int i;const char *const *filesystems =tst_get_supported_fs_types (tst_test->skip_filesystems); +bool found_valid_fs = false;if (!filesystems[0 ])tst_brk(TCONF, "There are no supported filesystems");lib/tst_test.c +4
-0@@ -1866,6 +1867,7 @@ static int run_tcases_per_fs(void)if (!fs)continue ; + found_valid_fs = true; ret =run_tcase_on_fs (fs, filesystems[i]);if (ret ==TCONF )@@ -1877,6 +1879,9 @@ static int run_tcases_per_fs(void)do_exit (ret); } +if (!found_valid_fs) +tst_brk (TCONF ,"No required filesystems are available" ); +return ret; }Quoted 56 lines
Kind regards,
Petr
ioctl_ficlone03.c:.filesystems = (struct tst_fs []) { {.type = "btrfs"}, {.type = "bcachefs"}, { .type = "xfs", .min_kver = "4.16", .mkfs_ver = "mkfs.xfs >= 1.5.0", .mkfs_opts = (const char *const []) {"-m", "reflink=1", NULL}, }, {} },rapido1:/opt/ltp/testcases/bin# ./ioctl_ficlone03; echo $? tst_buffers.c:57: TINFO: Test is using guarded buffers tst_tmpdir.c:317: TINFO: Using /tmp/LTP_iocSKLS9l as tmpdir (tmpfs filesystem) tst_device.c:99: TINFO: Found free device 0 '/dev/loop0' tst_test.c:1900: TINFO: LTP version: 20250130-166-g17960d952 tst_test.c:1904: TINFO: Tested kernel: 4.5.0-00002-g22bd332f11d4 #162 SMP Thu Mar 20 18:00:10 CET 2025 x86_64 tst_kconfig.c:88: TINFO: Parsing kernel config '/.config' tst_test.c:1724: TINFO: Overall timeout per run is 0h 00m 31s tst_supported_fs_types.c:97: TINFO: Kernel supports ext2 tst_supported_fs_types.c:62: TINFO: mkfs.ext2 does exist tst_supported_fs_types.c:97: TINFO: Kernel supports ext3 tst_supported_fs_types.c:62: TINFO: mkfs.ext3 does exist tst_supported_fs_types.c:97: TINFO: Kernel supports ext4 tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist tst_supported_fs_types.c:105: TINFO: Skipping bcachefs because of FUSE blacklist tst_supported_fs_types.c:97: TINFO: Kernel supports vfat tst_supported_fs_types.c:62: TINFO: mkfs.vfat does exist tst_supported_fs_types.c:97: TINFO: Kernel supports tmpfs tst_supported_fs_types.c:49: TINFO: mkfs is not needed for tmpfsSummary:
passed 0 failed 0 broken 0 skipped 0warnings 0
0rapido1:/opt/ltp/testcases/bin# grep -e CONFIG_BTRFS_FS -e CONFIG_XFS_FS /.config + grep -e CONFIG_BTRFS_FS -e CONFIG_XFS_FS /.config # CONFIG_XFS_FS is not set # CONFIG_BTRFS_FS is not set
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH v2 1/2] lib: tst_test: Add per filesystem mkfs and mount opts
Quoted 23 lines · Petr Vorel
Hi Li,
Quoted 10 lines · Petr Vorel
Quoted 9 lines
Hi Cyril, all,
Quoted 6 lines
This commit does:
* Group the filesystem type, mkfs and mount options into a separate structure
* Add an array of these structures to be able to define per
filesystem
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
mkfs and mount options
The details on the usage should be hopefully clear from the documentation comments for the struct
tst_test.FYI, this merged as
cce6188916("lib:tst_test: Add per filesystemmkfs and
Quoted 3 lines
Quoted 3 lines
mount opts") causes this behavior of none testing run when there is no suitable
filesystem. I found it when trying to bisect something with
Quoted 9 lines
rapido-linux
Quoted 5 lines
Quoted 2 lines
and
compile kernel without Btrfs and XFS. Don't we want to add some TCONF?I think we need TCONF there. Can you confirm below change makes sense?
Thanks! LGTM (untested). Can you please send a patch? (I'll test it).
See: https://lists.linux.it/pipermail/ltp/2025-March/042723.html
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 2/2 syscalls: quotactl: Move mkfs opts into tst_test
In reply to Cyril Hrubis--- .../kernel/syscalls/quotactl/quotactl04.c | 19 +++++++++---------- .../kernel/syscalls/quotactl/quotactl08.c | 19 ++++++++----------- 2 files changed, 17 insertions(+), 21 deletions(-)
testcases/kernel/syscalls/quotactl/quotactl04.c +9 -10
@@ -32,7 +32,7 @@#define FMTID QFMT_VFS_V1static 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
@@ -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,
@@ -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)
@@ -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,
testcases/kernel/syscalls/quotactl/quotactl08.c +8 -11
@@ -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
@@ -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));
@@ -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)
@@ -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,
Signature · 5 lines
2.44.2 -- Mailing list info: https://lists.linux.it/listinfo/ltp