Updated forkbomb to better detect success
Previously, we were relying on subpage allocator failing to signal that forkbomb was succeeding. However, there are cases where the subpage allocator never fails but the test is still progressing fine. This commit moves the secure print into forkbomb itself and changes the test constraints to ensure that forkbomb runs for a certain amount of time without crashing
This commit is contained in:
@@ -49,6 +49,10 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
#include <time.h>
|
||||
#include <test161/test161.h>
|
||||
|
||||
#define TEST_DURATION 10
|
||||
|
||||
static volatile int pid;
|
||||
|
||||
@@ -57,9 +61,17 @@ main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
time_t start_time_s, time_now_s;
|
||||
unsigned long start_time_ns, time_now_ns;
|
||||
__time(&start_time_s, &start_time_ns);
|
||||
while (1) {
|
||||
fork();
|
||||
|
||||
__time(&time_now_s, &time_now_ns);
|
||||
if(time_now_s - start_time_s > TEST_DURATION) {
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/forkbomb");
|
||||
}
|
||||
|
||||
pid = getpid();
|
||||
|
||||
/* Make sure each fork has its own address space. */
|
||||
|
Reference in New Issue
Block a user