public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/statx01: Add stx_mnt_id check
@ 2021-11-25  9:35 Yang Xu
  2021-11-29  9:09 ` Cyril Hrubis
  0 siblings, 1 reply; 8+ messages in thread
From: Yang Xu @ 2021-11-25  9:35 UTC (permalink / raw)
  To: ltp

This member was added since linux 5.8. We compare this value with the value in two places.
1.the mount_id filed in /proc/self/mountinfo
2.the mnt_id field in /proc/pid/fdinfo/fd

Reference url:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa2fcf4
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=728009a47497b6

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 configure.ac                              |  4 ++
 testcases/kernel/syscalls/statx/statx01.c | 55 +++++++++++++++++++++--
 2 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9101617ea..4751b14d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,6 +152,10 @@ AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!))
 AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])
 AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])
 AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>])
+AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,,[
+#define _GNU_SOURCE
+#include <sys/stat.h>
+])
 
 AC_CHECK_MEMBERS([struct utsname.domainname],,,[
 #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index bf7d21c5d..6d0e7d590 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -17,6 +17,7 @@
  * 4) blocks
  * 5) size
  * 6) nlink
+ * 7) mnt_id
  *
  * A file is created and metadata values are set with
  * predefined values.
@@ -39,9 +40,11 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/sysmacros.h>
+#include <unistd.h>
 #include "tst_test.h"
 #include "tst_safe_macros.h"
 #include "lapi/stat.h"
+#include "tst_safe_stdio.h"
 #include <string.h>
 #include <inttypes.h>
 
@@ -54,6 +57,43 @@
 #define MAJOR 8
 #define MINOR 1
 
+static int file_fd = -1;
+
+#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
+static void test_mnt_id(struct statx *buf)
+{
+	FILE *file;
+	char line[PATH_MAX];
+	int pid;
+	unsigned int line_mjr, line_mnr, mnt_id;
+
+	file = SAFE_FOPEN("/proc/self/mountinfo", "r");
+
+	while (fgets(line, sizeof(line), file)) {
+		if (sscanf(line, "%d %*d %d:%d", &mnt_id, &line_mjr, &line_mnr) != 3)
+			continue;
+
+		if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor)
+			break;
+	}
+
+	SAFE_FCLOSE(file);
+
+	if (buf->stx_mnt_id == mnt_id)
+		tst_res(TPASS,
+			"statx.stx_mnt_id equals to mount_id(%d) in /proc/self/mountinfo",
+			mnt_id);
+	else
+		tst_res(TFAIL,
+			"statx.stx_mnt_id(%d) is different from mount_id(%d) in /proc/self/mountinfo",
+			buf->stx_mnt_id, mnt_id);
+
+	pid = getpid();
+	snprintf(line, PATH_MAX, "/proc/%d/fdinfo/%d", pid, file_fd);
+	TST_ASSERT_FILE_INT(line, "mnt_id:", buf->stx_mnt_id);
+}
+#endif
+
 static void test_normal_file(void)
 {
 	struct statx buff;
@@ -106,6 +146,11 @@ static void test_normal_file(void)
 		tst_res(TFAIL, "stx_nlink(%u) is different from expected(1)",
 			buff.stx_nlink);
 
+#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
+	test_mnt_id(&buff);
+#else
+	tst_res(TCONF, "stx_mnt_id was not supported until linux 5.8.");
+#endif
 }
 
 static void test_device_file(void)
@@ -137,7 +182,6 @@ static void test_device_file(void)
 			buff.stx_rdev_minor, MINOR);
 }
 
-
 struct tcase {
 	void (*tfunc)(void);
 } tcases[] = {
@@ -153,7 +197,6 @@ static void run(unsigned int i)
 static void setup(void)
 {
 	char data_buff[SIZE];
-	int file_fd;
 
 	umask(0);
 
@@ -161,15 +204,21 @@ static void setup(void)
 
 	file_fd =  SAFE_OPEN(TESTFILE, O_RDWR|O_CREAT, MODE);
 	SAFE_WRITE(1, file_fd, data_buff, sizeof(data_buff));
-	SAFE_CLOSE(file_fd);
 
 	SAFE_MKNOD(DEVICEFILE, S_IFBLK | 0777, makedev(MAJOR, MINOR));
 }
 
+static void cleanup(void)
+{
+	if (file_fd > -1)
+		SAFE_CLOSE(file_fd);
+}
+
 static struct tst_test test = {
 	.test = run,
 	.tcnt = ARRAY_SIZE(tcases),
 	.setup = setup,
+	.cleanup = cleanup,
 	.min_kver = "4.11",
 	.needs_devfs = 1,
 	.mntpoint = MNTPOINT,
-- 
2.23.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] syscalls/statx01: Add stx_mnt_id check
  2021-11-25  9:35 [LTP] [PATCH] syscalls/statx01: Add stx_mnt_id check Yang Xu
@ 2021-11-29  9:09 ` Cyril Hrubis
  2021-11-30  3:40   ` xuyang2018.jy
  2021-11-30  7:11   ` [LTP] [PATCH v2 1/2] " Yang Xu
  0 siblings, 2 replies; 8+ messages in thread
From: Cyril Hrubis @ 2021-11-29  9:09 UTC (permalink / raw)
  To: Yang Xu; +Cc: ltp

