summaryrefslogtreecommitdiff
path: root/src/cmd/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/tests')
-rw-r--r--src/cmd/tests/kernel/fs.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/cmd/tests/kernel/fs.c b/src/cmd/tests/kernel/fs.c
index 449ed43..6d4f4f4 100644
--- a/src/cmd/tests/kernel/fs.c
+++ b/src/cmd/tests/kernel/fs.c
@@ -77,9 +77,32 @@ static void test_no_fs(void) {
test(_sys_fs_wait(buf, 256, &res) == -EPIPE);
}
+/* Tries to delegate a nonexistent handle */
+static void test_bad_delegate(void) {
+ hid_t h = -1;
+ int ret = _sys_fork(FORK_NEWFS, &h);
+ test(0 <= ret);
+ if (ret == 0) {
+ struct ufs_request res;
+ for (;;) {
+ h = _sys_fs_wait(NULL, 0, &res);
+ _sys_close(0);
+ _sys_fs_respond(h, NULL, 0, FSR_DELEGATE);
+ }
+ } else {
+ test(0 <= h);
+ test(_sys_mount(h, "/", 1) == 0);
+ for (int i = 0; i < 4; i++) {
+ int ret = _sys_open("/", 1, 0);
+ test(ret < 0);
+ }
+ }
+}
+
void r_k_fs(void) {
run_test(test_unfinished_req);
run_test(test_orphaned_fs);
run_test(test_fs_cleanup);
run_test(test_no_fs);
+ run_test(test_bad_delegate);
}