All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/3] Add proper filesystem skiplist
@ 2021-03-10 12:26 Cyril Hrubis
  2021-03-10 12:26 ` [LTP] [PATCH 1/3] lib: " Cyril Hrubis
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Cyril Hrubis @ 2021-03-10 12:26 UTC (permalink / raw)
  To: ltp

This adds a proper .skip_filesystems array to the tst_test structure and
implements support for both test with .all_filesystems enabled and
disabled.

As a bonus point we get the list of filesystems that the test does not
support exported to the metadata as well.

Cyril Hrubis (3):
  lib: Add proper filesystem skiplist
  lib: tst_fs_type change fs names to lowercase
  lib: Apply the skip_filesystems to rest of test as well

 include/tst_fs.h                              | 19 +++++++---
 include/tst_test.h                            |  9 +++--
 lib/tst_fs_type.c                             | 36 +++++++++----------
 lib/tst_supported_fs_types.c                  | 35 +++++++++++++-----
 lib/tst_test.c                                | 12 ++++++-
 testcases/kernel/syscalls/fcntl/fcntl33.c     | 19 ++++------
 .../kernel/syscalls/fsconfig/fsconfig01.c     |  2 +-
 testcases/kernel/syscalls/fsmount/fsmount01.c |  2 +-
 testcases/kernel/syscalls/fsmount/fsmount02.c |  2 +-
 testcases/kernel/syscalls/fsopen/fsopen01.c   |  2 +-
 testcases/kernel/syscalls/fspick/fspick01.c   |  2 +-
 testcases/kernel/syscalls/fspick/fspick02.c   |  2 +-
 .../kernel/syscalls/ioctl/ioctl_loop05.c      | 11 +++---
 .../kernel/syscalls/move_mount/move_mount01.c |  2 +-
 .../kernel/syscalls/move_mount/move_mount02.c |  2 +-
 .../kernel/syscalls/open_tree/open_tree01.c   |  2 +-
 .../kernel/syscalls/open_tree/open_tree02.c   |  2 +-
 .../sync_file_range/sync_file_range02.c       |  2 +-
 .../kernel/syscalls/vmsplice/vmsplice01.c     |  9 +++--
 .../kernel/syscalls/vmsplice/vmsplice02.c     |  9 +++--
 testcases/lib/tst_supported_fs.c              |  4 +--
 21 files changed, 111 insertions(+), 74 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 1/3] lib: Add proper filesystem skiplist
  2021-03-10 12:26 [LTP] [PATCH 0/3] Add proper filesystem skiplist Cyril Hrubis
@ 2021-03-10 12:26 ` Cyril Hrubis
  2021-03-10 12:58   ` Petr Vorel
  2021-03-10 16:19   ` Martin Doucha
  2021-03-10 12:26 ` [LTP] [PATCH 2/3] lib: tst_fs_type change fs names to lowercase Cyril Hrubis
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 15+ messages in thread
From: Cyril Hrubis @ 2021-03-10 12:26 UTC (permalink / raw)
  To: ltp

The approach with flags we added for FUSE does not scale at all, we need
a proper skiplist so that we can skip individual filesystems.

The motivation here is the addition of tmpfs to the supported
filesystems check. One of the problems there is that sync() is no-op on
tmpfs and hence the syncfs test fails. After this patchset we can simply
skip syncfs test on tmpfs by setting the right skiplist.

As a bonus point the list of unsupported filesystem gets nicely
propagated to the metadata as well.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 include/tst_fs.h                              | 19 +++++++---
 include/tst_test.h                            |  9 +++--
 lib/tst_supported_fs_types.c                  | 35 ++++++++++++++-----
 lib/tst_test.c                                |  2 +-
 .../kernel/syscalls/fsconfig/fsconfig01.c     |  2 +-
 testcases/kernel/syscalls/fsmount/fsmount01.c |  2 +-
 testcases/kernel/syscalls/fsmount/fsmount02.c |  2 +-
 testcases/kernel/syscalls/fsopen/fsopen01.c   |  2 +-
 testcases/kernel/syscalls/fspick/fspick01.c   |  2 +-
 testcases/kernel/syscalls/fspick/fspick02.c   |  2 +-
 .../kernel/syscalls/move_mount/move_mount01.c |  2 +-
 .../kernel/syscalls/move_mount/move_mount02.c |  2 +-
 .../kernel/syscalls/open_tree/open_tree01.c   |  2 +-
 .../kernel/syscalls/open_tree/open_tree02.c   |  2 +-
 .../sync_file_range/sync_file_range02.c       |  2 +-
 testcases/lib/tst_supported_fs.c              |  4 +--
 16 files changed, 63 insertions(+), 28 deletions(-)

diff --git a/include/tst_fs.h b/include/tst_fs.h
index 4f7dd68d2..0b2732a19 100644
--- a/include/tst_fs.h
+++ b/include/tst_fs.h
@@ -167,18 +167,29 @@ int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount);
  */
 int tst_prealloc_file(const char *path, size_t bs, size_t bcount);
 
-#define TST_FS_SKIP_FUSE 0x01
-
 /*
  * Return 1 if a specified fiilsystem is supported
  * Return 0 if a specified fiilsystem isn't supported
+ *
+ * @fs_type A filesystem type to check the support for.
+ * @skiplist A NULL terminated array of filesystems to skip.
  */
-int tst_fs_is_supported(const char *fs_type, int flags);
+int tst_fs_is_supported(const char *fs_type, const char *const *skiplist);
 
 /*
  * Returns NULL-terminated array of kernel-supported filesystems.
+ *
+ * @skiplist A NULL terminated array of filesystems to skip.
+ */
+const char **tst_get_supported_fs_types(const char *const *skiplist);
+
+/*
+ * Returns 1 if filesystem is in skiplist 0 otherwise.
+ *
+ * @fs_type A filesystem type to lookup.
+ * @skiplist A NULL terminated array of fileystemsytems to skip.
  */
-const char **tst_get_supported_fs_types(int flags);
+int tst_fs_in_skiplist(const char *fs_type, const char *const *skiplist);
 
 /*
  * Creates and writes to files on given path until write fails with ENOSPC
diff --git a/include/tst_test.h b/include/tst_test.h
index 1fbebe752..4eee6f897 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -159,6 +159,13 @@ struct tst_test {
 	 */
 	int all_filesystems:1;
 
+	/*
+	 * The skip_filesystem is a NULL terminated list of filesystems the
+	 * test does not support. It can also be used to disable whole class of
+	 * filesystems with a special keyworks such as "fuse".
+	 */
+	const char *const *skip_filesystems;
+
 	/* Minimum number of online CPU required by the test */
 	unsigned long min_cpus;
 
@@ -197,8 +204,6 @@ struct tst_test {
 
 	/* Device filesystem type override NULL == default */
 	const char *dev_fs_type;
-	/* Flags to be passed to tst_get_supported_fs_types() */
-	int dev_fs_flags;
 
 	/* Options passed to SAFE_MKFS() when format_device is set */
 	const char *const *dev_fs_opts;
diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
index 00ede549d..cd505f570 100644
--- a/lib/tst_supported_fs_types.c
+++ b/lib/tst_supported_fs_types.c
@@ -45,13 +45,34 @@ static int has_mkfs(const char *fs_type)
 	return 1;
 }
 
-static int has_kernel_support(const char *fs_type, int flags)
+int tst_fs_in_skiplist(const char *fs_type, const char *const *skiplist)
+{
+	unsigned int i;
+
+	if (!skiplist)
+		return 0;
+
+	for (i = 0; skiplist[i]; i++) {
+		if (!strcmp(fs_type, skiplist[i])) {
+			tst_res(TINFO,
+			        "Skipping %s as requested by the test", fs_type);
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
+static int has_kernel_support(const char *fs_type, const char *const *skiplist)
 {
 	static int fuse_supported = -1;
 	const char *tmpdir = getenv("TMPDIR");
 	char buf[128];
 	int ret;
 
+	if (tst_fs_in_skiplist(fs_type, skiplist))
+		return 0;
+
 	if (!tmpdir)
 		tmpdir = "/tmp";
 
@@ -84,26 +105,24 @@ static int has_kernel_support(const char *fs_type, int flags)
 		return 0;
 	}
 
-	if (flags & TST_FS_SKIP_FUSE) {
-		tst_res(TINFO, "Skipping FUSE as requested by the test");
+	if (tst_fs_in_skiplist("fuse", skiplist))
 		return 0;
-	}
 
 	tst_res(TINFO, "FUSE does support %s", fs_type);
 	return 1;
 }
 
-int tst_fs_is_supported(const char *fs_type, int flags)
+int tst_fs_is_supported(const char *fs_type, const char *const *skiplist)
 {
-	return has_kernel_support(fs_type, flags) && has_mkfs(fs_type);
+	return has_kernel_support(fs_type, skiplist) && has_mkfs(fs_type);
 }
 
-const char **tst_get_supported_fs_types(int flags)
+const char **tst_get_supported_fs_types(const char *const *skiplist)
 {
 	unsigned int i, j = 0;
 
 	for (i = 0; fs_type_whitelist[i]; i++) {
-		if (tst_fs_is_supported(fs_type_whitelist[i], flags))
+		if (tst_fs_is_supported(fs_type_whitelist[i], skiplist))
 			fs_types[j++] = fs_type_whitelist[i];
 	}
 
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 6bbee030b..d056a32c6 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1344,7 +1344,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->dev_fs_flags);
+	const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);
 
 	if (!filesystems[0])
 		tst_brk(TCONF, "There are no supported filesystems");
diff --git a/testcases/kernel/syscalls/fsconfig/fsconfig01.c b/testcases/kernel/syscalls/fsconfig/fsconfig01.c
index 47941136d..a585daa6d 100644
--- a/testcases/kernel/syscalls/fsconfig/fsconfig01.c
+++ b/testcases/kernel/syscalls/fsconfig/fsconfig01.c
@@ -89,5 +89,5 @@ static struct tst_test test = {
 	.format_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/fsmount/fsmount01.c b/testcases/kernel/syscalls/fsmount/fsmount01.c
index e81981871..5f755863f 100644
--- a/testcases/kernel/syscalls/fsmount/fsmount01.c
+++ b/testcases/kernel/syscalls/fsmount/fsmount01.c
@@ -95,5 +95,5 @@ static struct tst_test test = {
 	.mntpoint = MNTPOINT,
 	.format_device = 1,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/fsmount/fsmount02.c b/testcases/kernel/syscalls/fsmount/fsmount02.c
index effc86351..a4f42dc18 100644
--- a/testcases/kernel/syscalls/fsmount/fsmount02.c
+++ b/testcases/kernel/syscalls/fsmount/fsmount02.c
@@ -76,5 +76,5 @@ static struct tst_test test = {
 	.mntpoint = MNTPOINT,
 	.format_device = 1,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/fsopen/fsopen01.c b/testcases/kernel/syscalls/fsopen/fsopen01.c
index 8dabd6814..c2c719c96 100644
--- a/testcases/kernel/syscalls/fsopen/fsopen01.c
+++ b/testcases/kernel/syscalls/fsopen/fsopen01.c
@@ -76,5 +76,5 @@ static struct tst_test test = {
 	.format_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/fspick/fspick01.c b/testcases/kernel/syscalls/fspick/fspick01.c
index 2f372f7f1..d3309a912 100644
--- a/testcases/kernel/syscalls/fspick/fspick01.c
+++ b/testcases/kernel/syscalls/fspick/fspick01.c
@@ -63,5 +63,5 @@ static struct tst_test test = {
 	.mount_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/fspick/fspick02.c b/testcases/kernel/syscalls/fspick/fspick02.c
index b9d020226..f9a3697c1 100644
--- a/testcases/kernel/syscalls/fspick/fspick02.c
+++ b/testcases/kernel/syscalls/fspick/fspick02.c
@@ -50,5 +50,5 @@ static struct tst_test test = {
 	.mount_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/move_mount/move_mount01.c b/testcases/kernel/syscalls/move_mount/move_mount01.c
index fd785da02..445e6197e 100644
--- a/testcases/kernel/syscalls/move_mount/move_mount01.c
+++ b/testcases/kernel/syscalls/move_mount/move_mount01.c
@@ -79,5 +79,5 @@ static struct tst_test test = {
 	.format_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/move_mount/move_mount02.c b/testcases/kernel/syscalls/move_mount/move_mount02.c
index f75991a3f..45b1db4be 100644
--- a/testcases/kernel/syscalls/move_mount/move_mount02.c
+++ b/testcases/kernel/syscalls/move_mount/move_mount02.c
@@ -88,5 +88,5 @@ static struct tst_test test = {
 	.format_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/open_tree/open_tree01.c b/testcases/kernel/syscalls/open_tree/open_tree01.c
index f217866bb..808d25665 100644
--- a/testcases/kernel/syscalls/open_tree/open_tree01.c
+++ b/testcases/kernel/syscalls/open_tree/open_tree01.c
@@ -70,5 +70,5 @@ static struct tst_test test = {
 	.mount_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/open_tree/open_tree02.c b/testcases/kernel/syscalls/open_tree/open_tree02.c
index 32ad1aefe..ddaa204f2 100644
--- a/testcases/kernel/syscalls/open_tree/open_tree02.c
+++ b/testcases/kernel/syscalls/open_tree/open_tree02.c
@@ -51,5 +51,5 @@ static struct tst_test test = {
 	.mount_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 };
diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
index 64d069e93..f68f46233 100644
--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
+++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
@@ -121,7 +121,7 @@ static struct tst_test test = {
 	.needs_root = 1,
 	.mount_device = 1,
 	.all_filesystems = 1,
-	.dev_fs_flags = TST_FS_SKIP_FUSE,
+	.skip_filesystems = (const char *const []){"fuse", NULL},
 	.mntpoint = MNTPOINT,
 	.setup = setup,
 	.test = run,
diff --git a/testcases/lib/tst_supported_fs.c b/testcases/lib/tst_supported_fs.c
index 022a61508..c7f0afe41 100644
--- a/testcases/lib/tst_supported_fs.c
+++ b/testcases/lib/tst_supported_fs.c
@@ -37,9 +37,9 @@ int main(int argc, char *argv[])
 	}
 
 	if (argv[1])
-		return !tst_fs_is_supported(argv[1], 0);
+		return !tst_fs_is_supported(argv[1], NULL);
 
-	filesystems = tst_get_supported_fs_types(0);
+	filesystems = tst_get_supported_fs_types(NULL);
 	for (i = 0; filesystems[i]; i++)
 		printf("%s\n", filesystems[i]);
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 2/3] lib: tst_fs_type change fs names to lowercase
  2021-03-10 12:26 [LTP] [PATCH 0/3] Add proper filesystem skiplist Cyril Hrubis
  2021-03-10 12:26 ` [LTP] [PATCH 1/3] lib: " Cyril Hrubis
