Skip to contentSkip to conversation

Split waitid01.c test into multiple tests

PATCH In review Andrea Cervesato 2 participants 2 messages Feb 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Split waitid01.c test into multiple tests

Introduced LTP API usage and splitted waitid01.c into three tests:
waitid01, waitid10 and waitid11.

---
 runtest/syscalls                            |   2 +
 testcases/kernel/syscalls/waitid/.gitignore |   2 +
 testcases/kernel/syscalls/waitid/waitid01.c | 151 +++++---------------
 testcases/kernel/syscalls/waitid/waitid10.c |  47 ++++++
 testcases/kernel/syscalls/waitid/waitid11.c |  48 +++++++
 5 files changed, 133 insertions(+), 117 deletions(-)
 create mode 100644 testcases/kernel/syscalls/waitid/waitid10.c
 create mode 100644 testcases/kernel/syscalls/waitid/waitid11.c
runtest/syscalls +2 -0
index d48216a15..59e495193 100644
@@ -1706,6 +1706,8 @@ waitid06 waitid06
 waitid07 waitid07
 waitid08 waitid08
 waitid09 waitid09
+waitid10 waitid10
+waitid11 waitid11
 
 write01 write01
 write02 write02
testcases/kernel/syscalls/waitid/.gitignore +2 -0
index 315af1690..089d860c7 100644
@@ -7,3 +7,5 @@
 /waitid07
 /waitid08
 /waitid09
+/waitid10
+/waitid11
testcases/kernel/syscalls/waitid/waitid01.c +34 -117

160 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid10.c new file +47 -0

47 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid11.c new file +48 -0

48 lines not on this page · raw message

Signature · 5 lines
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!
Pushed with a few changes, thanks.

Apart from formatting changes there were two functional changes I did.

- with P_ALL the the id parameter is ignored so I've changed it to 0

- the CLD_DUMPED case is a bit more complicated, since have to make sure that core dumps are enabled, so I did add a setup fucntion that attempts to raise rlimit(RLIMIT_CORE) and if that fails we expect CLD_KILLED instead of CLD_DUMPED

Full diff:

testcases/kernel/syscalls/waitid/waitid01.c +5 -6
index 60ecf9022..136eec8a6 100644
@@ -25,7 +25,7 @@ static void run(void)
 	if (!pidchild)
 		exit(123);
 
-	TST_EXP_PASS(waitid(P_ALL, getpid(), infop, WEXITED));
+	TST_EXP_PASS(waitid(P_ALL, 0, infop, WEXITED));
 	TST_EXP_EQ_LI(infop->si_pid, pidchild);
 	TST_EXP_EQ_LI(infop->si_status, 123);
 	TST_EXP_EQ_LI(infop->si_signo, SIGCHLD);
@@ -35,9 +35,8 @@ static void run(void)
 static struct tst_test test = {
 	.test_all = run,
 	.forks_child = 1,
-	.bufs =
-		(struct tst_buffers[]){
-			{ &infop, .size = sizeof(*infop) },
-			{},
-		},
+	.bufs = (struct tst_buffers[]) {
+		{&infop, .size = sizeof(*infop)},
+		{},
+	},
 };
testcases/kernel/syscalls/waitid/waitid10.c +35 -8

66 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid11.c +5 -6
index 8f2b847ea..e3754bb1d 100644
@@ -24,7 +24,7 @@ static void run(void)
 
 	pidchild = SAFE_FORK();
 	if (!pidchild) {
-		sleep(10);
+		pause();
 		return;
 	}
 
@@ -40,9 +40,8 @@ static void run(void)
 static struct tst_test test = {
 	.test_all = run,
 	.forks_child = 1,
-	.bufs =
-		(struct tst_buffers[]){
-			{ &infop, .size = sizeof(*infop) },
-			{},
-		},
+	.bufs =	(struct tst_buffers[]) {
+		{&infop, .size = sizeof(*infop)},
+		{},
+	},
 };
Signature · 5 lines
Cyril Hrubis
[email protected]

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