summaryrefslogtreecommitdiff
path: root/src/user/app/tests
diff options
context:
space:
mode:
authordzwdz2022-10-02 19:25:17 +0200
committerdzwdz2022-10-02 19:25:17 +0200
commit710e9b2b5c16f74f66420c66d12455ad518d42c7 (patch)
tree82b88cc07ef3f122512354d649af68584bd4da4d /src/user/app/tests
parent503d9ff758f8b83295830bdfc8c2ea56837d25e5 (diff)
syscall/open: add the full suite of READ/WRITE flags
Diffstat (limited to 'src/user/app/tests')
-rw-r--r--src/user/app/tests/kernel/misc.c2
-rw-r--r--src/user/app/tests/kernel/miscsyscall.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/user/app/tests/kernel/misc.c b/src/user/app/tests/kernel/misc.c
index c0bb6b3..9ee88dd 100644
--- a/src/user/app/tests/kernel/misc.c
+++ b/src/user/app/tests/kernel/misc.c
@@ -28,7 +28,7 @@ static void test_efault(void) {
memcpy(str2, str, 16);
- test((h = _syscall_open(TMPFILEPATH, strlen(TMPFILEPATH), OPEN_CREATE)));
+ test((h = _syscall_open(TMPFILEPATH, strlen(TMPFILEPATH), OPEN_CREATE | OPEN_WRITE)) >= 0);
test(_syscall_write(h, str, 16, 0, 0) == 16);
test(_syscall_write(h, str2, 16, 0, 0) == 16);
diff --git a/src/user/app/tests/kernel/miscsyscall.c b/src/user/app/tests/kernel/miscsyscall.c
index a2eed24..66899b1 100644
--- a/src/user/app/tests/kernel/miscsyscall.c
+++ b/src/user/app/tests/kernel/miscsyscall.c
@@ -270,6 +270,11 @@ static void test_sleep(void) {
}
}
+static void test_badopen(void) {
+ test(_syscall_open(TMPFILEPATH, strlen(TMPFILEPATH), OPEN_CREATE | OPEN_WRITE) >= 0);
+ test(_syscall_open(TMPFILEPATH, strlen(TMPFILEPATH), OPEN_CREATE) == -EINVAL);
+}
+
void r_k_miscsyscall(void) {
run_test(test_await);
run_test(test_pipe);
@@ -277,4 +282,5 @@ void r_k_miscsyscall(void) {
run_test(test_dup);
run_test(test_execbuf);
run_test(test_sleep);
+ run_test(test_badopen);
}