ipc_unmuxed.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright 2015, Michael Ellerman, IBM Corp.
  4. *
  5. * This test simply tests that certain syscalls are implemented. It doesn't
  6. * actually exercise their logic in any way.
  7. */
  8. #define _GNU_SOURCE
  9. #include <errno.h>
  10. #include <stdio.h>
  11. #include <unistd.h>
  12. #include <sys/syscall.h>
  13. #include "utils.h"
  14. #define DO_TEST(_name, _num) \
  15. static int test_##_name(void) \
  16. { \
  17. int rc; \
  18. printf("Testing " #_name); \
  19. errno = 0; \
  20. rc = syscall(_num, -1, 0, 0, 0, 0, 0); \
  21. printf("\treturned %d, errno %d\n", rc, errno); \
  22. return errno == ENOSYS; \
  23. }
  24. #include "ipc.h"
  25. #undef DO_TEST
  26. static int ipc_unmuxed(void)
  27. {
  28. int tests_done = 0;
  29. #define DO_TEST(_name, _num) \
  30. FAIL_IF(test_##_name()); \
  31. tests_done++;
  32. #include "ipc.h"
  33. #undef DO_TEST
  34. /*
  35. * If we ran no tests then it means none of the syscall numbers were
  36. * defined, possibly because we were built against old headers. But it
  37. * means we didn't really test anything, so instead of passing mark it
  38. * as a skip to give the user a clue.
  39. */
  40. SKIP_IF(tests_done == 0);
  41. return 0;
  42. }
  43. int main(void)
  44. {
  45. return test_harness(ipc_unmuxed, "ipc_unmuxed");
  46. }