[LTP] [PATCH 1/1] statx09: Format filesystem with page size
Petr Vorel
pvorel@suse.cz
Mon Jul 17 14:54:13 CEST 2023
This fixes statx09.c for kernel < 6.3. Previously test was skipped:
statx09.c:126: TCONF: fs-verity not supported on loopdev, due the
default block size, which is for our 300 MB loop device 1024.
This is a follow up of previous fix 2e582e743 ("statx09: Set fs-verity
blocksize to FS blocksize") for kernel >= 6.3.
Suggested-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/kernel/syscalls/statx/statx09.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/statx/statx09.c b/testcases/kernel/syscalls/statx/statx09.c
index 7211d8393..6e75ff3ec 100644
--- a/testcases/kernel/syscalls/statx/statx09.c
+++ b/testcases/kernel/syscalls/statx/statx09.c
@@ -20,6 +20,7 @@
#define _GNU_SOURCE
#include <sys/mount.h>
#include <stdlib.h>
+#include <stdio.h>
#include "tst_test.h"
#include "lapi/fs.h"
#include "lapi/fsverity.h"
@@ -120,6 +121,12 @@ static void flag_setup(void)
static void setup(void)
{
+ char opt_bsize[32];
+ const char *const fs_opts[] = {"-O verity", opt_bsize, NULL};
+
+ snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", getpagesize());
+ SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
+
TEST(mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL));
if (TST_RET) {
if (TST_ERR == EINVAL)
@@ -147,10 +154,9 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.needs_root = 1,
+ .needs_device = 1,
.mntpoint = MNTPOINT,
- .format_device = 1,
.dev_fs_type = "ext4",
- .dev_fs_opts = (const char *const []){"-O verity", NULL},
.needs_kconfigs = (const char *[]) {
"CONFIG_FS_VERITY",
NULL
--
2.40.1
More information about the ltp
mailing list