diff options
Diffstat (limited to 'tests/ipc-req')
| -rw-r--r-- | tests/ipc-req/check.mk | 4 | ||||
| -rw-r--r-- | tests/ipc-req/init.c | 36 | ||||
| -rw-r--r-- | tests/ipc-req/source.mk | 2 |
3 files changed, 42 insertions, 0 deletions
diff --git a/tests/ipc-req/check.mk b/tests/ipc-req/check.mk new file mode 100644 index 0000000..db9f580 --- /dev/null +++ b/tests/ipc-req/check.mk @@ -0,0 +1,4 @@ +ipc-req: do-ipc-req + @grep 'BUG' reports/ipc-req/log \ + && echo 'BUG' > reports/ipc-req/OK \ + || tail -n1 reports/ipc-req/log | tr -d '\r' > reports/ipc-req/OK diff --git a/tests/ipc-req/init.c b/tests/ipc-req/init.c new file mode 100644 index 0000000..7f1c6aa --- /dev/null +++ b/tests/ipc-req/init.c @@ -0,0 +1,36 @@ +#include <common/test.h> + +START(pid, tid, d0, d1, d2, d3) +{ + check(pid == 0 || pid == 1, "illegal pid for init"); + if (pid == 0) { + /* send request to ourselves */ + printf("sending ipc req to ourselves\n"); + struct sys_ret r = sys_ipc_req4(1, 1, 2, 3, 4); + printf("returned ipc req to ourselves\n"); + check(r.s == OK, "not OK return\n"); + check(r.a0 == 1, "not OK response ID\n"); + check(r.a1 == 1, "not OK d0 response\n"); + check(r.a2 == 2, "not OK d1 response\n"); + check(r.a3 == 3, "not OK d2 response\n"); + check(r.a4 == 4, "not OK d3 response\n"); + + /* try to request to non-existing proc */ + r = sys_ipc_req0(200); + check(r.s != OK, "got OK return for illegal pid\n"); + } + else if (pid == 1) { + printf("caught ipc req\n"); + check(pid == 1, "illegal pid source\n"); + check(tid == 1, "illegal tid source\n"); + check(d0 == 1, "illegal d0\n"); + check(d1 == 2, "illegal d1\n"); + check(d2 == 3, "illegal d2\n"); + check(d3 == 4, "illegal d3\n"); + + printf("sending response\n"); + sys_ipc_resp4(1, 2, 3, 4); + } + + ok(); +} diff --git a/tests/ipc-req/source.mk b/tests/ipc-req/source.mk new file mode 100644 index 0000000..0e65407 --- /dev/null +++ b/tests/ipc-req/source.mk @@ -0,0 +1,2 @@ +DO != ./scripts/gen-prog -n ipc-req -p init init.c +DO != ./scripts/gen-simple -n ipc-req -p init |
