All of lore.kernel.org
 help / color / mirror / Atom feed
From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fcntl/fcntl14: break remaining tests if cannot fork
Date: Mon, 11 Apr 2016 22:27:36 +0800	[thread overview]
Message-ID: <20160411142736.GA406@localhost.localdomain> (raw)

It has been observed that if the test continued after the failure of
fork, a lot of other processes on the same machine will be killed by
the signal handler catch_alarm().

Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
---
 testcases/kernel/syscalls/fcntl/fcntl14.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/fcntl/fcntl14.c b/testcases/kernel/syscalls/fcntl/fcntl14.c
index a6c8215..68e110e 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl14.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl14.c
@@ -755,6 +755,7 @@ void dochild(void)
 		switch (pid) {
 		case -1:
 			tst_resm(TFAIL, "Fork failed");
+			fail = 1;
 			break;
 		case 0:	/* child */
 #ifdef UCLINUX
@@ -872,8 +873,7 @@ void run_test(int file_flag, int file_mode, int seek, int start, int end)
 #endif
 		}
 		if (child < 0) {
-			tst_resm(TFAIL, "Fork failed");
-			cleanup();
+			tst_brkm(TBROK|TERRNO, cleanup, "Fork failed");
 		}
 		/* parent process */
 		if ((thiscase->c_flag) == WILLBLOCK) {
@@ -1145,8 +1145,7 @@ int main(int ac, char **av)
 #endif
 		}
 		if (child < 0) {
-			tst_resm(TFAIL, "Fork failed");
-			cleanup();
+			tst_brkm(TBROK|TERRNO, cleanup, "Fork failed");
 		}
 
 		/* parent process */
-- 
1.9.3


             reply	other threads:[~2016-04-11 14:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-11 14:27 Han Pingtian [this message]
2016-04-12 10:52 ` [LTP] [PATCH] fcntl/fcntl14: break remaining tests if cannot fork 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=20160411142736.GA406@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.