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.
This commit is contained in:
Scott Haseley 2016-04-22 14:54:10 -04:00
parent 4bfe7afef3
commit 4e93e0b105
2 changed files with 10 additions and 1 deletions

View File

@ -13,5 +13,8 @@ monitor:
kernel: kernel:
enablemin: true enablemin: true
min: 0.01 min: 0.01
commandoverrides:
- name: /testbin/forkbomb
timeout: 20.0
--- ---
p /testbin/forkbomb p /testbin/forkbomb

View File

@ -53,6 +53,7 @@
#include <test161/test161.h> #include <test161/test161.h>
#define TEST_DURATION 10 #define TEST_DURATION 10
#define LOCAL_SUCCESS "SUCCESS"
static volatile int pid; 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. // we will probably be out of pages by the time we try to print success.
secprintf(SECRET, "!!< Starting Forkbbbboooommmmbbbb >!!", "/testbin/forkbomb"); secprintf(SECRET, "!!< Starting Forkbbbboooommmmbbbb >!!", "/testbin/forkbomb");
// And now for the success string
printf("This should print %s after 10s\n", LOCAL_SUCCESS);
while (1) { while (1) {
fork(); fork();
// Only parent gets to print // Only parent gets to print
@ -87,7 +91,9 @@ main(void)
__time(&time_now_s, &time_now_ns); __time(&time_now_s, &time_now_ns);
if (time_now_s - start_time_s > TEST_DURATION && !did_print) { if (time_now_s - start_time_s > TEST_DURATION && !did_print) {
did_print = 1; 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");
} }
} }