diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-22 14:57:14 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-22 14:57:14 +0300 |
| commit | c3ea570bae8f7daeac8e0614a958e983fcf9940e (patch) | |
| tree | a6060c571a2ce715037f98df139562cb161cf91e /tests/ipc-notify/init.c | |
| parent | fcd4d35ab52e26942f7adbd555be4d563ad06980 (diff) | |
| download | kmi-c3ea570bae8f7daeac8e0614a958e983fcf9940e.tar.gz kmi-c3ea570bae8f7daeac8e0614a958e983fcf9940e.zip | |
add ipc_notify testcase, remove ipc_ghost
+ A bit easier to implement just ignoring the ipc_resp() arguments than
try to enforce that a notification is exited from by ipc_ghost(),
especially in cases where the root process has been killed.
Diffstat (limited to 'tests/ipc-notify/init.c')
| -rw-r--r-- | tests/ipc-notify/init.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/ipc-notify/init.c b/tests/ipc-notify/init.c new file mode 100644 index 0000000..4626f10 --- /dev/null +++ b/tests/ipc-notify/init.c @@ -0,0 +1,42 @@ +#include <common/test.h> + +START(pid, tid, d0, d1, d2, d3) +{ + UNUSED(d3); + check(pid == 0, "illegal pid for init\n"); + check(d0 == SYS_USER_NOTIFY || d0 == SYS_USER_SPAWNED, + "illegal d0 for init\n"); + + if (d0 == SYS_USER_SPAWNED) { + /* send request to ourselves */ + printf("sending ipc notify to ourselves\n"); + check(tid == 1, "illegal init thread ID\n"); + struct sys_ret r = syscall5(SYS_IPC_NOTIFY, 1, 1, 2, 3, 4); + printf("returned ipc notify to ourselves\n"); + + check(r.s == OK, "illegal notify status\n"); + check(r.id == 0, "illegal notify id\n"); + check(r.a0 != 10, "ipc resp leaked through?\n"); + check(r.a1 != 11, "ipc resp leaked through?\n"); + check(r.a2 != 12, "ipc resp leaked through?\n"); + check(r.a3 != 13, "ipc resp leaked through?\n"); + + /* try to notify to non-existing proc */ + enum sys_status s = sys_ipc_notify(200); + check(s != OK, "got OK return for illegal pid\n"); + } + else if (d0 == SYS_USER_NOTIFY) { + printf("caught ipc notify\n"); + check(tid == 1, "illegal tid source\n"); + check(d1 & NOTIFY_SIGNAL, "illegal d1\n"); + check(d2 == 1, "illegal d2\n"); + + printf("doing ipc resp in notification\n"); + /* whatever we respond here should not be visible in whoever ran + * the notification */ + sys_ipc_resp4(10, 11, 12, 13); + check(0, "ipc resp failed\n"); + } + + ok(); +} |
