All of lore.kernel.org
 help / color / mirror / Atom feed
From: ice_yangxiao@163.com <ice_yangxiao@163.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] syscalls/{wait401.c, waitpid01.c}: Take use of TST_EXP_PID_SILENT()
Date: Mon, 19 Apr 2021 10:38:44 +0800	[thread overview]
Message-ID: <20210419023845.19140-2-ice_yangxiao@163.com> (raw)
In-Reply-To: <20210419023845.19140-1-ice_yangxiao@163.com>

From: Xiao Yang <yangx.jy@fujitsu.com>

Also correct the name(waitpid=>wait4) in the output of wait401.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 testcases/kernel/syscalls/wait4/wait401.c     | 10 +++-------
 testcases/kernel/syscalls/waitpid/waitpid01.c | 12 +++++-------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/testcases/kernel/syscalls/wait4/wait401.c b/testcases/kernel/syscalls/wait4/wait401.c
index 07fb864f3..405b0e133 100644
--- a/testcases/kernel/syscalls/wait4/wait401.c
+++ b/testcases/kernel/syscalls/wait4/wait401.c
@@ -29,17 +29,13 @@ static void run(void)
 		exit(0);
 	}
 
-	TEST(wait4(pid, &status, 0, &rusage));
-	if (TST_RET == -1) {
-		tst_res(TFAIL | TTERRNO, "wait4() failed");
-		return;
-	}
+	TST_EXP_PID_SILENT(wait4(pid, &status, 0, &rusage), "wait4()");
 
 	if (TST_RET != pid) {
-		tst_res(TFAIL, "waitpid() returned wrong pid %li, expected %i",
+		tst_res(TFAIL, "wait4() returned wrong pid %li, expected %i",
 			TST_RET, pid);
 	} else {
-		tst_res(TPASS, "waitpid() returned correct pid %i", pid);
+		tst_res(TPASS, "wait4() returned correct pid %i", pid);
 	}
 
 	if (!WIFEXITED(status)) {
diff --git a/testcases/kernel/syscalls/waitpid/waitpid01.c b/testcases/kernel/syscalls/waitpid/waitpid01.c
index 6e03acef6..0c5096f4e 100644
--- a/testcases/kernel/syscalls/waitpid/waitpid01.c
+++ b/testcases/kernel/syscalls/waitpid/waitpid01.c
@@ -18,7 +18,7 @@
 
 static void run(void)
 {
-	pid_t pid, rpid;
+	pid_t pid;
 	int status;
 
 	pid = SAFE_FORK();
@@ -27,13 +27,11 @@ static void run(void)
 		exit(0);
 	}
 
-	rpid = waitpid(pid, &status, 0);
-	if (rpid < 0)
-		tst_brk(TBROK | TERRNO, "waitpid() failed");
+	TST_EXP_PID_SILENT(waitpid(pid, &status, 0));
 
-	if (rpid != pid) {
-		tst_res(TFAIL, "waitpid() returned wrong pid %i, expected %i",
-		        rpid, pid);
+	if (TST_RET != pid) {
+		tst_res(TFAIL, "waitpid() returned wrong pid %li, expected %i",
+			TST_RET, pid);
 	} else {
 		tst_res(TPASS, "waitpid() returned correct pid %i", pid);
 	}
-- 
2.26.2


  reply	other threads:[~2021-04-19  2:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19  2:38 [LTP] [PATCH 1/2] include/tst_test_macros.h: Add TST_EXP_PID and TST_EXP_PID_SILENT macros ice_yangxiao
2021-04-19  2:38 ` ice_yangxiao [this message]
2021-04-19  4:43 ` Xiao Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419023845.19140-2-ice_yangxiao@163.com \
    --to=ice_yangxiao@163.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.