Skip to contentSkip to conversation

sync_file_range02 skip tests on FUSE

PATCH New Cyril Hrubis 3 participants 6 messages Jun 19, 2019 Library code

lore
Share & tools
lore
#0 lore raw

cover sync_file_range02 skip tests on FUSE

As discussed on LTP ML it does not make sense to run the sync_file_range.

Cyril Hrubis (2):
lib: Add flags to tst_get_supported_fs_types()
syscalls/sync_file_range02: Skip test on fuse.

 include/tst_fs.h                                  |  6 ++++--
 include/tst_test.h                                |  2 ++
 lib/tst_supported_fs_types.c                      | 15 ++++++++++-----
 lib/tst_test.c                                    |  2 +-
 .../syscalls/sync_file_range/sync_file_range02.c  |  1 +
 testcases/lib/tst_supported_fs.c                  |  4 ++--
 6 files changed, 20 insertions(+), 10 deletions(-)
Signature · 1 line
2.19.2
#1 lore raw

PATCH 1/2 lib: Add flags to tst_get_supported_fs_types()

Now we can ask the library to filter-out FUSE backed fs types.

CC Amir Goldstein <[email protected]>
CC Sumit Garg <[email protected]>
---
 include/tst_fs.h                 |  6 ++++--
 include/tst_test.h               |  2 ++
 lib/tst_supported_fs_types.c     | 15 ++++++++++-----
 lib/tst_test.c                   |  2 +-
 testcases/lib/tst_supported_fs.c |  4 ++--
 5 files changed, 19 insertions(+), 10 deletions(-)
