ipc_unmuxed.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #define _GNU_SOURCE
  13. #include <errno.h>
  14. #include <stdio.h>
  15. #include <unistd.h>
  16. #include <sys/syscall.h>
  17. #include "utils.h"
  18. #define DO_TEST(_name, _num) \
  19. static int test_##_name(void) \
  20. { \
  21. int rc; \
  22. printf("Testing " #_name); \
  23. errno = 0; \
  24. rc = syscall(_num, -1, 0, 0, 0, 0, 0); \
  25. printf("\treturned %d, errno %d\n", rc, errno); \
  26. return errno == ENOSYS; \
  27. }
  28. #include "ipc.h"
  29. #undef DO_TEST
  30. static int ipc_unmuxed(void)
  31. {
  32. int tests_done = 0;
  33. #define DO_TEST(_name, _num) \
  34. FAIL_IF(test_##_name()); \
  35. tests_done++;
  36. #include "ipc.h"
  37. #undef DO_TEST
  38. /*
  39. * If we ran no tests then it means none of the syscall numbers were
  40. * defined, possibly because we were built against old headers. But it
  41. * means we didn't really test anything, so instead of passing mark it
  42. * as a skip to give the user a clue.
  43. */
  44. SKIP_IF(tests_done == 0);
  45. return 0;
  46. }
  47. int main(void)
  48. {
  49. return test_harness(ipc_unmuxed, "ipc_unmuxed");
  50. }