All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/statx04: use stx_attributes_mask before test
@ 2019-08-02 10:34 Yang Xu
  2019-08-02 11:50 ` Cyril Hrubis
  0 siblings, 1 reply; 19+ messages in thread
From: Yang Xu @ 2019-08-02 10:34 UTC (permalink / raw)
  To: ltp

stx_attributes_mask shows what's supported in stx_attributes.
we should check four attrbutes whether supports on tested filesystem
and report the non-supported attributes  before test.

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

diff --git a/testcases/kernel/syscalls/statx/statx04.c b/testcases/kernel/syscalls/statx/statx04.c
index 71de734f5..e4b198c07 100644
--- a/testcases/kernel/syscalls/statx/statx04.c
+++ b/testcases/kernel/syscalls/statx/statx04.c
@@ -138,23 +138,37 @@ static void caid_flags_setup(void)
 	attr |= FS_COMPR_FL | FS_APPEND_FL | FS_IMMUTABLE_FL | FS_NODUMP_FL;
 
 	ret = ioctl(fd, FS_IOC_SETFLAGS, &attr);
-	if (ret < 0) {
-		if (errno == EOPNOTSUPP)
-			tst_brk(TCONF, "Flags not supported");
+	if (ret < 0)
 		tst_brk(TBROK | TERRNO, "ioctl(%i, FS_IOC_SETFLAGS, %i)", fd, attr);
-	}
 
 	clear_flags = 1;
 }
 
 static void setup(void)
 {
+	struct statx buf;
+
 	SAFE_MKDIR(TESTDIR_FLAGGED, 0777);
 	SAFE_MKDIR(TESTDIR_UNFLAGGED, 0777);
 
 	if (!strcmp(tst_device->fs_type, "btrfs") && tst_kvercmp(4, 13, 0) < 0)
 		tst_brk(TCONF, "Btrfs statx() supported since 4.13");
 
+	TEST(statx(AT_FDCWD, TESTDIR_FLAGGED, 0, 0, &buf));
+	if (TST_RET == -1)
+		tst_brk(TFAIL | TTERRNO,
+			"sys_statx(AT_FDCWD, %s, 0, 0, &buf)", TESTDIR_FLAGGED);
+
+	/* Mask to show which attributes are supported on filesystem. */
+	if ((buf.stx_attributes_mask & FS_COMPR_FL) == 0)
+		tst_brk(TCONF, "filesystem doesn't support FS_COMPR_FL");
+	if ((buf.stx_attributes_mask & FS_APPEND_FL) == 0)
+		tst_brk(TCONF, "filesystem doesn't support FS_APPEND_FL");
+	if ((buf.stx_attributes_mask & FS_IMMUTABLE_FL) == 0)
+		tst_brk(TCONF, "filesystem doesn't support FS_IMMUTABLE_FL");
+	if ((buf.stx_attributes_mask & FS_NODUMP_FL) == 0)
+		tst_brk(TCONF, "filesystem doesn't support FS_NODUMP_FL");
+
 	caid_flags_setup();
 }
 
-- 
2.18.1




^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-11-11  3:26 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 10:34 [LTP] [PATCH] syscalls/statx04: use stx_attributes_mask before test Yang Xu
2019-08-02 11:50 ` Cyril Hrubis
2019-08-20  6:33   ` [LTP] [PATCH v2] " Yang Xu
2019-08-27  9:25     ` Petr Vorel
2019-08-27  9:58       ` Petr Vorel
2019-08-27 10:16         ` Cyril Hrubis
2019-09-11 10:22           ` =?unknown-8bit?b?WWFuZy/lvpAg5p2o?=
2019-09-11 12:47             ` Cyril Hrubis
2019-09-12  3:28               ` =?unknown-8bit?b?WWFuZy/lvpAg5p2o?=
2019-10-25  3:53               ` [LTP] [PATCH] " Yang Xu
2019-10-31 10:03                 ` Yang Xu
2021-05-25 13:18                 ` Li Wang
2021-05-25 14:16                   ` Cyril Hrubis
2021-05-26  4:00                     ` xuyang2018.jy
2021-05-26  8:31                       ` Li Wang
2021-05-26 10:02                         ` xuyang2018.jy
2021-11-10 13:28                 ` Richard Palethorpe
2021-11-11  3:25                   ` xuyang2018.jy
2019-08-28  3:56       ` [LTP] [PATCH v2] " Yang Xu

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.