include/tst_fs.h +4 -2
index ebca065c6..62071e508 100644
@@ -162,16 +162,18 @@ int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount);
  */
 int tst_fill_file(const char *path, char pattern, 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
  */
-int tst_fs_is_supported(const char *fs_type);
+int tst_fs_is_supported(const char *fs_type, int flags);
 
 /*
  * Returns NULL-terminated array of kernel-supported filesystems.
  */
-const char **tst_get_supported_fs_types(void);
+const char **tst_get_supported_fs_types(int flags);
 
 /*
  * Creates and writes to files on given path until write fails with ENOSPC
include/tst_test.h +2 -0
index 8bdf38482..2e8e36352 100644
@@ -154,6 +154,8 @@ 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;
lib/tst_supported_fs_types.c +10 -5
index 9babcc31a..00ede549d 100644
@@ -45,7 +45,7 @@ static int has_mkfs(const char *fs_type)
 	return 1;
 }
 
-static int has_kernel_support(const char *fs_type)
+static int has_kernel_support(const char *fs_type, int flags)
 {
 	static int fuse_supported = -1;
 	const char *tmpdir = getenv("TMPDIR");
@@ -84,21 +84,26 @@ static int has_kernel_support(const char *fs_type)
 		return 0;
 	}
 
+	if (flags & TST_FS_SKIP_FUSE) {
+		tst_res(TINFO, "Skipping FUSE as requested by the test");
+		return 0;
+	}
+
 	tst_res(TINFO, "FUSE does support %s", fs_type);
 	return 1;
 }
 
-int tst_fs_is_supported(const char *fs_type)
+int tst_fs_is_supported(const char *fs_type, int flags)
 {
-	return has_kernel_support(fs_type) && has_mkfs(fs_type);
+	return has_kernel_support(fs_type, flags) && has_mkfs(fs_type);
 }
 
-const char **tst_get_supported_fs_types(void)
+const char **tst_get_supported_fs_types(int flags)
 {
 	unsigned int i, j = 0;
 
 	for (i = 0; fs_type_whitelist[i]; i++) {
-		if (tst_fs_is_supported(fs_type_whitelist[i]))
+		if (tst_fs_is_supported(fs_type_whitelist[i], flags))
 			fs_types[j++] = fs_type_whitelist[i];
 	}
 
lib/tst_test.c +1 -1
index c08da6a80..245e287fa 100644
@@ -1151,7 +1151,7 @@ static int run_tcases_per_fs(void)
 {
 	int ret = 0;
 	unsigned int i;
-	const char *const *filesystems = tst_get_supported_fs_types();
+	const char *const *filesystems = tst_get_supported_fs_types(tst_test->dev_fs_flags);
 
 	if (!filesystems[0])
 		tst_brk(TCONF, "There are no supported filesystems");
testcases/lib/tst_supported_fs.c +2 -2
index ebebcbb37..022a61508 100644
@@ -37,9 +37,9 @@ int main(int argc, char *argv[])
 	}
 
 	if (argv[1])
-		return !tst_fs_is_supported(argv[1]);
+		return !tst_fs_is_supported(argv[1], 0);
 
-	filesystems = tst_get_supported_fs_types();
+	filesystems = tst_get_supported_fs_types(0);
 	for (i = 0; filesystems[i]; i++)
 		printf("%s\n", filesystems[i]);
 
Signature · 1 line
2.19.2
#2 lore raw

PATCH 1/2 lib: Add flags to tst_get_supported_fs_types()

Quoted 6 lines · Cyril Hrubis

Now we can ask the library to filter-out FUSE backed fs types.

CC Amir Goldstein <[email protected]>
CC Sumit Garg <[email protected]>

Looks good.

Quoted 122 lines
---
 include/tst_fs.h                 |  6 ++++--
 include/tst_test.h               |  2 ++
 lib/tst_supported_fs_types.c     | 15 ++++++++++-----
 lib/tst_test.c                   |  2 +-
 testcases/lib/tst_supported_fs.c |  4 ++--
 5 files changed, 19 insertions(+), 10 deletions(-)
include/tst_fs.h +4 -2
index ebca065c6..62071e508 100644
@@ -162,16 +162,18 @@ int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount);
  */
 int tst_fill_file(const char *path, char pattern, 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
  */
-int tst_fs_is_supported(const char *fs_type);
+int tst_fs_is_supported(const char *fs_type, int flags);
 
 /*
  * Returns NULL-terminated array of kernel-supported filesystems.
  */
-const char **tst_get_supported_fs_types(void);
+const char **tst_get_supported_fs_types(int flags);
 
 /*
  * Creates and writes to files on given path until write fails with ENOSPC
include/tst_test.h +2 -0
index 8bdf38482..2e8e36352 100644
@@ -154,6 +154,8 @@ 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;
lib/tst_supported_fs_types.c +10 -5
index 9babcc31a..00ede549d 100644
@@ -45,7 +45,7 @@ static int has_mkfs(const char *fs_type)
        return 1;
 }
 
-static int has_kernel_support(const char *fs_type)
+static int has_kernel_support(const char *fs_type, int flags)
 {
        static int fuse_supported = -1;
        const char *tmpdir = getenv("TMPDIR");
@@ -84,21 +84,26 @@ static int has_kernel_support(const char *fs_type)
                return 0;
        }
 
+       if (flags & TST_FS_SKIP_FUSE) {
+               tst_res(TINFO, "Skipping FUSE as requested by the test");
+               return 0;
+       }
+
        tst_res(TINFO, "FUSE does support %s", fs_type);
        return 1;
 }
 
-int tst_fs_is_supported(const char *fs_type)
+int tst_fs_is_supported(const char *fs_type, int flags)
 {
-       return has_kernel_support(fs_type) && has_mkfs(fs_type);
+       return has_kernel_support(fs_type, flags) && has_mkfs(fs_type);
 }
 
-const char **tst_get_supported_fs_types(void)
+const char **tst_get_supported_fs_types(int flags)
 {
        unsigned int i, j = 0;
 
        for (i = 0; fs_type_whitelist[i]; i++) {
-               if (tst_fs_is_supported(fs_type_whitelist[i]))
+               if (tst_fs_is_supported(fs_type_whitelist[i], flags))
                        fs_types[j++] = fs_type_whitelist[i];
        }
 
lib/tst_test.c +1 -1
index c08da6a80..245e287fa 100644
@@ -1151,7 +1151,7 @@ static int run_tcases_per_fs(void)
 {
        int ret = 0;
        unsigned int i;
-       const char *const *filesystems = tst_get_supported_fs_types();
+       const char *const *filesystems = tst_get_supported_fs_types(tst_test->dev_fs_flags);
 
        if (!filesystems[0])
                tst_brk(TCONF, "There are no supported filesystems");
testcases/lib/tst_supported_fs.c +2 -3
index ebebcbb37..022a61508 100644
@@ -37,9 +37,9 @@ int main(int argc, char *argv[])
        }
 
        if (argv[1])
-               return !tst_fs_is_supported(argv[1]);
+               return !tst_fs_is_supported(argv[1], 0);
 
-       filesystems = tst_get_supported_fs_types();
+       filesystems = tst_get_supported_fs_types(0);
        for (i = 0; filesystems[i]; i++)
                printf("%s\n", filesystems[i]);
 
--

2.19.2

#3 lore raw

PATCH 2/2 syscalls/sync_file_range02: Skip test on fuse.

In reply to Cyril Hrubis

The syscall is not implemented on FUSE, as a matter of fact it returns with success but does nothing so we even cannot detect if it's implemented or not so let's just skip it.

CC Amir Goldstein <[email protected]>
CC Sumit Garg <[email protected]>
---
 testcases/kernel/syscalls/sync_file_range/sync_file_range02.c | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/sync_file_range/sync_file_range02.c +1 -0
index d4c29f9c2..eb08143c3 100644
@@ -121,6 +121,7 @@ static struct tst_test test = {
 	.needs_root = 1,
 	.mount_device = 1,
 	.all_filesystems = 1,
+	.dev_fs_flags = TST_FS_SKIP_FUSE,
 	.mntpoint = MNTPOINT,
 	.setup = setup,
 	.test = run,
Signature · 1 line
2.19.2
#4 lore raw

cover sync_file_range02 skip tests on FUSE

In reply to Cyril Hrubis
Quoted 8 lines · Cyril Hrubis

As discussed on LTP ML it does not make sense to run the sync_file_range.

Cyril Hrubis (2):
lib: Add flags to tst_get_supported_fs_types()
syscalls/sync_file_range02: Skip test on fuse.

Quoted 14 lines
 include/tst_fs.h                                  |  6 ++++--
 include/tst_test.h                                |  2 ++
 lib/tst_supported_fs_types.c                      | 15 ++++++++++-----
 lib/tst_test.c                                    |  2 +-
 .../syscalls/sync_file_range/sync_file_range02.c  |  1 +
 testcases/lib/tst_supported_fs.c                  |  4 ++--
 6 files changed, 20 insertions(+), 10 deletions(-)

--
2.19.2

--
Mailing list info: https://lists.linux.it/listinfo/ltp