summaryrefslogtreecommitdiff
path: root/src/init/tests
diff options
context:
space:
mode:
authordzwdz2022-04-13 21:35:30 +0200
committerdzwdz2022-04-13 21:35:30 +0200
commitf1ef26f435d2eef53a718cf1c2b06387e29b2a3b (patch)
tree296c7369625de116df80f2736944528eb2d6e74e /src/init/tests
parentea59ff29ab98d363b48bfb22be02a4823b765c32 (diff)
init/test: add a fork() stress test
this currently crashes the kernel. the point is to stop it from doing that
Diffstat (limited to 'src/init/tests')
-rw-r--r--src/init/tests/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/init/tests/main.c b/src/init/tests/main.c
index eb7c23f..65c2370 100644
--- a/src/init/tests/main.c
+++ b/src/init/tests/main.c
@@ -64,8 +64,17 @@ static void test_faults(void) {
assert(await_cnt == 2);
}
+static void stress_fork(void) {
+ /* run a lot of processes */
+ for (size_t i = 0; i < 2048; i++) {
+ if (!_syscall_fork()) _syscall_exit(0);
+ _syscall_await();
+ }
+}
+
void test_all(void) {
run_forked(test_await);
run_forked(test_faults);
+ run_forked(stress_fork);
}