[LTP] [PATCH v2 2/2] pipe07: refactor exp_num_pipes

Edward Liaw edliaw@google.com
Mon Oct 2 19:34:16 CEST 2023


Move doubling the exp_num_pipes into the value.

Signed-off-by: Edward Liaw <edliaw@google.com>
---
 testcases/kernel/syscalls/pipe/pipe07.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c
index d9b23044d..8098007c2 100644
--- a/testcases/kernel/syscalls/pipe/pipe07.c
+++ b/testcases/kernel/syscalls/pipe/pipe07.c
@@ -58,8 +58,8 @@ static void setup(void)
 	tst_res(TINFO, "getdtablesize() = %d", max_fds);
 	pipe_fds = SAFE_MALLOC(max_fds * sizeof(int));
 
-	exp_num_pipes = (max_fds - record_open_fds()) / 2;
-	tst_res(TINFO, "expected max fds to be opened by pipe(): %d", exp_num_pipes * 2);
+	exp_num_pipes = (max_fds - record_open_fds()) / 2 * 2;
+	tst_res(TINFO, "expected max fds to be opened by pipe(): %d", exp_num_pipes);
 }
 
 static void run(void)
@@ -75,7 +75,7 @@ static void run(void)
 	} while (!TST_RET);
 
 	TST_EXP_EQ_LI(errno, EMFILE);
-	TST_EXP_EQ_LI(exp_num_pipes * 2, num_pipe_fds);
+	TST_EXP_EQ_LI(exp_num_pipes, num_pipe_fds);
 
 	for (int i = 0; i < num_pipe_fds; i++)
 		SAFE_CLOSE(pipe_fds[i]);
-- 
2.42.0.582.g8ccd20d70d-goog



More information about the ltp mailing list