diff options
Diffstat (limited to 'src/user/app')
-rw-r--r-- | src/user/app/testelf/main.c | 2 | ||||
-rw-r--r-- | src/user/app/tests/kernel/miscsyscall.c | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/user/app/testelf/main.c b/src/user/app/testelf/main.c index 5608cc7..a2e5932 100644 --- a/src/user/app/testelf/main.c +++ b/src/user/app/testelf/main.c @@ -10,7 +10,7 @@ int main(int argc, char **argv) { printf("argc == %u\n", argc); for (int i = 0; i < argc; i++) printf("argv[%u] == %p == \"%s\"\n", i, argv[i], argv[i]); - if (strcmp(argv[1], "stackexec") == 0) { + if (argv[1] && strcmp(argv[1], "stackexec") == 0) { /* exec something with arguments on the stack */ const char s_d[] = "I am a pretty long string on the stack. Oh my. " \ "I hope I won't get corrupted.\0"; diff --git a/src/user/app/tests/kernel/miscsyscall.c b/src/user/app/tests/kernel/miscsyscall.c index c90560e..459da2a 100644 --- a/src/user/app/tests/kernel/miscsyscall.c +++ b/src/user/app/tests/kernel/miscsyscall.c @@ -40,6 +40,18 @@ static void test_await2(void) { _sys_filicide(); } +static void test_wait2_basic(void) { + struct sys_wait2 data = {0}; + int pid; + pid = fork(); + if (pid == 0) { + exit(420); + } + test(_sys_wait2(-1, 0, &data) == pid); + test(data.status == 420); + test(_sys_wait2(-1, 0, NULL) == -ECHILD); +} + static void test_pipe(void) { const char *pipe_msgs[2] = {"hello", "world"}; hid_t ends[2]; @@ -293,6 +305,7 @@ static void test_badopen(void) { void r_k_miscsyscall(void) { run_test(test_await); run_test(test_await2); + run_test(test_wait2_basic); run_test(test_pipe); run_test(test_memflag); run_test(test_dup); |