Hi!
> +static int file_fd = -1;
> +
> +#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
> +static void test_mnt_id(struct statx *buf)
> +{
> +	FILE *file;
> +	char line[PATH_MAX];
> +	int pid;
> +	unsigned int line_mjr, line_mnr, mnt_id;

Shouldn't we check the STATX_MNT_ID bit here before we event attempt to
continue? Otherwise if we compile the test with headers where stx_mnt_id
is defined then run it on old kernel there will be garbage in the
stx_mnt_id field.

> +	file = SAFE_FOPEN("/proc/self/mountinfo", "r");
> +
> +	while (fgets(line, sizeof(line), file)) {
> +		if (sscanf(line, "%d %*d %d:%d", &mnt_id, &line_mjr, &line_mnr) != 3)
> +			continue;
> +
> +		if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor)
> +			break;
> +	}
> +
> +	SAFE_FCLOSE(file);
> +
> +	if (buf->stx_mnt_id == mnt_id)
> +		tst_res(TPASS,
> +			"statx.stx_mnt_id equals to mount_id(%d) in /proc/self/mountinfo",
> +			mnt_id);
> +	else
> +		tst_res(TFAIL,
> +			"statx.stx_mnt_id(%d) is different from mount_id(%d) in /proc/self/mountinfo",
> +			buf->stx_mnt_id, mnt_id);
> +
> +	pid = getpid();
> +	snprintf(line, PATH_MAX, "/proc/%d/fdinfo/%d", pid, file_fd);
> +	TST_ASSERT_FILE_INT(line, "mnt_id:", buf->stx_mnt_id);
> +}
> +#endif
> +
>  static void test_normal_file(void)
>  {
>  	struct statx buff;
> @@ -106,6 +146,11 @@ static void test_normal_file(void)
>  		tst_res(TFAIL, "stx_nlink(%u) is different from expected(1)",
>  			buff.stx_nlink);
>  
> +#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
> +	test_mnt_id(&buff);
> +#else
> +	tst_res(TCONF, "stx_mnt_id was not supported until linux 5.8.");

This is confusing at best, if we end up here we were missing the
structure member during compilation regardless the kernel version.

So this message really should be:

"stx_mnt_id not defined in struct statx"


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] syscalls/statx01: Add stx_mnt_id check
  2021-11-29  9:09 ` Cyril Hrubis
@ 2021-11-30  3:40   ` xuyang2018.jy
  2021-11-30  7:11   ` [LTP] [PATCH v2 1/2] " Yang Xu
  1 sibling, 0 replies; 8+ messages in thread
From: xuyang2018.jy @ 2021-11-30  3:40 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp@lists.linux.it

Hi Cyril
> Hi!
>> +static int file_fd = -1;
>> +
>> +#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
>> +static void test_mnt_id(struct statx *buf)
>> +{
>> +	FILE *file;
>> +	char line[PATH_MAX];
>> +	int pid;
>> +	unsigned int line_mjr, line_mnr, mnt_id;
>
> Shouldn't we check the STATX_MNT_ID bit here before we event attempt to
> continue? Otherwise if we compile the test with headers where stx_mnt_id
> is defined then run it on old kernel there will be garbage in the
> stx_mnt_id field.
Agree.
>
>> +	file = SAFE_FOPEN("/proc/self/mountinfo", "r");
>> +
>> +	while (fgets(line, sizeof(line), file)) {
>> +		if (sscanf(line, "%d %*d %d:%d",&mnt_id,&line_mjr,&line_mnr) != 3)
>> +			continue;
>> +
>> +		if (line_mjr == buf->stx_dev_major&&  line_mnr == buf->stx_dev_minor)
>> +			break;
>> +	}
>> +
>> +	SAFE_FCLOSE(file);
>> +
>> +	if (buf->stx_mnt_id == mnt_id)
>> +		tst_res(TPASS,
>> +			"statx.stx_mnt_id equals to mount_id(%d) in /proc/self/mountinfo",
>> +			mnt_id);
>> +	else
>> +		tst_res(TFAIL,
>> +			"statx.stx_mnt_id(%d) is different from mount_id(%d) in /proc/self/mountinfo",
>> +			buf->stx_mnt_id, mnt_id);
>> +
>> +	pid = getpid();
>> +	snprintf(line, PATH_MAX, "/proc/%d/fdinfo/%d", pid, file_fd);
>> +	TST_ASSERT_FILE_INT(line, "mnt_id:", buf->stx_mnt_id);
>> +}
>> +#endif
>> +
>>   static void test_normal_file(void)
>>   {
>>   	struct statx buff;
>> @@ -106,6 +146,11 @@ static void test_normal_file(void)
>>   		tst_res(TFAIL, "stx_nlink(%u) is different from expected(1)",
>>   			buff.stx_nlink);
>>
>> +#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
>> +	test_mnt_id(&buff);
>> +#else
>> +	tst_res(TCONF, "stx_mnt_id was not supported until linux 5.8.");
>
> This is confusing at best, if we end up here we were missing the
> structure member during compilation regardless the kernel version.
>
> So this message really should be:
>
> "stx_mnt_id not defined in struct statx"
Will do it in v2.

Best Regards
Yang Xu
>
>

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* [LTP] [PATCH v2 1/2] syscalls/statx01: Add stx_mnt_id check
  2021-11-29  9:09 ` Cyril Hrubis
  2021-11-30  3:40   ` xuyang2018.jy
@ 2021-11-30  7:11   ` Yang Xu
  2021-11-30  7:11     ` [LTP] [PATCH v2 2/2] syscalls/statx: Add docparse formatting Yang Xu
  2021-11-30 15:18     ` [LTP] [PATCH v2 1/2] syscalls/statx01: Add stx_mnt_id check Cyril Hrubis
  1 sibling, 2 replies; 8+ messages in thread
From: Yang Xu @ 2021-11-30  7:11 UTC (permalink / raw)
  To: ltp

This member was added since linux 5.8. We compare this value with the value in two places.
1.the mount_id filed in /proc/self/mountinfo
2.the mnt_id field in /proc/pid/fdinfo/fd

Reference url:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa2fcf4
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=728009a47497b6

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 configure.ac                              |  4 ++
 include/lapi/stat.h                       |  4 ++
 testcases/kernel/syscalls/statx/statx01.c | 61 +++++++++++++++++++++--
 3 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9101617ea..4751b14d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,6 +152,10 @@ AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!))
 AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])
 AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])
 AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>])
+AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,,[
+#define _GNU_SOURCE
+#include <sys/stat.h>
+])
 
 AC_CHECK_MEMBERS([struct utsname.domainname],,,[
 #define _GNU_SOURCE
diff --git a/include/lapi/stat.h b/include/lapi/stat.h
index 69162a72b..d59605887 100644
--- a/include/lapi/stat.h
+++ b/include/lapi/stat.h
@@ -176,6 +176,10 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags,
 # define STATX_BTIME		0x00000800U
 #endif
 
+#ifndef STATX_MNT_ID
+# define STATX_MNT_ID		0x00001000U
+#endif
+
 #ifndef STATX_ALL
 # define STATX_ALL		0x00000fffU
 #endif
diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index b6f52c66a..524acd273 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -17,6 +17,7 @@
  * 4) blocks
  * 5) size
  * 6) nlink
+ * 7) mnt_id
  *
  * A file is created and metadata values are set with
  * predefined values.
@@ -38,10 +39,12 @@
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <sys/types.h>
+#include <unistd.h>
 #include <sys/sysmacros.h>
 #include "tst_test.h"
 #include "tst_safe_macros.h"
 #include "lapi/stat.h"
+#include "tst_safe_stdio.h"
 #include <string.h>
 #include <inttypes.h>
 
@@ -54,6 +57,49 @@
 #define MAJOR 8
 #define MINOR 1
 
