From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] waitid/waitid01: break test if fork() failed
Date: Thu, 14 Apr 2016 16:04:25 +0800 [thread overview]
Message-ID: <20160414080425.GA10586@localhost.localdomain> (raw)
Or a lot of processes will be killed when -1 passed as pid to kill().
Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
---
testcases/kernel/syscalls/waitid/waitid01.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/testcases/kernel/syscalls/waitid/waitid01.c b/testcases/kernel/syscalls/waitid/waitid01.c
index c19f0da..1729aa3 100644
--- a/testcases/kernel/syscalls/waitid/waitid01.c
+++ b/testcases/kernel/syscalls/waitid/waitid01.c
@@ -130,6 +130,10 @@ int main(int ac, char **av)
for (testno = 0; testno < TST_TOTAL; ++testno) {
TEST(fork());
+ if (TEST_RETURN < 0)
+ tst_brkm(TBROK | TTERRNO, NULL,
+ "fork() failed");
+
if (TEST_RETURN == 0) {
exit(123);
} else {
@@ -143,6 +147,10 @@ int main(int ac, char **av)
}
TEST(fork());
+ if (TEST_RETURN < 0)
+ tst_brkm(TBROK | TTERRNO, NULL,
+ "fork() failed");
+
if (TEST_RETURN == 0) {
int a, b = 0;
a = 1 / b;
@@ -157,6 +165,10 @@ int main(int ac, char **av)
}
TEST(pid = fork());
+ if (TEST_RETURN < 0)
+ tst_brkm(TBROK | TTERRNO, NULL,
+ "fork() failed");
+
if (TEST_RETURN == 0) {
TEST(sleep(10));
tst_exit();
--
1.9.3
next reply other threads:[~2016-04-14 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 8:04 Han Pingtian [this message]
2016-04-18 19:15 ` [LTP] [PATCH] waitid/waitid01: break test if fork() failed Cyril Hrubis
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=20160414080425.GA10586@localhost.localdomain \
--to=hanpt@linux.vnet.ibm.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.