@ 2021-03-10 12:26 ` Cyril Hrubis
  2021-03-10 12:26 ` [LTP] [PATCH 3/3] lib: Apply the skip_filesystems to rest of test as well Cyril Hrubis
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Cyril Hrubis @ 2021-03-10 12:26 UTC (permalink / raw)
  To: ltp

To make it consistent with the rest of the library.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_fs_type.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c
index d661d5b2a..8475f4c78 100644
--- a/lib/tst_fs_type.c
+++ b/lib/tst_fs_type.c
@@ -47,46 +47,46 @@ const char *tst_fs_type_name(long f_type)
 {
 	switch (f_type) {
 	case TST_TMPFS_MAGIC:
-		return "TMPFS";
+		return "tmpfs";
 	case TST_NFS_MAGIC:
-		return "NFS";
+		return "nfs";
 	case TST_V9FS_MAGIC:
-		return "9P";
+		return "9p";
 	case TST_RAMFS_MAGIC:
-		return "RAMFS";
+		return "ramfs";
 	case TST_BTRFS_MAGIC:
-		return "BTRFS";
+		return "btrfs";
 	case TST_XFS_MAGIC:
-		return "XFS";
+		return "xfs";
 	case TST_EXT2_OLD_MAGIC:
-		return "EXT2";
+		return "ext2";
 	case TST_EXT234_MAGIC:
-		return "EXT2/EXT3/EXT4";
+		return "ext2/ext3/ext4";
 	case TST_MINIX_MAGIC:
 	case TST_MINIX_MAGIC2:
 	case TST_MINIX2_MAGIC:
 	case TST_MINIX2_MAGIC2:
 	case TST_MINIX3_MAGIC:
-		return "MINIX";
+		return "minix";
 	case TST_UDF_MAGIC:
-		return "UDF";
+		return "udf";
 	case TST_SYSV2_MAGIC:
 	case TST_SYSV4_MAGIC:
-		return "SYSV";
+		return "sysv";
 	case TST_UFS_MAGIC:
 	case TST_UFS2_MAGIC:
-		return "UFS";
+		return "ufs";
 	case TST_F2FS_MAGIC:
-		return "F2FS";
+		return "f2fs";
 	case TST_NILFS_MAGIC:
-		return "NILFS";
+		return "nilfs";
 	case TST_EXOFS_MAGIC:
-		return "EXOFS";
+		return "exofs";
 	case TST_OVERLAYFS_MAGIC:
-		return "OVERLAYFS";
+		return "overlayfs";
 	case TST_FUSE_MAGIC:
-		return "FUSE";
+		return "fuse";
 	default:
-		return "Unknown";
+		return "unknown";
 	}
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 3/3] lib: Apply the skip_filesystems to rest of test as well
  2021-03-10 12:26 [LTP] [PATCH 0/3] Add proper filesystem skiplist Cyril Hrubis
  2021-03-10 12:26 ` [LTP] [PATCH 1/3] lib: " Cyril Hrubis
  2021-03-10 12:26 ` [LTP] [PATCH 2/3] lib: tst_fs_type change fs names to lowercase Cyril Hrubis