+static int file_fd = -1;
+
+#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
+static void test_mnt_id(struct statx *buf)
+{
+	FILE *file;
+	char line[PATH_MAX];
+	int pid;
+	unsigned int line_mjr, line_mnr;
+	uint64_t mnt_id;
+
+	if (!(buf->stx_mask & STATX_MNT_ID)) {
+		tst_res(TCONF, "stx_mnt_id is not supported until linux 5.8");
+		return;
+	}
+
+	file = SAFE_FOPEN("/proc/self/mountinfo", "r");
+
+	while (fgets(line, sizeof(line), file)) {
+		if (sscanf(line, "%ld %*d %d:%d", &mnt_id, &line_mjr, &line_mnr) != 3)
+			continue;
+
+		if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor)
+			break;
+	}
+
+	SAFE_FCLOSE(file);
+
+	if (buf->stx_mnt_id == mnt_id)
+		tst_res(TPASS,
+			"statx.stx_mnt_id equals to mount_id(%"PRIu64") in /proc/self/mountinfo",
+			mnt_id);
+	else
+		tst_res(TFAIL,
+			"statx.stx_mnt_id(%"PRIu64") is different from mount_id(%"PRIu64") in /proc/self/mountinfo",
+			(uint64_t)buf->stx_mnt_id, mnt_id);
+
+	pid = getpid();
+	snprintf(line, PATH_MAX, "/proc/%d/fdinfo/%d", pid, file_fd);
+	TST_ASSERT_FILE_INT(line, "mnt_id:", buf->stx_mnt_id);
+}
+#endif
+
 static void test_normal_file(void)
 {
 	struct statx buff;
@@ -92,7 +138,6 @@ static void test_normal_file(void)
 		tst_res(TFAIL, "stx_mode(%u) is different from expected(%u)",
 			buff.stx_mode, MODE);
 
-
 	if (buff.stx_blocks <= buff.stx_blksize/512 * 2)
 		tst_res(TPASS, "stx_blocks(%"PRIu64") is valid",
 			(uint64_t)buff.stx_blocks);
@@ -106,6 +151,11 @@ static void test_normal_file(void)
 		tst_res(TFAIL, "stx_nlink(%u) is different from expected(1)",
 			buff.stx_nlink);
 
+#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
+	test_mnt_id(&buff);
+#else
+	tst_res(TCONF, "stx_mnt_id is not defined in struct statx");
+#endif
 }
 
 static void test_device_file(void)
@@ -153,7 +203,6 @@ static void run(unsigned int i)
 static void setup(void)
 {
 	char data_buff[SIZE];
-	int file_fd;
 
 	umask(0);
 
@@ -161,15 +210,21 @@ static void setup(void)
 
 	file_fd =  SAFE_OPEN(TESTFILE, O_RDWR|O_CREAT, MODE);
 	SAFE_WRITE(1, file_fd, data_buff, sizeof(data_buff));
-	SAFE_CLOSE(file_fd);
 
 	SAFE_MKNOD(DEVICEFILE, S_IFBLK | 0777, makedev(MAJOR, MINOR));
 }
 
+static void cleanup(void)
+{
+	if (file_fd > -1)
+		SAFE_CLOSE(file_fd);
+}
+
 static struct tst_test test = {
 	.test = run,
 	.tcnt = ARRAY_SIZE(tcases),
 	.setup = setup,
+	.cleanup = cleanup,
 	.min_kver = "4.11",
 	.needs_devfs = 1,
 	.mntpoint = MNTPOINT,
-- 
2.23.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* [LTP] [PATCH v2 2/2] syscalls/statx: Add docparse formatting
  2021-11-30  7:11   ` [LTP] [PATCH v2 1/2] " Yang Xu
@ 2021-11-30  7:11     ` Yang Xu
  2021-11-30 15:54       ` Cyril Hrubis
  2021-11-30 15:18     ` [LTP] [PATCH v2 1/2] syscalls/statx01: Add stx_mnt_id check Cyril Hrubis
  1 sibling, 1 reply; 8+ messages in thread
From: Yang Xu @ 2021-11-30  7:11 UTC (permalink / raw)
  To: ltp

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/statx/statx01.c | 31 +++++++++------------
 testcases/kernel/syscalls/statx/statx02.c | 12 +++++----
 testcases/kernel/syscalls/statx/statx03.c | 26 +++++++-----------
 testcases/kernel/syscalls/statx/statx05.c |  8 +++---
 testcases/kernel/syscalls/statx/statx06.c | 33 +++++++----------------
 testcases/kernel/syscalls/statx/statx07.c | 21 ++++++++-------
 6 files changed, 53 insertions(+), 78 deletions(-)

diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index 524acd273..b52bb2988 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -4,35 +4,28 @@
  * Email: code@zilogic.com
  */
 
-/*
- * Test statx
+/*\
+ * [Description]
  *
  * This code tests the functionality of statx system call.
  *
  * TESTCASE 1:
  * The metadata for normal file are tested against predefined values:
- * 1) gid
- * 2) uid
- * 3) mode
- * 4) blocks
- * 5) size
- * 6) nlink
- * 7) mnt_id
  *
- * A file is created and metadata values are set with
- * predefined values.
- * Then the values obtained using statx is checked against
- * the predefined values.
+ * - gid
+ * - uid
+ * - mode
+ * - blocks
+ * - size
+ * - nlink
+ * - mnt_id
  *
  * TESTCASE 2:
  * The metadata for device file are tested against predefined values:
- * 1) MAJOR number
- * 2) MINOR number
  *
- * A device file is created seperately using mknod(must be a root user).
- * The major number and minor number are set while creation.
- * Major and minor numbers obtained using statx is checked against
- * predefined values.
+ * - MAJOR number
+ * - MINOR number
+ *
  * Minimum kernel version required is 4.11.
  */
 
diff --git a/testcases/kernel/syscalls/statx/statx02.c b/testcases/kernel/syscalls/statx/statx02.c
index 63133a3b7..56577599c 100644
--- a/testcases/kernel/syscalls/statx/statx02.c
+++ b/testcases/kernel/syscalls/statx/statx02.c
@@ -4,12 +4,13 @@
  * Email: code@zilogic.com
  */
 
-/*
- * Test statx
+/*\
+ * [Description]
+ *
+ * This code tests the following flags with statx syscall:
  *
- * This code tests the following flags:
- * 1) AT_EMPTY_PATH
- * 2) AT_SYMLINK_NOFOLLOW
+ * - AT_EMPTY_PATH
+ * - AT_SYMLINK_NOFOLLOW
  *
  * A test file and a link for it is created.
  *
@@ -19,6 +20,7 @@
  * To check symlink no follow flag, the linkname is statxed.
  * To ensure that link is not dereferenced, obtained inode is compared
  * with test file inode.
+ *
  * Minimum kernel version required is 4.11.
  */
 
diff --git a/testcases/kernel/syscalls/statx/statx03.c b/testcases/kernel/syscalls/statx/statx03.c
index c72d7fead..de2fe4d38 100644
--- a/testcases/kernel/syscalls/statx/statx03.c
+++ b/testcases/kernel/syscalls/statx/statx03.c
@@ -4,25 +4,17 @@
  * Email: code@zilogic.com
  */
 
-/*
- * Test statx
+/*\
+ * [Description]
  *
- * This code tests if expected error values are returned for specific cases by
- * statx.
- * The error cases are simulated and the return value is checked against
- * expected error number value.
- * The following error values are tested:
- * 1) EBADF - Bad file descriptor
- * 2) EFAULT - Bad address
- * 3) EINVAL - Invalid argument
- * 4) ENOENT - No such file or directory
- * 5) ENOTDIR - Not a directory
- * 6) ENAMETOOLONG - Filename too long
+ * Test basic error handling of statx syscall:
  *
- * Error scenario is simulated for each listed flag by passing
- * respective arguments.
- * The obtained error flag is checked against the expected
- * flag value for that scenario.
+ * - EBADF - Bad file descriptor
+ * - EFAULT - Bad address
+ * - EINVAL - Invalid argument
+ * - ENOENT - No such file or directory
+ * - ENOTDIR - Not a directory
+ * - ENAMETOOLONG - Filename too long
  *
  * Minimum Kernel version required is 4.11.
  */
diff --git a/testcases/kernel/syscalls/statx/statx05.c b/testcases/kernel/syscalls/statx/statx05.c
index 81a5bcbf2..83c6c3ab5 100644
--- a/testcases/kernel/syscalls/statx/statx05.c
+++ b/testcases/kernel/syscalls/statx/statx05.c
@@ -4,10 +4,12 @@
  * Email: code@zilogic.com
  */
 
-/*
- * Test statx
+/*\
+ * [Description]
+ *
+ * Test statx syscall with STATX_ATTR_ENCRYPTED flag
  *
- * 1) STATX_ATTR_ENCRYPTED - A key is required for the file to be encrypted by
+ * - STATX_ATTR_ENCRYPTEDL: A key is required for the file to be encrypted by
  *                          the filesystem.
  *
  * e4crypt is used to set the encrypt flag (currently supported only by ext4).
diff --git a/testcases/kernel/syscalls/statx/statx06.c b/testcases/kernel/syscalls/statx/statx06.c
index 0469d66c5..4a0685a65 100644
--- a/testcases/kernel/syscalls/statx/statx06.c
+++ b/testcases/kernel/syscalls/statx/statx06.c
@@ -1,36 +1,21 @@
 // SPDX-License-Identifier: GPL-2.0 or later
 /*
- *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
- *  Email : code@zilogic.com
+ * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
+ * Email : code@zilogic.com
  */
 
-/*
- * DESCRIPTION :
+/*\
+ * [Description]
  *
- * Test-Case 1 : Testing btime
- * flow :       The time before and after the execution of the create
- *              system call is noted.
- *		It is checked whether the birth time returned by statx lies in
- *              this range.
+ * Test the following file timestamps of statx syscall:
  *
- * Test-Case 2 : Testing mtime
- * flow :       The time before and after the execution of the write
- *              system call is noted.
- *              It is checked whether the modification time returned
- *              by statx lies in this range.
+ * - btime - The time before and after the execution of the create system call is noted.
  *
- * Test-Case 3 : Testing atime
- * flow :       The time before and after the execution of the read
- *              system call is noted.
- *              It is checked whether the access time returned by statx lies in
- *              this range.
+ * - mtime - The time before and after the execution of the write system call is noted.
  *
- * Test-Case 4 : Testing ctime
- * flow :	The time before and after the execution of the chmod
- *              system call is noted.
- *              It is checked whether the status change time returned by statx
- *              lies in this range.
+ * - atime - The time before and after the execution of the read system call is noted.
  *
+ * - ctime - The time before and after the execution of the chmod system call is noted.
  */
 
 #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/statx/statx07.c b/testcases/kernel/syscalls/statx/statx07.c
index ec1cdd190..e7045edaa 100644
--- a/testcases/kernel/syscalls/statx/statx07.c
+++ b/testcases/kernel/syscalls/statx/statx07.c
@@ -1,15 +1,16 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
- *  Email : code@zilogic.com
+ * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
+ * Email : code@zilogic.com
  */
 
-/*
- * Test statx
+/*\
+ * [Description]
  *
  * This code tests the following flags:
- * 1) AT_STATX_FORCE_SYNC
- * 2) AT_STATX_DONT_SYNC
+ *
+ * - AT_STATX_FORCE_SYNC
+ * - AT_STATX_DONT_SYNC
  *
  * By exportfs cmd creating NFS setup.
  *
@@ -29,11 +30,11 @@
  *
  * The support for SYNC flags was implemented in NFS in:
  *
- * commit 9ccee940bd5b766b6dab6c1a80908b9490a4850d
- * Author: Trond Myklebust <trond.myklebust@primarydata.com>
- * Date:   Thu Jan 4 17:46:09 2018 -0500
+ *  commit 9ccee940bd5b766b6dab6c1a80908b9490a4850d
+ *  Author: Trond Myklebust <trond.myklebust@primarydata.com>
+ *  Date:   Thu Jan 4 17:46:09 2018 -0500
  *
- *     Support statx() mask and query flags parameters
+ *  Support statx() mask and query flags parameters
  *
  * Hence we skip the test on anything older than 4.16.
  */
-- 
2.23.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 1/2] syscalls/statx01: Add stx_mnt_id check
  2021-11-30  7:11   ` [LTP] [PATCH v2 1/2] " Yang Xu
  2021-11-30  7:11     ` [LTP] [PATCH v2 2/2] syscalls/statx: Add docparse formatting Yang Xu
@ 2021-11-30 15:18     ` Cyril Hrubis
  1 sibling, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2021-11-30 15:18 UTC (permalink / raw)
  To: Yang Xu; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 2/2] syscalls/statx: Add docparse formatting
  2021-11-30  7:11     ` [LTP] [PATCH v2 2/2] syscalls/statx: Add docparse formatting Yang Xu
@ 2021-11-30 15:54       ` Cyril Hrubis
  2021-12-01  1:51         ` xuyang2018.jy
  0 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2021-11-30 15:54 UTC (permalink / raw)
  To: Yang Xu; +Cc: ltp

On Tue, Nov 30, 2021 at 03:11:13PM +0800, Yang Xu wrote:
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  testcases/kernel/syscalls/statx/statx01.c | 31 +++++++++------------
>  testcases/kernel/syscalls/statx/statx02.c | 12 +++++----
>  testcases/kernel/syscalls/statx/statx03.c | 26 +++++++-----------
>  testcases/kernel/syscalls/statx/statx05.c |  8 +++---
>  testcases/kernel/syscalls/statx/statx06.c | 33 +++++++----------------
>  testcases/kernel/syscalls/statx/statx07.c | 21 ++++++++-------
>  6 files changed, 53 insertions(+), 78 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
> index 524acd273..b52bb2988 100644
> --- a/testcases/kernel/syscalls/statx/statx01.c
> +++ b/testcases/kernel/syscalls/statx/statx01.c
> @@ -4,35 +4,28 @@
>   * Email: code@zilogic.com
>   */
>  
> -/*
> - * Test statx
> +/*\
> + * [Description]
>   *
>   * This code tests the functionality of statx system call.
>   *
>   * TESTCASE 1:

Can we drop the TESTCASE 1: here and TESTCASE 2: below?

The rendered documentation looks better without these two.

>   * The metadata for normal file are tested against predefined values:
                                                        ^
							expected?

predefined sounds strange a bit strange.

> - * 1) gid
> - * 2) uid
> - * 3) mode
> - * 4) blocks
> - * 5) size
> - * 6) nlink
> - * 7) mnt_id
>   *
> - * A file is created and metadata values are set with
> - * predefined values.
> - * Then the values obtained using statx is checked against
> - * the predefined values.
> + * - gid
> + * - uid
> + * - mode
> + * - blocks
> + * - size
> + * - nlink
> + * - mnt_id
>   *
>   * TESTCASE 2:
>   * The metadata for device file are tested against predefined values:
> - * 1) MAJOR number
> - * 2) MINOR number
>   *
> - * A device file is created seperately using mknod(must be a root user).
> - * The major number and minor number are set while creation.
> - * Major and minor numbers obtained using statx is checked against
> - * predefined values.
> + * - MAJOR number
> + * - MINOR number
> + *
>   * Minimum kernel version required is 4.11.

We do have min_kver in the tst_test structure and it's in the parsed
metadata as well, so I wouldn't repeat it here.

>   */
>  
> diff --git a/testcases/kernel/syscalls/statx/statx02.c b/testcases/kernel/syscalls/statx/statx02.c
> index 63133a3b7..56577599c 100644
> --- a/testcases/kernel/syscalls/statx/statx02.c
> +++ b/testcases/kernel/syscalls/statx/statx02.c
> @@ -4,12 +4,13 @@
>   * Email: code@zilogic.com
>   */
>  
> -/*
> - * Test statx
> +/*\
> + * [Description]
> + *
> + * This code tests the following flags with statx syscall:
>   *
> - * This code tests the following flags:
> - * 1) AT_EMPTY_PATH
> - * 2) AT_SYMLINK_NOFOLLOW
> + * - AT_EMPTY_PATH
> + * - AT_SYMLINK_NOFOLLOW
>   *
>   * A test file and a link for it is created.
>   *
> @@ -19,6 +20,7 @@
>   * To check symlink no follow flag, the linkname is statxed.
>   * To ensure that link is not dereferenced, obtained inode is compared
>   * with test file inode.
> + *
>   * Minimum kernel version required is 4.11.

Here as well no need to repeat the minimal kernel version.

>   */
>  
> diff --git a/testcases/kernel/syscalls/statx/statx03.c b/testcases/kernel/syscalls/statx/statx03.c
> index c72d7fead..de2fe4d38 100644
> --- a/testcases/kernel/syscalls/statx/statx03.c
> +++ b/testcases/kernel/syscalls/statx/statx03.c
> @@ -4,25 +4,17 @@
>   * Email: code@zilogic.com
>   */
>  
> -/*
> - * Test statx
> +/*\
> + * [Description]
>   *
> - * This code tests if expected error values are returned for specific cases by
> - * statx.
> - * The error cases are simulated and the return value is checked against
> - * expected error number value.
> - * The following error values are tested:
> - * 1) EBADF - Bad file descriptor
> - * 2) EFAULT - Bad address
> - * 3) EINVAL - Invalid argument
> - * 4) ENOENT - No such file or directory
> - * 5) ENOTDIR - Not a directory
> - * 6) ENAMETOOLONG - Filename too long
> + * Test basic error handling of statx syscall:
>   *
> - * Error scenario is simulated for each listed flag by passing
> - * respective arguments.
> - * The obtained error flag is checked against the expected
> - * flag value for that scenario.
> + * - EBADF - Bad file descriptor
> + * - EFAULT - Bad address
> + * - EINVAL - Invalid argument
> + * - ENOENT - No such file or directory
> + * - ENOTDIR - Not a directory
> + * - ENAMETOOLONG - Filename too long
>   *
>   * Minimum Kernel version required is 4.11.

Here as well.

>   */
> diff --git a/testcases/kernel/syscalls/statx/statx05.c b/testcases/kernel/syscalls/statx/statx05.c
> index 81a5bcbf2..83c6c3ab5 100644
> --- a/testcases/kernel/syscalls/statx/statx05.c
> +++ b/testcases/kernel/syscalls/statx/statx05.c
> @@ -4,10 +4,12 @@
>   * Email: code@zilogic.com
>   */
>  
> -/*
> - * Test statx
> +/*\
> + * [Description]
> + *
> + * Test statx syscall with STATX_ATTR_ENCRYPTED flag
>   *
> - * 1) STATX_ATTR_ENCRYPTED - A key is required for the file to be encrypted by
> + * - STATX_ATTR_ENCRYPTEDL: A key is required for the file to be encrypted by
>   *                          the filesystem.

The list with single entry looks strange here. I would rewrite it as:

Test statx syscall with STATX_ATTR_ENCRYPTED flag, if set a key is
required for the file to be encrypted by the filesystem.

>   * e4crypt is used to set the encrypt flag (currently supported only by ext4).

And here as well, no need to repeat the minimal kernel version.

> diff --git a/testcases/kernel/syscalls/statx/statx06.c b/testcases/kernel/syscalls/statx/statx06.c
> index 0469d66c5..4a0685a65 100644
> --- a/testcases/kernel/syscalls/statx/statx06.c
> +++ b/testcases/kernel/syscalls/statx/statx06.c
> @@ -1,36 +1,21 @@
>  // SPDX-License-Identifier: GPL-2.0 or later
>  /*
> - *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
> - *  Email : code@zilogic.com
> + * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
> + * Email : code@zilogic.com
>   */
>  
> -/*
> - * DESCRIPTION :
> +/*\
> + * [Description]
>   *
> - * Test-Case 1 : Testing btime
> - * flow :       The time before and after the execution of the create
> - *              system call is noted.
> - *		It is checked whether the birth time returned by statx lies in
> - *              this range.
> + * Test the following file timestamps of statx syscall:
>   *
> - * Test-Case 2 : Testing mtime
> - * flow :       The time before and after the execution of the write
> - *              system call is noted.
> - *              It is checked whether the modification time returned
> - *              by statx lies in this range.
> + * - btime - The time before and after the execution of the create system call is noted.
>   *
> - * Test-Case 3 : Testing atime
> - * flow :       The time before and after the execution of the read
> - *              system call is noted.
> - *              It is checked whether the access time returned by statx lies in
> - *              this range.
> + * - mtime - The time before and after the execution of the write system call is noted.
>   *
> - * Test-Case 4 : Testing ctime
> - * flow :	The time before and after the execution of the chmod
> - *              system call is noted.
> - *              It is checked whether the status change time returned by statx
> - *              lies in this range.
> + * - atime - The time before and after the execution of the read system call is noted.
>   *
> + * - ctime - The time before and after the execution of the chmod system call is noted.
>   */
>  
>  #define _GNU_SOURCE
> diff --git a/testcases/kernel/syscalls/statx/statx07.c b/testcases/kernel/syscalls/statx/statx07.c
> index ec1cdd190..e7045edaa 100644
> --- a/testcases/kernel/syscalls/statx/statx07.c
> +++ b/testcases/kernel/syscalls/statx/statx07.c
> @@ -1,15 +1,16 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  /*
> - *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
> - *  Email : code@zilogic.com
> + * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
> + * Email : code@zilogic.com
>   */
>  
> -/*
> - * Test statx
> +/*\
> + * [Description]
>   *
>   * This code tests the following flags:
> - * 1) AT_STATX_FORCE_SYNC
> - * 2) AT_STATX_DONT_SYNC
> + *
> + * - AT_STATX_FORCE_SYNC
> + * - AT_STATX_DONT_SYNC
>   *
>   * By exportfs cmd creating NFS setup.
>   *
> @@ -29,11 +30,11 @@
>   *
>   * The support for SYNC flags was implemented in NFS in:
>   *
> - * commit 9ccee940bd5b766b6dab6c1a80908b9490a4850d
> - * Author: Trond Myklebust <trond.myklebust@primarydata.com>
> - * Date:   Thu Jan 4 17:46:09 2018 -0500
> + *  commit 9ccee940bd5b766b6dab6c1a80908b9490a4850d
> + *  Author: Trond Myklebust <trond.myklebust@primarydata.com>
> + *  Date:   Thu Jan 4 17:46:09 2018 -0500
>   *
> - *     Support statx() mask and query flags parameters
> + *  Support statx() mask and query flags parameters
>   *
>   * Hence we skip the test on anything older than 4.16.

Here as well, no need to repeat the minimal kernel version.

> */
> -- 
> 2.23.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH v2 2/2] syscalls/statx: Add docparse formatting
  2021-11-30 15:54       ` Cyril Hrubis
@ 2021-12-01  1:51         ` xuyang2018.jy
  0 siblings, 0 replies; 8+ messages in thread
From: xuyang2018.jy @ 2021-12-01  1:51 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp@lists.linux.it

HI Cyril
> On Tue, Nov 30, 2021 at 03:11:13PM +0800, Yang Xu wrote:
>> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com>
>> ---
>>   testcases/kernel/syscalls/statx/statx01.c | 31 +++++++++------------
>>   testcases/kernel/syscalls/statx/statx02.c | 12 +++++----
>>   testcases/kernel/syscalls/statx/statx03.c | 26 +++++++-----------
>>   testcases/kernel/syscalls/statx/statx05.c |  8 +++---
>>   testcases/kernel/syscalls/statx/statx06.c | 33 +++++++----------------
>>   testcases/kernel/syscalls/statx/statx07.c | 21 ++++++++-------
>>   6 files changed, 53 insertions(+), 78 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
>> index 524acd273..b52bb2988 100644
>> --- a/testcases/kernel/syscalls/statx/statx01.c
>> +++ b/testcases/kernel/syscalls/statx/statx01.c
>> @@ -4,35 +4,28 @@
>>    * Email: code@zilogic.com
>>    */
>>
>> -/*
>> - * Test statx
>> +/*\
>> + * [Description]
>>    *
>>    * This code tests the functionality of statx system call.
>>    *
>>    * TESTCASE 1:
>
> Can we drop the TESTCASE 1: here and TESTCASE 2: below?
I have dropped them.
>
> The rendered documentation looks better without these two.
>
>>    * The metadata for normal file are tested against predefined values:
>                                                          ^
> 							expected?
>
> predefined sounds strange a bit strange.

Yes.
>
>> - * 1) gid
>> - * 2) uid
>> - * 3) mode
>> - * 4) blocks
>> - * 5) size
>> - * 6) nlink
>> - * 7) mnt_id
>>    *
>> - * A file is created and metadata values are set with
>> - * predefined values.
>> - * Then the values obtained using statx is checked against
>> - * the predefined values.
>> + * - gid
>> + * - uid
>> + * - mode
>> + * - blocks
>> + * - size
>> + * - nlink
>> + * - mnt_id
>>    *
>>    * TESTCASE 2:
>>    * The metadata for device file are tested against predefined values:
>> - * 1) MAJOR number
>> - * 2) MINOR number
>>    *
>> - * A device file is created seperately using mknod(must be a root user).
>> - * The major number and minor number are set while creation.
>> - * Major and minor numbers obtained using statx is checked against
>> - * predefined values.
>> + * - MAJOR number
>> + * - MINOR number
>> + *
>>    * Minimum kernel version required is 4.11.
>
> We do have min_kver in the tst_test structure and it's in the parsed
> metadata as well, so I wouldn't repeat it here.
OK. I also removed them in statx04.c and statx08.c.

Since this patch is a simple docparase formattting fix, I will add your 
reviewed-by and then push the two patches directly.

the difference as below:
diff --git a/testcases/kernel/syscalls/statx/statx01.c 
b/testcases/kernel/syscalls/statx/statx01.c
index 6d20f8ff9..98e1dfcda 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -9,8 +9,7 @@
   *
   * This code tests the functionality of statx system call.
   *
- * TESTCASE 1:
- * The metadata for normal file are tested against predefined values:
+ * The metadata for normal file are tested against expected values:
   *
   * - gid
   * - uid
@@ -20,13 +19,10 @@
   * - nlink
   * - mnt_id
   *
- * TESTCASE 2:
- * The metadata for device file are tested against predefined values:
+ * The metadata for device file are tested against expected values:
   *
   * - MAJOR number
   * - MINOR number
- *
- * Minimum kernel version required is 4.11.
   */

  #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/statx/statx02.c 
b/testcases/kernel/syscalls/statx/statx02.c
index 88a819daf..c96859f44 100644
--- a/testcases/kernel/syscalls/statx/statx02.c
+++ b/testcases/kernel/syscalls/statx/statx02.c
@@ -20,8 +20,6 @@
   * To check symlink no follow flag, the linkname is statxed.
   * To ensure that link is not dereferenced, obtained inode is compared
   * with test file inode.
- *
- * Minimum kernel version required is 4.11.
   */

  #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/statx/statx03.c 
b/testcases/kernel/syscalls/statx/statx03.c
index de2fe4d38..b88809063 100644
--- a/testcases/kernel/syscalls/statx/statx03.c
+++ b/testcases/kernel/syscalls/statx/statx03.c
@@ -15,8 +15,6 @@
   * - ENOENT - No such file or directory
   * - ENOTDIR - Not a directory
   * - ENAMETOOLONG - Filename too long
- *
- * Minimum Kernel version required is 4.11.
   */

  #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/statx/statx04.c 
b/testcases/kernel/syscalls/statx/statx04.c
index f66b04f70..a3ca436f5 100644
--- a/testcases/kernel/syscalls/statx/statx04.c
+++ b/testcases/kernel/syscalls/statx/statx04.c
@@ -47,8 +47,6 @@
   *  Date:   Fri Mar 31 18:32:03 2017 +0100
   *
   *  xfs: report crtime and attribute flags to statx
- *
- * Minimum kernel version required is 4.11.
   */

  #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/statx/statx05.c 
b/testcases/kernel/syscalls/statx/statx05.c
index 446102329..a3184e7e3 100644
--- a/testcases/kernel/syscalls/statx/statx05.c
+++ b/testcases/kernel/syscalls/statx/statx05.c
@@ -7,10 +7,8 @@
  /*\
   * [Description]
   *
- * Test statx syscall with STATX_ATTR_ENCRYPTED flag
- *
- * - STATX_ATTR_ENCRYPTEDL: A key is required for the file to be 
encrypted by
- *                          the filesystem.
+ * Test statx syscall with STATX_ATTR_ENCRYPTED flag, setting a key is 
required
+ * for the file to be encrypted by the filesystem.
   *
   * e4crypt is used to set the encrypt flag (currently supported only 
by ext4).
   *
@@ -18,7 +16,6 @@
   * First directory has all flags set.
   * Second directory has no flags set.
   *
- * Minimum kernel version required is 4.11.
   * Minimum e2fsprogs version required is 1.43.
   */

diff --git a/testcases/kernel/syscalls/statx/statx07.c 
b/testcases/kernel/syscalls/statx/statx07.c
index 28df758ec..89de0c487 100644
--- a/testcases/kernel/syscalls/statx/statx07.c
+++ b/testcases/kernel/syscalls/statx/statx07.c
@@ -17,12 +17,10 @@
   * A test file is created in server folder and statx is being
   * done in client folder.
   *
- * TESTCASE 1:
   * BY AT_STATX_SYNC_AS_STAT getting predefined mode value.
   * Then, by using AT_STATX_FORCE_SYNC getting new updated vaue
   * from server file changes.
   *
- * TESTCASE 2:
   * BY AT_STATX_SYNC_AS_STAT getting predefined mode value.
   * AT_STATX_FORCE_SYNC is called to create cache data of the file.
   * Then, by using DONT_SYNC_FILE getting old cached data in client folder,
@@ -35,8 +33,6 @@
   *  Date:   Thu Jan 4 17:46:09 2018 -0500
   *
   *  Support statx() mask and query flags parameters
- *
- * Hence we skip the test on anything older than 4.16.
   */

  #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/statx/statx08.c 
b/testcases/kernel/syscalls/statx/statx08.c
index e0dbab28f..10b1ca460 100644
--- a/testcases/kernel/syscalls/statx/statx08.c
+++ b/testcases/kernel/syscalls/statx/statx08.c
@@ -19,8 +19,6 @@
   *
   * Two directories are tested.
   * First directory has all flags set. Second directory has no flags set.
- *
- * Minimum kernel version required is 4.11.
   */

  #define _GNU_SOURCE


