@@ -6,6 +6,8 @@
*/
#include "tst_test.h"
#include "lapi/fsmount.h"
+#include <sys/statvfs.h>
+
#define MNTPOINT "mntpoint"
#define TCASE_ENTRY(_flags) {.name = "Flag " #_flags, .flags = _flags}
@@ -39,7 +41,7 @@ static void run(unsigned int n)
TEST(fsconfig(fspick_fd, FSCONFIG_SET_FLAG, "ro", NULL, 0));
if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_FLAG) failed");
+ tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_FLAG) ro failed");
goto out;
}
@@ -48,7 +50,19 @@ static void run(unsigned int n)
tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_CMD_RECONFIGURE) failed");
goto out;
}
-
+
+ struct statvfs buf;
+ if (statvfs(MNTPOINT, &buf) == -1) {
+ tst_res(TFAIL | TTERRNO, "statvfs() failed");
+ return -1;
+ }
+ if(buf.f_flag & ST_RDONLY)
+ {
+ tst_res(TPASS, "%s: fspick() and reconfigure succeeded, filesystem is read-only", tc->name);
+ }else
+ {
+ tst_res(TFAIL, "%s: Filesystem is not read-only after reconfigure", tc->name);
+ }
tst_res(TPASS, "%s: fspick() passed", tc->name);
out:
expand the test items after setting FSCONFIG_CMD_RECONFIGURE to include re-fetching the mount point attributes and verifying whether the file system is set to read-only. Signed-off-by: Youzhi Zhao <zhaoyouzhi@uniontech.com> --- testcases/kernel/syscalls/fspick/fspick01.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) -- 2.43.0