* [LTP] [PATCH] syscalls/fspick:add coverage for fspick01.c
@ 2024-09-02 6:12 YouZhi Zhao
2025-02-21 8:55 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 3+ messages in thread
From: YouZhi Zhao @ 2024-09-02 6:12 UTC (permalink / raw)
To: ltp
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(-)
diff --git a/testcases/kernel/syscalls/fspick/fspick01.c b/testcases/kernel/syscalls/fspick/fspick01.c
index d3309a912..7aabb1d9e 100644
--- a/testcases/kernel/syscalls/fspick/fspick01.c
+++ b/testcases/kernel/syscalls/fspick/fspick01.c
@@ -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:
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [LTP] [PATCH] syscalls/fspick:add coverage for fspick01.c
2024-09-02 6:12 [LTP] [PATCH] syscalls/fspick:add coverage for fspick01.c YouZhi Zhao
@ 2025-02-21 8:55 ` Andrea Cervesato via ltp
2025-02-21 10:51 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Andrea Cervesato via ltp @ 2025-02-21 8:55 UTC (permalink / raw)
To: YouZhi Zhao, ltp
Hi!
This test is meant to test fspick() syscall, but this patch is actually
adding one more check for fsconfig(FSCONFIG_SET_FLAG), which is probably
the reason why this should be done inside an another test under fsconfig
testing suite. For this reason, the patch will be rejected.
Best regards,
Andrea Cervesato
On 9/2/24 08:12, YouZhi Zhao wrote:
> 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(-)
>
> diff --git a/testcases/kernel/syscalls/fspick/fspick01.c b/testcases/kernel/syscalls/fspick/fspick01.c
> index d3309a912..7aabb1d9e 100644
> --- a/testcases/kernel/syscalls/fspick/fspick01.c
> +++ b/testcases/kernel/syscalls/fspick/fspick01.c
> @@ -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:
> --
> 2.43.0
>
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [LTP] [PATCH] syscalls/fspick:add coverage for fspick01.c
2025-02-21 8:55 ` Andrea Cervesato via ltp
@ 2025-02-21 10:51 ` Cyril Hrubis
0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2025-02-21 10:51 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: YouZhi Zhao, ltp
Hi!
> This test is meant to test fspick() syscall, but this patch is actually
> adding one more check for fsconfig(FSCONFIG_SET_FLAG), which is probably
> the reason why this should be done inside an another test under fsconfig
> testing suite. For this reason, the patch will be rejected.
Quite contrary, it checks that the final call to fspick() with
FSCONFIG_CMD_RECONFIGURE does apply the changes to the filesystem.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-21 10:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 6:12 [LTP] [PATCH] syscalls/fspick:add coverage for fspick01.c YouZhi Zhao
2025-02-21 8:55 ` Andrea Cervesato via ltp
2025-02-21 10:51 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.