git: eeabf9cb937a - main - stress2: Fix long run time

From: Peter Holm <pho_at_FreeBSD.org>
Date: Tue, 20 Dec 2022 09:13:18 UTC
The branch main has been updated by pho:

URL: https://cgit.FreeBSD.org/src/commit/?id=eeabf9cb937a8a98b17a434cc79f755fe01b0d03

commit eeabf9cb937a8a98b17a434cc79f755fe01b0d03
Author:     Peter Holm <pho@FreeBSD.org>
AuthorDate: 2022-12-20 09:12:01 +0000
Commit:     Peter Holm <pho@FreeBSD.org>
CommitDate: 2022-12-20 09:12:01 +0000

    stress2: Fix long run time
---
 tools/test/stress2/misc/forkbomb.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/test/stress2/misc/forkbomb.sh b/tools/test/stress2/misc/forkbomb.sh
index 73a3c5f37fe2..caaaa27db281 100755
--- a/tools/test/stress2/misc/forkbomb.sh
+++ b/tools/test/stress2/misc/forkbomb.sh
@@ -81,7 +81,7 @@ volatile u_int *share;
 #define R4 4 /* fork failed */
 
 //#define DEBUG
-#define MXFAIL 100
+#define MXFAIL 2
 #define MAXPROC 40000	/* Arbitrary cap */
 #define PARALLEL 200
 
@@ -93,7 +93,7 @@ test(void)
 	alarm(1200);
 	atomic_add_int(&share[R1], 1);
 	while (share[R1] != PARALLEL)
-		;
+		usleep(100);
 	atomic_add_int(&share[R2], 1);
 
 	for (;;) {
@@ -103,6 +103,7 @@ test(void)
 		if ((r = fork()) == -1) {
 			atomic_add_int(&share[R4], 1);
 			atomic_add_int(&share[R2], -1);
+			usleep(arc4random() % 100000);
 			break;
 		}
 	}