@ 2021-03-10 12:26 ` Cyril Hrubis
  2021-03-10 12:42 ` [LTP] [PATCH 0/3] Add proper filesystem skiplist Petr Vorel
  2021-03-10 12:55 ` Jan Stancek
  4 siblings, 0 replies; 15+ messages in thread
From: Cyril Hrubis @ 2021-03-10 12:26 UTC (permalink / raw)
  To: ltp

There is no reason to use the newly introduced .skip_filesystems only
for .all_filesystems tests.

So if .all_filesystems is not enabled and .skip_filesystems is set we
check if test temporary directory filesystem type is in the list of
supported filesystem types.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_test.c                                | 10 ++++++++++
 testcases/kernel/syscalls/fcntl/fcntl33.c     | 19 +++++++------------
 .../kernel/syscalls/ioctl/ioctl_loop05.c      | 11 +++++------
 .../kernel/syscalls/vmsplice/vmsplice01.c     |  9 ++++-----
 .../kernel/syscalls/vmsplice/vmsplice02.c     |  9 ++++-----
 5 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index d056a32c6..e756ef207 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1048,6 +1048,16 @@ static void do_test_setup(void)
 {
 	main_pid = getpid();
 
+	if (!tst_test->all_filesystems && tst_test->skip_filesystems) {
+		long fs_type = tst_fs_type(".");
+		const char *fs_name = tst_fs_type_name(fs_type);
+
+		if (tst_fs_in_skiplist(fs_name, tst_test->skip_filesystems))
+			tst_brk(TCONF, "Skipping due to unsupported filesystem");
+		else
+			tst_res(TINFO, "%s is supported by the test", fs_name);
+	}
+
 	if (tst_test->caps)
 		tst_cap_setup(tst_test->caps, TST_CAP_REQ);
 
diff --git a/testcases/kernel/syscalls/fcntl/fcntl33.c b/testcases/kernel/syscalls/fcntl/fcntl33.c
index 70d5ec5ff..8d0d1a5a1 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl33.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl33.c
@@ -81,17 +81,6 @@ static void setup(void)
 	SAFE_FILE_SCANF(PATH_LS_BRK_T, "%d", &ls_brk_t);
 	SAFE_FILE_PRINTF(PATH_LS_BRK_T, "%d", 45);
 
-	switch ((type = tst_fs_type("."))) {
-	case TST_NFS_MAGIC:
-	case TST_RAMFS_MAGIC:
-	case TST_TMPFS_MAGIC:
-		tst_brk(TCONF,
-			"Cannot do fcntl(F_SETLEASE, F_WRLCK) on %s filesystem",
-			tst_fs_type_name(type));
-	default:
-		break;
-	}
-
 	SAFE_TOUCH("file", FILE_MODE, NULL);
 
 	sigemptyset(&newset);
@@ -230,5 +219,11 @@ static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(test_cases),
 	.setup = setup,
 	.test = do_test,
-	.cleanup = cleanup
+	.cleanup = cleanup,
+	.skip_filesystems = (const char *const []) {
+		"tmpfs",
+		"ramfs",
+		"nfs",
+		NULL
+	},
 };
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
index f8fa413a9..58aa6f0d8 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
@@ -98,12 +98,6 @@ static void setup(void)
 {
 	char bd_path[100];
 
-	if (tst_fs_type(".") == TST_TMPFS_MAGIC)
-		tst_brk(TCONF, "tmpfd doesn't support O_DIRECT flag");
-
-	if (tst_fs_type(".") == TST_OVERLAYFS_MAGIC)
-		tst_brk(TCONF, "device isn't properly detected in overlay fs");
-
 	dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
 	if (dev_num < 0)
 		tst_brk(TBROK, "Failed to find free loop device");
@@ -151,6 +145,11 @@ static struct tst_test test = {
 	.test_all = verify_ioctl_loop,
 	.needs_root = 1,
 	.needs_tmpdir = 1,
+	.skip_filesystems = (const char *const []) {
+		"tmpfs",
+		"overlayfs",
+		NULL
+	},
 	.needs_drivers = (const char *const []) {
 		"loop",
 		NULL
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice01.c b/testcases/kernel/syscalls/vmsplice/vmsplice01.c
index 833af239f..1d1b66d12 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice01.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice01.c
@@ -103,11 +103,6 @@ static void setup(void)
 {
 	int i;
 
-	if (tst_fs_type(".") == TST_NFS_MAGIC) {
-		tst_brk(TCONF, "Cannot do splice() "
-			 "on a file located on an NFS filesystem");
-	}
-
 	for (i = 0; i < TEST_BLOCK_SIZE; i++)
 		buffer[i] = i & 0xff;
 }
@@ -123,5 +118,9 @@ static struct tst_test test = {
 	.cleanup = cleanup,
 	.test_all = vmsplice_test,
 	.needs_tmpdir = 1,
+	.skip_filesystems = (const char *const []) {
+		"nfs",
+		NULL
+	},
 	.min_kver = "2.6.17",
 };
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice02.c b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
index 978633d31..39c407cb8 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice02.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
@@ -52,11 +52,6 @@ static struct tcase {
 
 static void setup(void)
 {
-	if (tst_fs_type(".") == TST_NFS_MAGIC) {
-		tst_brk(TCONF, "Cannot do splice() "
-			"on a file located on an NFS filesystem");
-	}
-
 	filefd = SAFE_OPEN(TESTFILE, O_WRONLY | O_CREAT, 0644);
 
 	SAFE_PIPE(pipes);
@@ -106,5 +101,9 @@ static struct tst_test test = {
 	.test = vmsplice_verify,
 	.tcnt = ARRAY_SIZE(tcases),
 	.needs_tmpdir = 1,
+	.skip_filesystems = (const char *const []) {
+		"nfs",
+		NULL
+	},
 	.min_kver = "2.6.17",
 };
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 0/3] Add proper filesystem skiplist
  2021-03-10 12:26 [LTP] [PATCH 0/3] Add proper filesystem skiplist Cyril Hrubis
                   ` (2 preceding siblings ...)
  2021-03-10 12:26 ` [LTP] [PATCH 3/3] lib: Apply the skip_filesystems to rest of test as well Cyril Hrubis
@ 2021-03-10 12:42 ` Petr Vorel
  2021-03-10 12:55 ` Jan Stancek
  4 siblings, 0 replies; 15+ messages in thread
From: Petr Vorel @ 2021-03-10 12:42 UTC (permalink / raw)
  To: ltp

Hi Cyril,

> This adds a proper .skip_filesystems array to the tst_test structure and
> implements support for both test with .all_filesystems enabled and
> disabled.

> As a bonus point we get the list of filesystems that the test does not
> support exported to the metadata as well.

Whole patchset looks very nice, thanks for implementing it.
I post minor formatting nit on first patch.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 0/3] Add proper filesystem skiplist
  2021-03-10 12:26 [LTP] [PATCH 0/3] Add proper filesystem skiplist Cyril Hrubis
                   ` (3 preceding siblings ...)
  2021-03-10 12:42 ` [LTP] [PATCH 0/3] Add proper filesystem skiplist Petr Vorel
@ 2021-03-10 12:55 ` Jan Stancek
  2021-03-10 14:14   ` Cyril Hrubis
  4 siblings, 1 reply; 15+ messages in thread
From: Jan Stancek @ 2021-03-10 12:55 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> This adds a proper .skip_filesystems array to the tst_test structure and
> implements support for both test with .all_filesystems enabled and
> disabled.
> 
> As a bonus point we get the list of filesystems that the test does not
> support exported to the metadata as well.

Ack. Can you please also add something to docs?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 1/3] lib: Add proper filesystem skiplist
  2021-03-10 12:26 ` [LTP] [PATCH 1/3] lib: " Cyril Hrubis
