From 4e93e0b10544e4461b6fd36cbcec94a6e419fa02 Mon Sep 17 00:00:00 2001 From: Scott Haseley Date: Fri, 22 Apr 2016 14:54:10 -0400 Subject: [PATCH] Forkbomb changes. First, use a local success string and make sure to access it early so a page gets allocated. Second, change the timeout for the vm stability test to 20s. It looks like some students are right up on this boundary. --- test161/tests/vm/stability/forkbomb.t | 3 +++ userland/testbin/forkbomb/forkbomb.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/test161/tests/vm/stability/forkbomb.t b/test161/tests/vm/stability/forkbomb.t index 3ffbb30..57b4d04 100644 --- a/test161/tests/vm/stability/forkbomb.t +++ b/test161/tests/vm/stability/forkbomb.t @@ -13,5 +13,8 @@ monitor: kernel: enablemin: true min: 0.01 +commandoverrides: + - name: /testbin/forkbomb + timeout: 20.0 --- p /testbin/forkbomb diff --git a/userland/testbin/forkbomb/forkbomb.c b/userland/testbin/forkbomb/forkbomb.c index 581da14..01af4c2 100644 --- a/userland/testbin/forkbomb/forkbomb.c +++ b/userland/testbin/forkbomb/forkbomb.c @@ -53,6 +53,7 @@ #include #define TEST_DURATION 10 +#define LOCAL_SUCCESS "SUCCESS" static volatile int pid; @@ -74,6 +75,9 @@ main(void) // we will probably be out of pages by the time we try to print success. secprintf(SECRET, "!!< Starting Forkbbbboooommmmbbbb >!!", "/testbin/forkbomb"); + // And now for the success string + printf("This should print %s after 10s\n", LOCAL_SUCCESS); + while (1) { fork(); // Only parent gets to print @@ -87,7 +91,9 @@ main(void) __time(&time_now_s, &time_now_ns); if (time_now_s - start_time_s > TEST_DURATION && !did_print) { did_print = 1; - success(TEST161_SUCCESS, SECRET, "/testbin/forkbomb"); + // We need to print this using secprintf so that it uses + // the same page we warmed up earlier. + secprintf(SECRET, LOCAL_SUCCESS, "/testbin/forkbomb"); } }