test-skeleton.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Legacy test skeleton.
  2. Copyright (C) 1998-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. /* This test skeleton is to support running existing tests. New tests
  17. should use <support/test-driver.c> instead; see the documentation
  18. in that file for instructions, and <support/README-testing.c> for a
  19. minimal example. */
  20. /* This list of headers is needed so that tests which include
  21. "../test-skeleton.c" at the beginning still compile. */
  22. #include <assert.h>
  23. #include <errno.h>
  24. #include <fcntl.h>
  25. #include <getopt.h>
  26. #include <malloc.h>
  27. #include <paths.h>
  28. #include <search.h>
  29. #include <signal.h>
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32. #include <string.h>
  33. #include <unistd.h>
  34. #include <sys/resource.h>
  35. #include <sys/wait.h>
  36. #include <sys/param.h>
  37. #include <time.h>
  38. #include <stdint.h>
  39. #include <support/support.h>
  40. #include <support/check.h>
  41. #include <support/xsignal.h>
  42. #include <support/temp_file.h>
  43. /* TEST_FUNCTION is no longer used. */
  44. static int
  45. legacy_test_function (int argc __attribute__ ((unused)),
  46. char **argv __attribute__ ((unused)))
  47. {
  48. #ifdef TEST_FUNCTION
  49. return TEST_FUNCTION;
  50. # undef TEST_FUNCTION
  51. #else
  52. return do_test (argc, argv);
  53. #endif
  54. }
  55. #define TEST_FUNCTION_ARGV legacy_test_function
  56. /* PREPARE is a function name in the new skeleton. */
  57. #ifdef PREPARE
  58. static void
  59. legacy_prepare_function (int argc __attribute__ ((unused)),
  60. char **argv __attribute__ ((unused)))
  61. {
  62. PREPARE (argc, argv);
  63. }
  64. # undef PREPARE
  65. # define PREPARE legacy_prepare_function
  66. #endif
  67. /* CLEANUP_HANDLER is a function name in the new skeleton. */
  68. #ifdef CLEANUP_HANDLER
  69. static void
  70. legacy_cleanup_handler_function (void)
  71. {
  72. CLEANUP_HANDLER;
  73. }
  74. # undef CLEANUP_HANDLER
  75. # define CLEANUP_HANDLER legacy_cleanup_handler_function
  76. #endif
  77. /* CMDLINE_PROCESS is a function name in the new skeleton. */
  78. #ifdef CMDLINE_PROCESS
  79. static void
  80. legacy_cmdline_process_function (int c)
  81. {
  82. switch (c)
  83. {
  84. CMDLINE_PROCESS
  85. }
  86. }
  87. # undef CMDLINE_PROCESS
  88. # define CMDLINE_PROCESS legacy_cmdline_process_function
  89. #endif
  90. /* Include the new test-skeleton. */
  91. #include <support/test-driver.c>
  92. /* The following functionality is only available if <pthread.h> was
  93. included before this file. */
  94. #ifdef _PTHREAD_H
  95. # include <support/xthread.h>
  96. #endif /* _PTHREAD_H */