fsmount01: Add test if MOUNT_ATTR_* have expected effect on the mount
PATCH 1/1 fsmount01: Add test if MOUNT_ATTR_* have expected effect on the mount
The fsmount01 test does not test if MOUNT_ATTR_* have expected effect on the mount, e.g. if MOUNT_ATTR_RDONLY mounts the FS read only etc.
Fixes #1170
Signed-off-by Wei Gao <[email protected]>
--- include/tst_device.h | 1 + lib/tst_device.c | 2 +- testcases/kernel/syscalls/fsmount/fsmount01.c | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-)
include/tst_device.h +1 -0
@@ -35,6 +35,7 @@ int tst_umount(const char *path);int tst_is_mounted (const char *path);int tst_is_mounted_ro (const char *path);int tst_is_mounted_rw (const char *path); +int tst_mount_has_opt (const char *path,const char *opt);int tst_is_mounted_at_tmpdir (const char *path);/*
lib/tst_device.c +1 -1
@@ -429,7 +429,7 @@ int tst_umount(const char *path)return -1 ; } -static int tst_mount_has_opt (const char *path,const char *opt) +int tst_mount_has_opt (const char *path,const char *opt) {char line[PATH_MAX ];char abspath[PATH_MAX ];
testcases/kernel/syscalls/fsmount/fsmount01.c +27 -0
@@ -8,6 +8,7 @@#include "tst_test.h" #include "lapi/fsmount.h" +#include "tst_safe_stdio.h" #define MNTPOINT "mntpoint"
@@ -75,6 +76,32 @@ static void run(unsigned int n)TEST (move_mount (mfd,"" ,AT_FDCWD ,MNTPOINT ,MOVE_MOUNT_F_EMPTY_PATH ));SAFE_CLOSE (mfd); +switch (tc->attrs) { +case MOUNT_ATTR_RDONLY : +TST_EXP_VAL (tst_is_mounted_ro (MNTPOINT ),1 ); +break ; +case MOUNT_ATTR_NOSUID : +TST_EXP_VAL (tst_mount_has_opt (MNTPOINT ,"nosuid" ),1 ); +break ; +case MOUNT_ATTR_NODEV : +TST_EXP_VAL (tst_mount_has_opt (MNTPOINT ,"nodev" ),1 ); +break ; +case MOUNT_ATTR_NOEXEC : +TST_EXP_VAL (tst_mount_has_opt (MNTPOINT ,"noexec" ),1 ); +break ; +case MOUNT_ATTR_RELATIME : +TST_EXP_VAL (tst_mount_has_opt (MNTPOINT ,"relatime" ),1 ); +break ; +case MOUNT_ATTR_NOATIME : +TST_EXP_VAL (tst_mount_has_opt (MNTPOINT ,"noatime" ),1 ); +break ; +case MOUNT_ATTR_NODIRATIME : +TST_EXP_VAL (tst_mount_has_opt (MNTPOINT ,"nodiratime" ),1 ); +break ; +default : +break ; + } +if (TST_RET ==-1 ) {tst_res (TFAIL |TTERRNO ,"move_mount() failed to attach to the mount point" );
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 20 lines · Wei Gao via ltp
The fsmount01 test does not test if MOUNT_ATTR_* have expected effect on the mount, e.g. if
MOUNT_ATTR_RDONLYmounts the FS read only etc.Fixes #1170Signed-off-by Wei Gao <[email protected]>--- include/tst_device.h | 1 + lib/tst_device.c | 2 +- testcases/kernel/syscalls/fsmount/fsmount01.c | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-)include/tst_device.h +0
-0
include/tst_device.h int tst_umount(const char *path); · line 41
Quoted 7 lines
include/tst_device.h +1
-0@@ -35,6 +35,7 @@ int tst_umount(const char *path);int tst_is_mounted (const char *path);int tst_is_mounted_ro (const char *path);int tst_is_mounted_rw (const char *path); +int tst_mount_has_opt (const char *path,const char *opt);
Good point, I reordered this to the top above the three mounts and pushed. Thanks for the enhancement.
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp