From c178ab5d5ca328d5b0072d54e3dc66d1b198df7b Mon Sep 17 00:00:00 2001
From: dzwdz
Date: Sun, 8 Jan 2023 21:14:03 +0100
Subject: kernel: let parents kill their children again

---
 src/user/app/tests/kernel/miscsyscall.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

(limited to 'src/user/app/tests/kernel')

diff --git a/src/user/app/tests/kernel/miscsyscall.c b/src/user/app/tests/kernel/miscsyscall.c
index 66899b1..58a9afb 100644
--- a/src/user/app/tests/kernel/miscsyscall.c
+++ b/src/user/app/tests/kernel/miscsyscall.c
@@ -26,6 +26,20 @@ static void test_await(void) {
 		test(counts[i] == 1);
 }
 
+static void test_await2(void) {
+	/* hangs on failure */
+	if (!fork()) {
+		if (!fork()) {
+			for (;;) _syscall_sleep(1000000000);
+		} else {
+			exit(123);
+		}
+	}
+	test(_syscall_await() == 123);
+	test(_syscall_await() == ~0); /* don't wait for tombstone */
+	_syscall_filicide();
+}
+
 static void test_pipe(void) {
 	const char *pipe_msgs[2] = {"hello", "world"};
 	handle_t ends[2];
@@ -246,6 +260,7 @@ static void test_sleep(void) {
 				for (;;) _syscall_sleep(1000000000);
 			}
 			_syscall_await();
+			_syscall_filicide();
 			_syscall_exit(0);
 		}
 
@@ -277,6 +292,7 @@ static void test_badopen(void) {
 
 void r_k_miscsyscall(void) {
 	run_test(test_await);
+	run_test(test_await2);
 	run_test(test_pipe);
 	run_test(test_memflag);
 	run_test(test_dup);
-- 
cgit v1.2.3