@ 2021-03-10 12:58   ` Petr Vorel
  2021-03-10 14:28     ` Cyril Hrubis
  2021-03-10 16:19   ` Martin Doucha
  1 sibling, 1 reply; 15+ messages in thread
From: Petr Vorel @ 2021-03-10 12:58 UTC (permalink / raw)
  To: ltp

Hi Cyril,

3 very minor nits below.

> diff --git a/include/tst_fs.h b/include/tst_fs.h
...
>  /*
>   * Return 1 if a specified fiilsystem is supported
>   * Return 0 if a specified fiilsystem isn't supported
Please, while at it, could you fix "fiilsystem" typo?

...
> diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> index 00ede549d..cd505f570 100644
> --- a/lib/tst_supported_fs_types.c
> +++ b/lib/tst_supported_fs_types.c
> @@ -45,13 +45,34 @@ static int has_mkfs(const char *fs_type)
>  	return 1;
>  }

> -static int has_kernel_support(const char *fs_type, int flags)
> +int tst_fs_in_skiplist(const char *fs_type, const char *const *skiplist)
> +{
> +	unsigned int i;
> +
> +	if (!skiplist)
> +		return 0;
> +
> +	for (i = 0; skiplist[i]; i++) {
> +		if (!strcmp(fs_type, skiplist[i])) {
> +			tst_res(TINFO,
It'd be nice if skipping message could be TCONF to avoid:
tst_supported_fs_types.c:57: TINFO: Skipping tmpfs as requested by the test
tst_test.c:1056: TCONF: Skipping due to unsupported filesystem

but understand why - it'd make code more complicated (has_kernel_support() which
is used in tst_fs_is_supported() should not emit TCONF).

> +			        "Skipping %s as requested by the test", fs_type);
checkpatch complain here about mixing spaces and tabs.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 0/3] Add proper filesystem skiplist
  2021-03-10 12:55 ` Jan Stancek
@ 2021-03-10 14:14   ` Cyril Hrubis
  2021-03-10 16:01     ` Jan Stancek
  0 siblings, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2021-03-10 14:14 UTC (permalink / raw)
  To: ltp

Hi!
> Ack. Can you please also add something to docs?

Sure, what about:

diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index dd1911ceb..833f1f7bc 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -978,41 +978,69 @@ LTP_ALIGN(x, a)
 
 Aligns the x to be next multiple of a. The a must be power of 2.
 
-2.2.13 Filesystem type detection
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2.2.13 Filesystem type detection and skiplist
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Some tests are known to fail on certain filesystems (you cannot swap on TMPFS,
 there are unimplemented 'fcntl()' etc.).
 
-If your test needs to be skipped on certain filesystems, use the interface
-below:
+If your test needs to be skipped on certain filesystems use the
+'.skip_filesystems' field in the tst_test structure as follows:
 
 [source,c]
 -------------------------------------------------------------------------------
 #include "tst_test.h"
 
-	/*
-	 * Unsupported only on NFS.
-	 */
-	if (tst_fs_type(".") == TST_NFS_MAGIC)
-		tst_brk(TCONF, "Test not supported on NFS filesystem");
+static struct tst_test test = {
+	...
+        .skip_filesystems = (const char *const []) {
+                "tmpfs",
+                "ramfs",
+                "nfs",
+                NULL
+        },
+};
+-------------------------------------------------------------------------------
 
