diff --git a/test161/commands/asst2.tc b/test161/commands/asst2.tc index 475fd28..ad259de 100644 --- a/test161/commands/asst2.tc +++ b/test161/commands/asst2.tc @@ -21,13 +21,6 @@ templates: - name: /testbin/forkbomb timesout: yes timeout: 15.0 - output: - - text: "/testbin/forkbomb: SUCCESS" - - text: "/testbin/forkbomb: SUCCESS" - - text: "/testbin/forkbomb: SUCCESS" - - text: "/testbin/forkbomb: SUCCESS" - - text: "/testbin/forkbomb: SUCCESS" - - name: kmalloc output: - text: "kmalloc: out of memory" diff --git a/userland/testbin/forkbomb/forkbomb.c b/userland/testbin/forkbomb/forkbomb.c index ac60fd6..74398e6 100644 --- a/userland/testbin/forkbomb/forkbomb.c +++ b/userland/testbin/forkbomb/forkbomb.c @@ -65,13 +65,16 @@ main(void) unsigned long start_time_ns, time_now_ns; __time(&start_time_s, &start_time_ns); int parent_pid = getpid(); + int did_print = 0; while (1) { fork(); __time(&time_now_s, &time_now_ns); // Only parent gets to print if(getpid() == parent_pid && - time_now_s - start_time_s > TEST_DURATION) { + time_now_s - start_time_s > TEST_DURATION && + !did_print) { + did_print = 1; success(TEST161_SUCCESS, SECRET, "/testbin/forkbomb"); }