summaryrefslogtreecommitdiff
path: root/src/user/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app')
-rw-r--r--src/user/app/tests/kernel/threads.c24
-rw-r--r--src/user/app/tests/tests.c1
-rw-r--r--src/user/app/tests/tests.h1
3 files changed, 26 insertions, 0 deletions
diff --git a/src/user/app/tests/kernel/threads.c b/src/user/app/tests/kernel/threads.c
new file mode 100644
index 0000000..9f08c39
--- /dev/null
+++ b/src/user/app/tests/kernel/threads.c
@@ -0,0 +1,24 @@
+#include "../tests.h"
+#include <camellia/flags.h>
+#include <camellia/syscalls.h>
+#include <user/lib/esemaphore.h>
+#include <user/lib/thread.h>
+
+int global_n;
+
+static void basic_thread(void *sem) {
+ global_n = 10;
+ esem_signal(sem);
+}
+
+static void test_basic_thread(void) {
+ struct evil_sem *sem = esem_new(0);
+ global_n = 0;
+ thread_create(FORK_NOREAP, basic_thread, sem);
+ esem_wait(sem);
+ test(global_n == 10);
+}
+
+void r_k_threads(void) {
+ run_test(test_basic_thread);
+}
diff --git a/src/user/app/tests/tests.c b/src/user/app/tests/tests.c
index 2157e60..f9b085a 100644
--- a/src/user/app/tests/tests.c
+++ b/src/user/app/tests/tests.c
@@ -17,6 +17,7 @@ int main(void) {
r_k_misc();
r_k_miscsyscall();
r_k_path();
+ r_k_threads();
r_libc_esemaphore();
r_libc_string();
r_s_printf();
diff --git a/src/user/app/tests/tests.h b/src/user/app/tests/tests.h
index 79169c9..d092115 100644
--- a/src/user/app/tests/tests.h
+++ b/src/user/app/tests/tests.h
@@ -11,6 +11,7 @@ void r_k_fs(void);
void r_k_misc(void);
void r_k_miscsyscall(void);
void r_k_path(void);
+void r_k_threads(void);
void r_libc_esemaphore(void);
void r_libc_string(void);
void r_s_printf(void);