summaryrefslogtreecommitdiff
path: root/src/user/app/tests/kernel/fs.c
diff options
context:
space:
mode:
authordzwdz2022-08-04 21:43:38 +0200
committerdzwdz2022-08-04 21:43:38 +0200
commit26dc784103914b9d6ba36e0a96fa4b3af977626f (patch)
treed1c9938bac9426d4f6709344315d845b45b20865 /src/user/app/tests/kernel/fs.c
parent81a58004d51547d074b4218f906b0b95f2b2c5dc (diff)
user/tests: split the tests by parts of codebase
Diffstat (limited to 'src/user/app/tests/kernel/fs.c')
-rw-r--r--src/user/app/tests/kernel/fs.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/user/app/tests/kernel/fs.c b/src/user/app/tests/kernel/fs.c
new file mode 100644
index 0000000..c8d2eae
--- /dev/null
+++ b/src/user/app/tests/kernel/fs.c
@@ -0,0 +1,34 @@
+#include "../tests.h"
+#include <camellia/syscalls.h>
+
+static void test_unfinished_req(void) {
+ handle_t h;
+ if (_syscall_fork(FORK_NEWFS, &h)) {
+ // TODO make a similar test with all 0s passed to fs_wait
+ struct fs_wait_response res;
+ _syscall_fs_wait(NULL, 0, &res);
+ // TODO second fs_wait
+ exit(0);
+ } else {
+ _syscall_mount(h, "/", 1);
+ int ret = _syscall_open("/", 1, 0);
+ test(ret < 0);
+ // the handler quits while handling that call - but this syscall should return anyways
+ }
+}
+
+static void test_orphaned_fs(void) {
+ handle_t h;
+ if (_syscall_fork(FORK_NEWFS, &h)) {
+ exit(0);
+ } else {
+ _syscall_mount(h, "/", 1);
+ int ret = _syscall_open("/", 1, 0);
+ test(ret < 0);
+ }
+}
+
+void r_k_fs(void) {
+ run_test(test_unfinished_req);
+ run_test(test_orphaned_fs);
+}