[LTP] [PATCH 1/1] tree: Use TST_EXP_FAIL2() for wait{,id}

Petr Vorel pvorel@suse.cz
Thu Feb 1 16:13:57 CET 2024


Both wait() and waitid() returns PID, therefore (similarly as for file
descriptor) pass condition is >= 0, which is in TST_EXP_FAIL2().

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/pidfd_open/pidfd_open04.c | 2 +-
 testcases/kernel/syscalls/wait/wait01.c             | 2 +-
 testcases/kernel/syscalls/waitid/waitid02.c         | 2 +-
 testcases/kernel/syscalls/waitid/waitid03.c         | 2 +-
 testcases/kernel/syscalls/waitid/waitid05.c         | 2 +-
 testcases/kernel/syscalls/waitid/waitid06.c         | 2 +-
 testcases/kernel/syscalls/waitid/waitid09.c         | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open04.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open04.c
index 0e8ab6956..9f83d2b72 100644
--- a/testcases/kernel/syscalls/pidfd_open/pidfd_open04.c
+++ b/testcases/kernel/syscalls/pidfd_open/pidfd_open04.c
@@ -45,7 +45,7 @@ static void run(void)
 
 	tst_res(TPASS, "pidfd_open(%d, O_NONBLOCK) sets O_NONBLOCK flag", pid);
 
-	TST_EXP_FAIL(waitid(P_PIDFD, pidfd, &info, WEXITED), EAGAIN,
+	TST_EXP_FAIL2(waitid(P_PIDFD, pidfd, &info, WEXITED), EAGAIN,
 			"waitid(P_PIDFD,...,WEXITED)");
 
 	TST_CHECKPOINT_WAKE(0);
diff --git a/testcases/kernel/syscalls/wait/wait01.c b/testcases/kernel/syscalls/wait/wait01.c
index aec91b911..8245898dd 100644
--- a/testcases/kernel/syscalls/wait/wait01.c
+++ b/testcases/kernel/syscalls/wait/wait01.c
@@ -16,7 +16,7 @@
 
 static void verify_wait(void)
 {
-	TST_EXP_FAIL(wait(NULL), ECHILD);
+	TST_EXP_FAIL2(wait(NULL), ECHILD);
 }
 
 static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/waitid/waitid02.c b/testcases/kernel/syscalls/waitid/waitid02.c
index f13a4ed00..c5b27939b 100644
--- a/testcases/kernel/syscalls/waitid/waitid02.c
+++ b/testcases/kernel/syscalls/waitid/waitid02.c
@@ -18,7 +18,7 @@ static siginfo_t *infop;
 
 static void run(void)
 {
-	TST_EXP_FAIL(waitid(P_ALL, 0, infop, WNOHANG), EINVAL);
+	TST_EXP_FAIL2(waitid(P_ALL, 0, infop, WNOHANG), EINVAL);
 }
 
 static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/waitid/waitid03.c b/testcases/kernel/syscalls/waitid/waitid03.c
index ef3fd7376..a44a030df 100644
--- a/testcases/kernel/syscalls/waitid/waitid03.c
+++ b/testcases/kernel/syscalls/waitid/waitid03.c
@@ -19,7 +19,7 @@ static siginfo_t *infop;
 
 static void run(void)
 {
-	TST_EXP_FAIL(waitid(P_ALL, 0, infop, WNOHANG | WEXITED), ECHILD);
+	TST_EXP_FAIL2(waitid(P_ALL, 0, infop, WNOHANG | WEXITED), ECHILD);
 }
 
 static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/waitid/waitid05.c b/testcases/kernel/syscalls/waitid/waitid05.c
index 1b9186dc1..004d48b97 100644
--- a/testcases/kernel/syscalls/waitid/waitid05.c
+++ b/testcases/kernel/syscalls/waitid/waitid05.c
@@ -31,7 +31,7 @@ static void run(void)
 
 	pid_group = getpgid(0);
 
-	TST_EXP_FAIL(waitid(P_PGID, pid_group+1, infop, WEXITED), ECHILD);
+	TST_EXP_FAIL2(waitid(P_PGID, pid_group+1, infop, WEXITED), ECHILD);
 
 	memset(infop, 0, sizeof(*infop));
 	TST_EXP_PASS(waitid(P_PGID, pid_group, infop, WEXITED));
diff --git a/testcases/kernel/syscalls/waitid/waitid06.c b/testcases/kernel/syscalls/waitid/waitid06.c
index 5f51c81c8..003d10d6e 100644
--- a/testcases/kernel/syscalls/waitid/waitid06.c
+++ b/testcases/kernel/syscalls/waitid/waitid06.c
@@ -28,7 +28,7 @@ static void run(void)
 	if (!pid_child)
 		exit(0);
 
-	TST_EXP_FAIL(waitid(P_PID, pid_child+1, infop, WEXITED), ECHILD);
+	TST_EXP_FAIL2(waitid(P_PID, pid_child+1, infop, WEXITED), ECHILD);
 
 	memset(infop, 0, sizeof(*infop));
 	TST_EXP_PASS(waitid(P_PID, pid_child, infop, WEXITED));
diff --git a/testcases/kernel/syscalls/waitid/waitid09.c b/testcases/kernel/syscalls/waitid/waitid09.c
index 115c2e672..935c1754c 100644
--- a/testcases/kernel/syscalls/waitid/waitid09.c
+++ b/testcases/kernel/syscalls/waitid/waitid09.c
@@ -24,7 +24,7 @@ static void run(void)
 	if (!SAFE_FORK())
 		exit(0);
 
-	TST_EXP_FAIL(waitid(P_PID, 1, infop, WEXITED), ECHILD);
+	TST_EXP_FAIL2(waitid(P_PID, 1, infop, WEXITED), ECHILD);
 }
 
 static struct tst_test test = {
-- 
2.43.0



More information about the ltp mailing list