blob: 9db752f4a808529e5bd0d1ad67e827c565f4896c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "tests.h"
#include <camellia/flags.h>
#include <camellia/syscalls.h>
#include <unistd.h>
static void run_forked(void (*fn)()) {
if (!fork()) {
fn();
exit(0);
} else {
/* successful tests must return 0
* TODO add a better fail msg */
if (_syscall_await() != 0) test_fail();
}
}
static void stress_fork(void) {
for (size_t i = 0; i < 2048; i++) {
if (!fork()) exit(0);
_syscall_await();
}
}
void stress_all(void) {
run_forked(stress_fork);
}
|