>
>>    */
>>
>> diff --git a/testcases/kernel/syscalls/statx/statx02.c b/testcases/kernel/syscalls/statx/statx02.c
>> index 63133a3b7..56577599c 100644
>> --- a/testcases/kernel/syscalls/statx/statx02.c
>> +++ b/testcases/kernel/syscalls/statx/statx02.c
>> @@ -4,12 +4,13 @@
>>    * Email: code@zilogic.com
>>    */
>>
>> -/*
>> - * Test statx
>> +/*\
>> + * [Description]
>> + *
>> + * This code tests the following flags with statx syscall:
>>    *
>> - * This code tests the following flags:
>> - * 1) AT_EMPTY_PATH
>> - * 2) AT_SYMLINK_NOFOLLOW
>> + * - AT_EMPTY_PATH
>> + * - AT_SYMLINK_NOFOLLOW
>>    *
>>    * A test file and a link for it is created.
>>    *
>> @@ -19,6 +20,7 @@
>>    * To check symlink no follow flag, the linkname is statxed.
>>    * To ensure that link is not dereferenced, obtained inode is compared
>>    * with test file inode.
>> + *
>>    * Minimum kernel version required is 4.11.
>
> Here as well no need to repeat the minimal kernel version.
>
>>    */
>>
>> diff --git a/testcases/kernel/syscalls/statx/statx03.c b/testcases/kernel/syscalls/statx/statx03.c
>> index c72d7fead..de2fe4d38 100644
>> --- a/testcases/kernel/syscalls/statx/statx03.c
>> +++ b/testcases/kernel/syscalls/statx/statx03.c
>> @@ -4,25 +4,17 @@
>>    * Email: code@zilogic.com
>>    */
>>
>> -/*
>> - * Test statx
>> +/*\
>> + * [Description]
>>    *
>> - * This code tests if expected error values are returned for specific cases by
>> - * statx.
>> - * The error cases are simulated and the return value is checked against
>> - * expected error number value.
>> - * The following error values are tested:
>> - * 1) EBADF - Bad file descriptor
>> - * 2) EFAULT - Bad address
>> - * 3) EINVAL - Invalid argument
>> - * 4) ENOENT - No such file or directory
>> - * 5) ENOTDIR - Not a directory
>> - * 6) ENAMETOOLONG - Filename too long
>> + * Test basic error handling of statx syscall:
>>    *
>> - * Error scenario is simulated for each listed flag by passing
>> - * respective arguments.
>> - * The obtained error flag is checked against the expected
>> - * flag value for that scenario.
>> + * - EBADF - Bad file descriptor
>> + * - EFAULT - Bad address
>> + * - EINVAL - Invalid argument
>> + * - ENOENT - No such file or directory
>> + * - ENOTDIR - Not a directory
>> + * - ENAMETOOLONG - Filename too long
>>    *
>>    * Minimum Kernel version required is 4.11.
>
> Here as well.
>
>>    */
>> diff --git a/testcases/kernel/syscalls/statx/statx05.c b/testcases/kernel/syscalls/statx/statx05.c
>> index 81a5bcbf2..83c6c3ab5 100644
>> --- a/testcases/kernel/syscalls/statx/statx05.c
>> +++ b/testcases/kernel/syscalls/statx/statx05.c
>> @@ -4,10 +4,12 @@
>>    * Email: code@zilogic.com
>>    */
>>
>> -/*
>> - * Test statx
>> +/*\
>> + * [Description]
>> + *
>> + * Test statx syscall with STATX_ATTR_ENCRYPTED flag
>>    *
>> - * 1) STATX_ATTR_ENCRYPTED - A key is required for the file to be encrypted by
>> + * - STATX_ATTR_ENCRYPTEDL: A key is required for the file to be encrypted by
>>    *                          the filesystem.
>
> The list with single entry looks strange here. I would rewrite it as:
>
> Test statx syscall with STATX_ATTR_ENCRYPTED flag, if set a key is
> required for the file to be encrypted by the filesystem.
>
>>    * e4crypt is used to set the encrypt flag (currently supported only by ext4).
>
> And here as well, no need to repeat the minimal kernel version.
>
>> diff --git a/testcases/kernel/syscalls/statx/statx06.c b/testcases/kernel/syscalls/statx/statx06.c
>> index 0469d66c5..4a0685a65 100644
>> --- a/testcases/kernel/syscalls/statx/statx06.c
>> +++ b/testcases/kernel/syscalls/statx/statx06.c
>> @@ -1,36 +1,21 @@
>>   // SPDX-License-Identifier: GPL-2.0 or later
>>   /*
>> - *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
>> - *  Email : code@zilogic.com
>> + * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
>> + * Email : code@zilogic.com
>>    */
>>
>> -/*
>> - * DESCRIPTION :
>> +/*\
>> + * [Description]
>>    *
>> - * Test-Case 1 : Testing btime
>> - * flow :       The time before and after the execution of the create
>> - *              system call is noted.
>> - *		It is checked whether the birth time returned by statx lies in
>> - *              this range.
>> + * Test the following file timestamps of statx syscall:
>>    *
>> - * Test-Case 2 : Testing mtime
>> - * flow :       The time before and after the execution of the write
>> - *              system call is noted.
>> - *              It is checked whether the modification time returned
>> - *              by statx lies in this range.
>> + * - btime - The time before and after the execution of the create system call is noted.
>>    *
>> - * Test-Case 3 : Testing atime
>> - * flow :       The time before and after the execution of the read
>> - *              system call is noted.
>> - *              It is checked whether the access time returned by statx lies in
>> - *              this range.
>> + * - mtime - The time before and after the execution of the write system call is noted.
>>    *
>> - * Test-Case 4 : Testing ctime
>> - * flow :	The time before and after the execution of the chmod
>> - *              system call is noted.
>> - *              It is checked whether the status change time returned by statx
>> - *              lies in this range.
>> + * - atime - The time before and after the execution of the read system call is noted.
>>    *
>> + * - ctime - The time before and after the execution of the chmod system call is noted.
>>    */
>>
>>   #define _GNU_SOURCE
>> diff --git a/testcases/kernel/syscalls/statx/statx07.c b/testcases/kernel/syscalls/statx/statx07.c
>> index ec1cdd190..e7045edaa 100644
>> --- a/testcases/kernel/syscalls/statx/statx07.c
>> +++ b/testcases/kernel/syscalls/statx/statx07.c
>> @@ -1,15 +1,16 @@
>>   // SPDX-License-Identifier: GPL-2.0-or-later
>>   /*
>> - *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
>> - *  Email : code@zilogic.com
>> + * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
>> + * Email : code@zilogic.com
>>    */
>>
>> -/*
>> - * Test statx
>> +/*\
>> + * [Description]
>>    *
>>    * This code tests the following flags:
>> - * 1) AT_STATX_FORCE_SYNC
>> - * 2) AT_STATX_DONT_SYNC
>> + *
>> + * - AT_STATX_FORCE_SYNC
>> + * - AT_STATX_DONT_SYNC
>>    *
>>    * By exportfs cmd creating NFS setup.
>>    *
>> @@ -29,11 +30,11 @@
>>    *
>>    * The support for SYNC flags was implemented in NFS in:
>>    *
>> - * commit 9ccee940bd5b766b6dab6c1a80908b9490a4850d
>> - * Author: Trond Myklebust<trond.myklebust@primarydata.com>
>> - * Date:   Thu Jan 4 17:46:09 2018 -0500
>> + *  commit 9ccee940bd5b766b6dab6c1a80908b9490a4850d
>> + *  Author: Trond Myklebust<trond.myklebust@primarydata.com>
>> + *  Date:   Thu Jan 4 17:46:09 2018 -0500
>>    *
>> - *     Support statx() mask and query flags parameters
>> + *  Support statx() mask and query flags parameters
>>    *
>>    * Hence we skip the test on anything older than 4.16.
>
> Here as well, no need to repeat the minimal kernel version.
>
>> */
>> --
>> 2.23.0
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2021-12-01  1:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-25  9:35 [LTP] [PATCH] syscalls/statx01: Add stx_mnt_id check Yang Xu
2021-11-29  9:09 ` Cyril Hrubis
2021-11-30  3:40   ` xuyang2018.jy
2021-11-30  7:11   ` [LTP] [PATCH v2 1/2] " Yang Xu
2021-11-30  7:11     ` [LTP] [PATCH v2 2/2] syscalls/statx: Add docparse formatting Yang Xu
2021-11-30 15:54       ` Cyril Hrubis
2021-12-01  1:51         ` xuyang2018.jy
2021-11-30 15:18     ` [LTP] [PATCH v2 1/2] syscalls/statx01: Add stx_mnt_id check Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox