lib: Add is_fuse flag to SAFE_MOUNT() and tst_device
PATCH 1/2 lib: Add is_fuse flag to SAFE_MOUNT() and tst_device
This allows us to adjust tests that need different expectations on FUSE based filesystems.
--- include/old/safe_macros.h | 2 +- include/safe_macros_fn.h | 2 +- include/tst_device.h | 2 ++ include/tst_safe_macros.h | 7 ++++++- lib/safe_macros.c | 10 ++++++++-- lib/tst_test.c | 4 ++-- 6 files changed, 20 insertions(+), 7 deletions(-)
include/old/safe_macros.h +1 -1
@@ -150,7 +150,7 @@#define SAFE_MOUNT (cleanup_fn, source, target, filesystemtype, \ mountflags, data) \ safe_mount(__FILE__, __LINE__, (cleanup_fn), (source), (target), \ - (filesystemtype), (mountflags), (data)) + (filesystemtype), (mountflags), (data), NULL)#define SAFE_UMOUNT (cleanup_fn, target) \ safe_umount(__FILE__, __LINE__, (cleanup_fn), (target))
include/safe_macros_fn.h +1 -1
@@ -172,7 +172,7 @@ int safe_rename(const char *file, const int lineno, void (*cleanup_fn)(void),int safe_mount (const char *file,const int lineno,void (*cleanup_fn)(void ),const char *source,const char *target,const char *filesystemtype,unsigned long mountflags, -const void *data); +const void *data,int *is_fuse);int safe_umount (const char *file,const int lineno,void (*cleanup_fn)(void ),const char *target);
include/tst_device.h +2 -0
@@ -15,6 +15,8 @@ struct tst_device {const char *dev;const char *fs_type;uint64_t size; +/* If device was mounted by the test library this flag is set for fuse fileystems. */ +int is_fuse; };/*
include/tst_safe_macros.h +6 -1
@@ -241,7 +241,12 @@ int safe_getgroups(const char *file, const int lineno, int size, gid_t list[]);#define SAFE_MOUNT (source, target, filesystemtype, \ mountflags, data) \ safe_mount(__FILE__, __LINE__, NULL, (source), (target), \ - (filesystemtype), (mountflags), (data)) + (filesystemtype), (mountflags), (data), NULL) + +#define SAFE_MOUNT2 (source, target, filesystemtype, \ + mountflags, data, is_fuse) \ + safe_mount(__FILE__, __LINE__, NULL, (source), (target), \ + (filesystemtype), (mountflags), (data), (is_fuse))#define SAFE_UMOUNT (target) \ safe_umount(__FILE__, __LINE__, NULL, (target))
lib/safe_macros.c +8 -2
@@ -907,11 +907,14 @@ static int possibly_fuse(const char *fs_type)int safe_mount (const char *file,const int lineno,void (*cleanup_fn)(void ),const char *source,const char *target,const char *filesystemtype,unsigned long mountflags, -const void *data) +const void *data,int *is_fuse) {int rval =-1 ;char mpath[PATH_MAX ]; +if (is_fuse) + *is_fuse =0 ; +if (realpath (target, mpath)) { tst_resm_(file, lineno, TINFO, "Mounting %s to %s fstyp=%s flags=%lx",
@@ -957,8 +960,11 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void), filesystemtype, mount_ro, source, target); rval =tst_system (buf); -if (WIFEXITED (rval) &&WEXITSTATUS (rval) ==0 ) +if (WIFEXITED (rval) &&WEXITSTATUS (rval) ==0 ) { +if (is_fuse) + *is_fuse =1 ;return 0 ; + }tst_brkm_ (file, lineno,TBROK , cleanup_fn,"mount.%s failed with %i" , filesystemtype, rval);
lib/tst_test.c +2 -2
@@ -1273,8 +1273,8 @@ static void prepare_device(struct tst_fs *fs) mnt_data =limit_tmpfs_mount_size (fs->mnt_data, buf,sizeof (buf), tdev.fs_type); -SAFE_MOUNT (get_device_name (tdev.fs_type), tst_test->mntpoint, - tdev.fs_type, fs->mnt_flags, mnt_data); +SAFE_MOUNT2 (get_device_name (tdev.fs_type), tst_test->mntpoint, + tdev.fs_type, fs->mnt_flags, mnt_data, &tdev.is_fuse); context->mntpoint_mounted =1 ; } }
Signature · 5 lines
2.49.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/2 syscalls/statmount06: Fix and enable the test on FUSE
--- testcases/kernel/syscalls/statmount/statmount06.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/statmount/statmount06.c +3 -5
@@ -36,8 +36,10 @@ static void run(void)if (!TST_PASS )return ; +const char *fs_type = tst_device->is_fuse ?"fuseblk" : tst_device->fs_type; +TST_EXP_EQ_LI (st_mount->mask,STATMOUNT_FS_TYPE ); -TST_EXP_EQ_STR (st_mount->str + st_mount->fs_type, tst_device->fs_type); +TST_EXP_EQ_STR (st_mount->str + st_mount->fs_type, fs_type); }static void setup (void )
@@ -55,10 +57,6 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = MNTPOINT, .all_filesystems = 1, - .skip_filesystems = (const char *const []) { -"fuse" , -NULL - }, .bufs = (struct tst_buffers []) { {&st_mount, .size =SM_SIZE }, {}
Signature · 5 lines
2.49.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] syscalls/statmount06: Fix and enable the test on FUSE
Quoted 35 lines · Cyril Hrubis
Reported-by Jan Polensky <[email protected]>Signed-off-by Cyril Hrubis <[email protected]>--- testcases/kernel/syscalls/statmount/statmount06.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)testcases/kernel/syscalls/statmount/statmount06.c +3
-5@@ -36,8 +36,10 @@ static void run(void)if (!TST_PASS )return ; +const char *fs_type = tst_device->is_fuse ?"fuseblk" : tst_device->fs_type; +TST_EXP_EQ_LI (st_mount->mask,STATMOUNT_FS_TYPE ); -TST_EXP_EQ_STR (st_mount->str + st_mount->fs_type, tst_device->fs_type); +TST_EXP_EQ_STR (st_mount->str + st_mount->fs_type, fs_type); }static void setup (void )@@ -55,10 +57,6 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = MNTPOINT, .all_filesystems = 1, - .skip_filesystems = (const char *const []) { -"fuse" , -NULL - }, .bufs = (struct tst_buffers []) { {&st_mount, .size =SM_SIZE }, {}Signature · 1 line
2.49.0
Quoted 4 lines
Signature · 2 lines
-- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] syscalls/statmount06: Fix and enable the test on FUSE
Hi!
Patchset pushed, thanks for the reviews.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 2/2] syscalls/statmount06: Fix and enable the test on FUSE
In reply to Cyril HrubisQuoted 3 lines · Cyril Hrubis
Reported-by Jan Polensky <[email protected]>Signed-off-by Cyril Hrubis <[email protected]>
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
FYI the CI fails here because it needs to be applied over the first patch for SAFE_MOUNT(). I should have probably send the changes as a single patcheset.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 3 lines
FYI the CI fails here because it needs to be applied over the first patch for
SAFE_MOUNT(). I should have probably send the changes as a single patcheset.
Ping. Can anyone have a look please?
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 4 lines · Cyril Hrubis
This allows us to adjust tests that need different expectations on FUSE based filesystems.
Signed-off-by Cyril Hrubis <[email protected]>
Very nit: Reported-by: Jan Polensky <[email protected]> Is there any issue link can be provide?
Quoted 120 lines
--- include/old/safe_macros.h | 2 +- include/safe_macros_fn.h | 2 +- include/tst_device.h | 2 ++ include/tst_safe_macros.h | 7 ++++++- lib/safe_macros.c | 10 ++++++++-- lib/tst_test.c | 4 ++-- 6 files changed, 20 insertions(+), 7 deletions(-)include/old/safe_macros.h +1
-1@@ -150,7 +150,7 @@#define SAFE_MOUNT (cleanup_fn, source, target, filesystemtype, \ mountflags, data) \ safe_mount(__FILE__, __LINE__, (cleanup_fn), (source), (target), \ - (filesystemtype), (mountflags), (data)) + (filesystemtype), (mountflags), (data), NULL)#define SAFE_UMOUNT (cleanup_fn, target) \ safe_umount(__FILE__, __LINE__, (cleanup_fn), (target))include/safe_macros_fn.h +1
-1@@ -172,7 +172,7 @@ int safe_rename(const char *file, const int lineno, void (*cleanup_fn)(void),int safe_mount (const char *file,const int lineno,void (*cleanup_fn)(void ),const char *source,const char *target,const char *filesystemtype,unsigned long mountflags, -const void *data); +const void *data,int *is_fuse);int safe_umount (const char *file,const int lineno,void (*cleanup_fn)(void ),const char *target);include/tst_device.h +2
-0@@ -15,6 +15,8 @@ struct tst_device {const char *dev;const char *fs_type;uint64_t size; +/* If device was mounted by the test library this flag is set for fuse fileystems. */ +int is_fuse; };/* include/tst_safe_macros.h +6
-1@@ -241,7 +241,12 @@ int safe_getgroups(const char *file, const int lineno, int size, gid_t list[]);#define SAFE_MOUNT (source, target, filesystemtype, \ mountflags, data) \ safe_mount(__FILE__, __LINE__, NULL, (source), (target), \ - (filesystemtype), (mountflags), (data)) + (filesystemtype), (mountflags), (data), NULL) + +#define SAFE_MOUNT2 (source, target, filesystemtype, \ + mountflags, data, is_fuse) \ + safe_mount(__FILE__, __LINE__, NULL, (source), (target), \ + (filesystemtype), (mountflags), (data), (is_fuse))#define SAFE_UMOUNT (target) \ safe_umount(__FILE__, __LINE__, NULL, (target))lib/safe_macros.c +8
-2@@ -907,11 +907,14 @@ static int possibly_fuse(const char *fs_type)int safe_mount (const char *file,const int lineno,void (*cleanup_fn)(void ),const char *source,const char *target,const char *filesystemtype,unsigned long mountflags, -const void *data) +const void *data,int *is_fuse) {int rval =-1 ;char mpath[PATH_MAX ]; +if (is_fuse) + *is_fuse =0 ; +if (realpath (target, mpath)) { tst_resm_(file, lineno, TINFO, "Mounting %s to %s fstyp=%s flags=%lx",@@ -957,8 +960,11 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void), filesystemtype, mount_ro, source, target); rval =tst_system (buf); -if (WIFEXITED (rval) &&WEXITSTATUS (rval) ==0 ) +if (WIFEXITED (rval) &&WEXITSTATUS (rval) ==0 ) { +if (is_fuse) + *is_fuse =1 ;return 0 ; + }tst_brkm_ (file, lineno,TBROK , cleanup_fn,"mount.%s failed with %i" , filesystemtype, rval);lib/tst_test.c +2
-2@@ -1273,8 +1273,8 @@ static void prepare_device(struct tst_fs *fs) mnt_data =limit_tmpfs_mount_size (fs->mnt_data, buf,sizeof (buf), tdev.fs_type); -SAFE_MOUNT (get_device_name (tdev.fs_type), tst_test->mntpoint, - tdev.fs_type, fs->mnt_flags, mnt_data); +SAFE_MOUNT2 (get_device_name (tdev.fs_type), tst_test->mntpoint, + tdev.fs_type, fs->mnt_flags, mnt_data, &tdev.is_fuse); context->mntpoint_mounted =1 ; } }Signature · 5 lines
2.49.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 2 lines
Quoted 1 line
Signed-off-by Cyril Hrubis <[email protected]>Very nit: Reported-by: Jan Polensky <[email protected]>
Added.
Quoted 1 line
Is there any issue link can be provide?
Unfortunately no.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 5 lines · Cyril Hrubis
This allows us to adjust tests that need different expectations on FUSE based filesystems.
Signed-off-by Cyril Hrubis <[email protected]>
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp