[LTP] [PATCH] syscalls/splice06: minimum pipe-max-size is page size

Jan Stancek jstancek@redhat.com
Tue Oct 17 09:34:14 CEST 2023


Test currently fails on ppc64le/aarch64 with page sizes > 4k, because
miminum pipe-max-size allowed is page size:

  splice06.c:178: TPASS: Read num through splice correctly
  splice06.c:187: TBROK: Write num through splice failed: SUCCESS (0)

>From kernel's fs/pipe.c:
	unsigned int round_pipe_size(unsigned int size)
	{
		if (size > (1U << 31))
			return 0;

		/* Minimum pipe size, as required by POSIX */
		if (size < PAGE_SIZE)
			return PAGE_SIZE;

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/splice/splice06.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/splice/splice06.c b/testcases/kernel/syscalls/splice/splice06.c
index 3139d16db84d..0cb5dec29136 100644
--- a/testcases/kernel/syscalls/splice/splice06.c
+++ b/testcases/kernel/syscalls/splice/splice06.c
@@ -25,11 +25,11 @@
 
 #define BUF_SIZE 100
 #define PIPE_MAX_INIT_SIZE 65536
-#define PIPE_MAX_TEST_SIZE 4096
 #define DOMAIN_INIT_NAME "LTP_INIT"
 #define DOMAIN_TEST_NAME "LTP_TEST"
 #define INTEGER_PROCFILE "/proc/sys/fs/pipe-max-size"
 #define STRING_PROCFILE "/proc/sys/kernel/domainname"
+static int pipe_max_test_size;
 
 static void format_str(char *str)
 {
@@ -179,9 +179,9 @@ static void splice_test(void)
 	else
 		tst_brk(TBROK | TERRNO, "Read num through splice failed");
 
-	splice_write_num(INTEGER_PROCFILE, PIPE_MAX_TEST_SIZE);
+	splice_write_num(INTEGER_PROCFILE, pipe_max_test_size);
 
-	if (file_read_num(INTEGER_PROCFILE) == PIPE_MAX_TEST_SIZE)
+	if (file_read_num(INTEGER_PROCFILE) == pipe_max_test_size)
 		tst_res(TPASS, "Write num through splice correctly");
 	else
 		tst_brk(TBROK | TERRNO, "Write num through splice failed");
@@ -210,6 +210,7 @@ static void splice_test(void)
 
 static void setup(void)
 {
+	pipe_max_test_size = getpagesize();
 	file_write_str(STRING_PROCFILE, DOMAIN_INIT_NAME);
 	file_write_num(STRING_PROCFILE, PIPE_MAX_INIT_SIZE);
 }
-- 
2.31.1



More information about the ltp mailing list