-	/*
-	 * Unsupported on NFS, TMPFS and RAMFS
-	 */
-	long type;
+When the '.all_filesystem' flag is set the '.skip_filesystems' list is passed
+to the function that detects supported filesystems any listed filesystem is
+not included in the resulting list of supported filesystems.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include "tst_test.h"
+
+static void run(void)
+{
+	...
 
 	switch ((type = tst_fs_type("."))) {
 	case TST_NFS_MAGIC:
 	case TST_TMPFS_MAGIC:
 	case TST_RAMFS_MAGIC:
-		tst_brk(TCONF, "Test not supported on %s filesystem",
+		tst_brk(TCONF, "Subtest not supported on %s",
 		        tst_fs_type_name(type));
+		return;
 	break;
 	}
+
+	...
+}
 -------------------------------------------------------------------------------
 
+If test needs to adjust expectations based on filesystem type it's also
+possible to detect filesystem type at the runtime. This is preferably used
+when only subset of the test is not applicable for a given filesystem.
+
 2.2.14 Thread-safety in the LTP library
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 1/3] lib: Add proper filesystem skiplist
  2021-03-10 12:58   ` Petr Vorel
@ 2021-03-10 14:28     ` Cyril Hrubis
  2021-03-10 15:39       ` Petr Vorel
  0 siblings, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2021-03-10 14:28 UTC (permalink / raw)
  To: ltp

Hi!
> > -static int has_kernel_support(const char *fs_type, int flags)
> > +int tst_fs_in_skiplist(const char *fs_type, const char *const *skiplist)
> > +{
> > +	unsigned int i;
> > +
> > +	if (!skiplist)
> > +		return 0;
> > +
> > +	for (i = 0; skiplist[i]; i++) {
> > +		if (!strcmp(fs_type, skiplist[i])) {
> > +			tst_res(TINFO,
> It'd be nice if skipping message could be TCONF to avoid:
> tst_supported_fs_types.c:57: TINFO: Skipping tmpfs as requested by the test
> tst_test.c:1056: TCONF: Skipping due to unsupported filesystem
> 
> but understand why - it'd make code more complicated (has_kernel_support() which
> is used in tst_fs_is_supported() should not emit TCONF).

I can make a internal wrapper for the tst_fs_is_supported() that prints
the TINFO message and use that in the tst_supported_fs_types, which
would make it silent in the case it's called from the test library...

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 1/3] lib: Add proper filesystem skiplist
  2021-03-10 14:28     ` Cyril Hrubis
@ 2021-03-10 15:39       ` Petr Vorel
  0 siblings, 0 replies; 15+ messages in thread
From: Petr Vorel @ 2021-03-10 15:39 UTC (permalink / raw)
  To: ltp

Hi Cyril,

..
> > > +	for (i = 0; skiplist[i]; i++) {
> > > +		if (!strcmp(fs_type, skiplist[i])) {
> > > +			tst_res(TINFO,
> > It'd be nice if skipping message could be TCONF to avoid:
> > tst_supported_fs_types.c:57: TINFO: Skipping tmpfs as requested by the test
> > tst_test.c:1056: TCONF: Skipping due to unsupported filesystem

> > but understand why - it'd make code more complicated (has_kernel_support() which
> > is used in tst_fs_is_supported() should not emit TCONF).

> I can make a internal wrapper for the tst_fs_is_supported() that prints
> the TINFO message and use that in the tst_supported_fs_types, which
> would make it silent in the case it's called from the test library...

Up to you, not really that important to bother with it.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 0/3] Add proper filesystem skiplist
  2021-03-10 14:14   ` Cyril Hrubis
@ 2021-03-10 16:01     ` Jan Stancek
  0 siblings, 0 replies; 15+ messages in thread
From: Jan Stancek @ 2021-03-10 16:01 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> Hi!
> > Ack. Can you please also add something to docs?
> 
> Sure, what about:

lgtm


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 1/3] lib: Add proper filesystem skiplist
  2021-03-10 12:26 ` [LTP] [PATCH 1/3] lib: " Cyril Hrubis
  2021-03-10 12:58   ` Petr Vorel
@ 2021-03-10 16:19   ` Martin Doucha
  2021-03-10 16:22     ` Cyril Hrubis
  1 sibling, 1 reply; 15+ messages in thread
From: Martin Doucha @ 2021-03-10 16:19 UTC (permalink / raw)
  To: ltp

Hi,

On 10. 03. 21 13:26, Cyril Hrubis wrote:
> The approach with flags we added for FUSE does not scale at all, we need
> a proper skiplist so that we can skip individual filesystems.
> 
> The motivation here is the addition of tmpfs to the supported
> filesystems check. One of the problems there is that sync() is no-op on
> tmpfs and hence the syncfs test fails. After this patchset we can simply
> skip syncfs test on tmpfs by setting the right skiplist.
> 
> As a bonus point the list of unsupported filesystem gets nicely
> propagated to the metadata as well.
> 
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>  include/tst_fs.h                              | 19 +++++++---
>  include/tst_test.h                            |  9 +++--
>  lib/tst_supported_fs_types.c                  | 35 ++++++++++++++-----
>  lib/tst_test.c                                |  2 +-
>  .../kernel/syscalls/fsconfig/fsconfig01.c     |  2 +-
>  testcases/kernel/syscalls/fsmount/fsmount01.c |  2 +-
>  testcases/kernel/syscalls/fsmount/fsmount02.c |  2 +-
>  testcases/kernel/syscalls/fsopen/fsopen01.c   |  2 +-
>  testcases/kernel/syscalls/fspick/fspick01.c   |  2 +-
>  testcases/kernel/syscalls/fspick/fspick02.c   |  2 +-
>  .../kernel/syscalls/move_mount/move_mount01.c |  2 +-
>  .../kernel/syscalls/move_mount/move_mount02.c |  2 +-
>  .../kernel/syscalls/open_tree/open_tree01.c   |  2 +-
>  .../kernel/syscalls/open_tree/open_tree02.c   |  2 +-
>  .../sync_file_range/sync_file_range02.c       |  2 +-
>  testcases/lib/tst_supported_fs.c              |  4 +--
>  16 files changed, 63 insertions(+), 28 deletions(-)
> 
> diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> index 00ede549d..cd505f570 100644
> --- a/lib/tst_supported_fs_types.c
> +++ b/lib/tst_supported_fs_types.c
> @@ -45,13 +45,34 @@ static int has_mkfs(const char *fs_type)
>  	return 1;
>  }
>  
> -static int has_kernel_support(const char *fs_type, int flags)
> +int tst_fs_in_skiplist(const char *fs_type, const char *const *skiplist)
> +{
> +	unsigned int i;
> +
> +	if (!skiplist)
> +		return 0;
> +
> +	for (i = 0; skiplist[i]; i++) {
> +		if (!strcmp(fs_type, skiplist[i])) {
> +			tst_res(TINFO,
> +			        "Skipping %s as requested by the test", fs_type);
> +			return 1;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static int has_kernel_support(const char *fs_type, const char *const *skiplist)
>  {
>  	static int fuse_supported = -1;
>  	const char *tmpdir = getenv("TMPDIR");
>  	char buf[128];
>  	int ret;
>  
> +	if (tst_fs_in_skiplist(fs_type, skiplist))
> +		return 0;
> +
>  	if (!tmpdir)
>  		tmpdir = "/tmp";
>  
> @@ -84,26 +105,24 @@ static int has_kernel_support(const char *fs_type, int flags)
>  		return 0;
>  	}
>  
> -	if (flags & TST_FS_SKIP_FUSE) {
> -		tst_res(TINFO, "Skipping FUSE as requested by the test");
> +	if (tst_fs_in_skiplist("fuse", skiplist))
>  		return 0;
> -	}
>  
>  	tst_res(TINFO, "FUSE does support %s", fs_type);
>  	return 1;
>  }

I don't think that has_kernel_support() should look at the skiplist at
all. The entire skiplist logic should be handled in
tst_get_supported_fs_types(). But has_kernel_support() could return
different (non-zero) values for native support and for FUSE support.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 1/3] lib: Add proper filesystem skiplist
  2021-03-10 16:19   ` Martin Doucha
@ 2021-03-10 16:22     ` Cyril Hrubis
  2021-03-10 16:34       ` Martin Doucha
  0 siblings, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2021-03-10 16:22 UTC (permalink / raw)
  To: ltp

Hi!
> > +static int has_kernel_support(const char *fs_type, const char *const *skiplist)
> >  {
> >  	static int fuse_supported = -1;
> >  	const char *tmpdir = getenv("TMPDIR");
> >  	char buf[128];
> >  	int ret;
> >  
> > +	if (tst_fs_in_skiplist(fs_type, skiplist))
> > +		return 0;
> > +
> >  	if (!tmpdir)
> >  		tmpdir = "/tmp";
> >  
> > @@ -84,26 +105,24 @@ static int has_kernel_support(const char *fs_type, int flags)
> >  		return 0;
> >  	}
> >  
> > -	if (flags & TST_FS_SKIP_FUSE) {
> > -		tst_res(TINFO, "Skipping FUSE as requested by the test");
> > +	if (tst_fs_in_skiplist("fuse", skiplist))
> >  		return 0;
> > -	}
> >  
> >  	tst_res(TINFO, "FUSE does support %s", fs_type);
> >  	return 1;
> >  }
> 
> I don't think that has_kernel_support() should look at the skiplist at
> all. The entire skiplist logic should be handled in
> tst_get_supported_fs_types(). But has_kernel_support() could return
> different (non-zero) values for native support and for FUSE support.

I do not agree, that would add more complexity to an internal function
that is not exported outside the library.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 1/3] lib: Add proper filesystem skiplist
  2021-03-10 16:22     ` Cyril Hrubis
@ 2021-03-10 16:34       ` Martin Doucha
  2021-03-11  8:39         ` Li Wang
  0 siblings, 1 reply; 15+ messages in thread
From: Martin Doucha @ 2021-03-10 16:34 UTC (permalink / raw)
  To: ltp

On 10. 03. 21 17:22, Cyril Hrubis wrote:
> Hi!
>>> +static int has_kernel_support(const char *fs_type, const char *const *skiplist)
>>>  {
>>>  	static int fuse_supported = -1;
>>>  	const char *tmpdir = getenv("TMPDIR");
>>>  	char buf[128];
>>>  	int ret;
>>>  
>>> +	if (tst_fs_in_skiplist(fs_type, skiplist))
>>> +		return 0;
>>> +
>>>  	if (!tmpdir)
>>>  		tmpdir = "/tmp";
>>>  
>>> @@ -84,26 +105,24 @@ static int has_kernel_support(const char *fs_type, int flags)
>>>  		return 0;
>>>  	}
>>>  
>>> -	if (flags & TST_FS_SKIP_FUSE) {
>>> -		tst_res(TINFO, "Skipping FUSE as requested by the test");
>>> +	if (tst_fs_in_skiplist("fuse", skiplist))
>>>  		return 0;
>>> -	}
>>>  
>>>  	tst_res(TINFO, "FUSE does support %s", fs_type);
>>>  	return 1;
>>>  }
>>
>> I don't think that has_kernel_support() should look at the skiplist at
>> all. The entire skiplist logic should be handled in
>> tst_get_supported_fs_types(). But has_kernel_support() could return
>> different (non-zero) values for native support and for FUSE support.
> 
> I do not agree, that would add more complexity to an internal function
> that is not exported outside the library.

Your patchset adds complexity to tst_fs_is_supported() which is a public
wrapper of has_kernel_support(), even though it's only used indirectly
in shell tests. Some tests might use that function directly in the
future so let's make the interface cleaner, not hairier.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 1/3] lib: Add proper filesystem skiplist
  2021-03-10 16:34       ` Martin Doucha
@ 2021-03-11  8:39         ` Li Wang
  0 siblings, 0 replies; 15+ messages in thread
From: Li Wang @ 2021-03-11  8:39 UTC (permalink / raw)
  To: ltp

Hi Cyril,

On Thu, Mar 11, 2021 at 12:34 AM Martin Doucha <mdoucha@suse.cz> wrote:

> On 10. 03. 21 17:22, Cyril Hrubis wrote:
> > Hi!
> >>> +static int has_kernel_support(const char *fs_type, const char *const
> *skiplist)
> >>>  {
> >>>     static int fuse_supported = -1;
> >>>     const char *tmpdir = getenv("TMPDIR");
> >>>     char buf[128];
> >>>     int ret;
> >>>
> >>> +   if (tst_fs_in_skiplist(fs_type, skiplist))
> >>> +           return 0;
> >>> +
> >>>     if (!tmpdir)
> >>>             tmpdir = "/tmp";
> >>>
> >>> @@ -84,26 +105,24 @@ static int has_kernel_support(const char
> *fs_type, int flags)
> >>>             return 0;
> >>>     }
> >>>
> >>> -   if (flags & TST_FS_SKIP_FUSE) {
> >>> -           tst_res(TINFO, "Skipping FUSE as requested by the test");
> >>> +   if (tst_fs_in_skiplist("fuse", skiplist))
> >>>             return 0;
> >>> -   }
> >>>
> >>>     tst_res(TINFO, "FUSE does support %s", fs_type);
> >>>     return 1;
> >>>  }
> >>
> >> I don't think that has_kernel_support() should look at the skiplist at
> >> all. The entire skiplist logic should be handled in
> >> tst_get_supported_fs_types(). But has_kernel_support() could return
> >> different (non-zero) values for native support and for FUSE support.
> >
> > I do not agree, that would add more complexity to an internal function
> > that is not exported outside the library.
>
> Your patchset adds complexity to tst_fs_is_supported() which is a public
> wrapper of has_kernel_support(), even though it's only used indirectly
> in shell tests. Some tests might use that function directly in the
> future so let's make the interface cleaner, not hairier.
>

+1

I have the same view as Martin. Since only regarding the function name
has_kernel_support() should only take care of the kernel supported
filesystem
but not include any blacklist from users. That will make people confused in
code reading.


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210311/7d7d0a1a/attachment.htm>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-03-11  8:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 12:26 [LTP] [PATCH 0/3] Add proper filesystem skiplist Cyril Hrubis
2021-03-10 12:26 ` [LTP] [PATCH 1/3] lib: " Cyril Hrubis
2021-03-10 12:58   ` Petr Vorel
2021-03-10 14:28     ` Cyril Hrubis
2021-03-10 15:39       ` Petr Vorel
2021-03-10 16:19   ` Martin Doucha
2021-03-10 16:22     ` Cyril Hrubis
2021-03-10 16:34       ` Martin Doucha
2021-03-11  8:39         ` Li Wang
2021-03-10 12:26 ` [LTP] [PATCH 2/3] lib: tst_fs_type change fs names to lowercase Cyril Hrubis
2021-03-10 12:26 ` [LTP] [PATCH 3/3] lib: Apply the skip_filesystems to rest of test as well Cyril Hrubis
2021-03-10 12:42 ` [LTP] [PATCH 0/3] Add proper filesystem skiplist Petr Vorel
2021-03-10 12:55 ` Jan Stancek
2021-03-10 14:14   ` Cyril Hrubis
2021-03-10 16:01     ` Jan Stancek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.