1 /*
2 * Copyright 2015, Michael Ellerman, IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *
9 * This test simply tests that certain syscalls are implemented. It doesn't
10 * actually exercise their logic in any way.
11 */
12
13 #define _GNU_SOURCE
14 #include <errno.h>
15 #include <stdio.h>
16 #include <unistd.h>
17 #include <sys/syscall.h>
18
19 #include "utils.h"
20
21
22 #define DO_TEST(_name, _num) \
23 static int test_##_name(void) \
24 { \
25 int rc; \
26 printf("Testing " #_name); \
27 errno = 0; \
28 rc = syscall(_num, -1, 0, 0, 0, 0, 0); \
29 printf("\treturned %d, errno %d\n", rc, errno); \
30 return errno == ENOSYS; \
31 }
32
33 #include "ipc.h"
34 #undef DO_TEST
35
ipc_unmuxed(void)36 static int ipc_unmuxed(void)
37 {
38 int tests_done = 0;
39
40 #define DO_TEST(_name, _num) \
41 FAIL_IF(test_##_name()); \
42 tests_done++;
43
44 #include "ipc.h"
45 #undef DO_TEST
46
47 /*
48 * If we ran no tests then it means none of the syscall numbers were
49 * defined, possibly because we were built against old headers. But it
50 * means we didn't really test anything, so instead of passing mark it
51 * as a skip to give the user a clue.
52 */
53 SKIP_IF(tests_done == 0);
54
55 return 0;
56 }
57
main(void)58 int main(void)
59 {
60 return test_harness(ipc_unmuxed, "ipc_unmuxed");
61 }
62