From f1ef26f435d2eef53a718cf1c2b06387e29b2a3b Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 13 Apr 2022 21:35:30 +0200 Subject: init/test: add a fork() stress test this currently crashes the kernel. the point is to stop it from doing that --- src/init/tests/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/init/tests/main.c') 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); } -- cgit v1.2.3