diff options
author | dzwdz | 2023-01-08 20:22:14 +0100 |
---|---|---|
committer | dzwdz | 2023-01-08 20:22:14 +0100 |
commit | 5defe97cc8b870fa50ba01999f80974b8b21c5b5 (patch) | |
tree | 2c69ec420461081a54fe203883938fb820f9d1ff /src/user/app/tests/kernel/fs.c | |
parent | ac49dbab1e0aa861c8bf0b1f548945963502ccf0 (diff) |
user/tests: fix fucked fs test
Diffstat (limited to 'src/user/app/tests/kernel/fs.c')
-rw-r--r-- | src/user/app/tests/kernel/fs.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/user/app/tests/kernel/fs.c b/src/user/app/tests/kernel/fs.c index 65e349c..ea8a827 100644 --- a/src/user/app/tests/kernel/fs.c +++ b/src/user/app/tests/kernel/fs.c @@ -1,17 +1,22 @@ +// TODO test it working too... + #include "../tests.h" #include <camellia/flags.h> #include <camellia/syscalls.h> static void test_unfinished_req(void) { - handle_t h; - if (_syscall_fork(FORK_NEWFS, &h)) { + handle_t h = -1; + int ret = _syscall_fork(FORK_NEWFS, &h); + test(0 <= ret); + if (ret == 0) { // TODO make a similar test with all 0s passed to fs_wait struct ufs_request res; _syscall_fs_wait(NULL, 0, &res); // TODO second fs_wait exit(0); } else { - _syscall_mount(h, "/", 1); + test(0 <= h); + test(_syscall_mount(h, "/", 1) == 0); int ret = _syscall_open("/", 1, 0); test(ret < 0); // the handler quits while handling that call - but this syscall should return anyways @@ -19,11 +24,14 @@ static void test_unfinished_req(void) { } static void test_orphaned_fs(void) { - handle_t h; - if (_syscall_fork(FORK_NEWFS, &h)) { + handle_t h = -1; + int ret = _syscall_fork(FORK_NEWFS, &h); + test(0 <= ret); + if (ret == 0) { exit(0); } else { - _syscall_mount(h, "/", 1); + test(0 <= h); + test(_syscall_mount(h, "/", 1) == 0); int ret = _syscall_open("/", 1, 0); test(ret < 0); } |