diff mbox series

[v5,1/3] syscalls/statx04: Skip STATX_ATTR_COMPRESSED flag when tesing xfs

Message ID 1637049352-25731-1-git-send-email-xuyang2018.jy@fujitsu.com
State Accepted
Headers show
Series [v5,1/3] syscalls/statx04: Skip STATX_ATTR_COMPRESSED flag when tesing xfs | expand

Commit Message

Yang Xu Nov. 16, 2021, 7:55 a.m. UTC
Since STATX_ATTR_COMPRESSED flag are non-supported on xfs, we should skip
it and test three other flags.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/statx/statx04.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

Comments

Richard Palethorpe Nov. 16, 2021, 9:47 a.m. UTC | #1
Hello,

Yang Xu <xuyang2018.jy@fujitsu.com> writes:

> Since STATX_ATTR_COMPRESSED flag are non-supported on xfs, we should skip
> it and test three other flags.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>

Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/statx/statx04.c b/testcases/kernel/syscalls/statx/statx04.c
index f8350ed2d..6881ce261 100644
--- a/testcases/kernel/syscalls/statx/statx04.c
+++ b/testcases/kernel/syscalls/statx/statx04.c
@@ -20,6 +20,9 @@ 
  * First directory has all flags set.
  * Second directory has no flags set.
  *
+ * xfs filesystem doesn't support STATX_ATTR_COMPRESSED flags, so we only test
+ * three other flags.
+ *
  * Minimum kernel version required is 4.11.
  */
 
@@ -47,10 +50,12 @@  static void test_flagged(void)
 		tst_brk(TFAIL | TTERRNO,
 			"sys_statx(AT_FDCWD, %s, 0, 0, &buf)", TESTDIR_FLAGGED);
 
-	if (buf.stx_attributes & STATX_ATTR_COMPRESSED)
-		tst_res(TPASS, "STATX_ATTR_COMPRESSED flag is set");
-	else
-		tst_res(TFAIL, "STATX_ATTR_COMPRESSED flag is not set");
+	if(strcmp(tst_device->fs_type, "xfs")) {
+		if (buf.stx_attributes & STATX_ATTR_COMPRESSED)
+			tst_res(TPASS, "STATX_ATTR_COMPRESSED flag is set");
+		else
+			tst_res(TFAIL, "STATX_ATTR_COMPRESSED flag is not set");
+	}
 
 	if (buf.stx_attributes & STATX_ATTR_APPEND)
 		tst_res(TPASS, "STATX_ATTR_APPEND flag is set");
@@ -135,7 +140,10 @@  static void caid_flags_setup(void)
 		tst_brk(TBROK | TERRNO, "ioctl(%i, FS_IOC_GETFLAGS, ...)", fd);
 	}
 
-	attr |= FS_COMPR_FL | FS_APPEND_FL | FS_IMMUTABLE_FL | FS_NODUMP_FL;
+	if(!strcmp(tst_device->fs_type, "xfs"))
+		attr |= FS_APPEND_FL | FS_IMMUTABLE_FL | FS_NODUMP_FL;
+	else
+		attr |= FS_COMPR_FL | FS_APPEND_FL | FS_IMMUTABLE_FL | FS_NODUMP_FL;
 
 	ret = ioctl(fd, FS_IOC_SETFLAGS, &attr);
 	if (ret < 0) {