Skip to contentSkip to conversation

fcntl/fcntl14: break remaining tests if cannot fork

PATCH New Han Pingtian 2 participants 2 messages Apr 11, 2016 – Apr 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fcntl/fcntl14: break remaining tests if cannot fork

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().

---
 testcases/kernel/syscalls/fcntl/fcntl14.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/fcntl/fcntl14.c +3 -4
index a6c8215..68e110e 100644
@@ -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 */
Signature · 1 line
1.9.3