[LTP] [PATCH] syscalls/mount03: Add statfs f_flags member check

Yang Xu xuyang2018.jy@fujitsu.com
Tue Oct 18 13:10:13 CEST 2022


Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/mount/mount03.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/mount/mount03.c b/testcases/kernel/syscalls/mount/mount03.c
index 7a6914fb1..e1dd8d170 100644
--- a/testcases/kernel/syscalls/mount/mount03.c
+++ b/testcases/kernel/syscalls/mount/mount03.c
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <sys/vfs.h>
 #include <pwd.h>
 #include "tst_test.h"
 #include "lapi/mount.h"
@@ -144,10 +145,10 @@ static void cleanup(void)
 		SAFE_UMOUNT(MNTPOINT);
 }
 
-
 static void run(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
+	struct statfs stfs;
 
 	tst_res(TINFO, "Testing flag %s", tc->desc);
 
@@ -159,6 +160,11 @@ static void run(unsigned int n)
 	if (tc->test)
 		tc->test();
 
+	SAFE_STATFS(MNTPOINT, &stfs);
+	if (stfs.f_flags & (n == 3 ? MS_REMOUNT : tc->flag))
+		tst_res(TPASS, "statfs() gets the correct mount flag");
+	else
+		tst_res(TFAIL, "statfs() gets the incorrect mount flag");
 	cleanup();
 }
 
-- 
2.27.0



More information about the ltp mailing list