nptl: Correct stack size attribute when stack grows up [BZ #32574]
[glibc.git] / test-skeleton.c
blob29787b03ba4b384b602a7b8611a86ca63d20401f
1 /* Legacy test skeleton.
2 Copyright (C) 1998-2025 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 /* This test skeleton is to support running existing tests. New tests
20 should use <support/test-driver.c> instead; see the documentation
21 in that file for instructions, and <support/README-testing.c> for a
22 minimal example. */
24 /* This list of headers is needed so that tests which include
25 "../test-skeleton.c" at the beginning still compile. */
26 #include <assert.h>
27 #include <errno.h>
28 #include <fcntl.h>
29 #include <getopt.h>
30 #include <paths.h>
31 #include <search.h>
32 #include <signal.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <unistd.h>
37 #include <sys/resource.h>
38 #include <sys/wait.h>
39 #include <sys/param.h>
40 #include <time.h>
41 #include <stdint.h>
43 #include <support/support.h>
44 #include <support/check.h>
45 #include <support/xsignal.h>
46 #include <support/temp_file.h>
48 /* TEST_FUNCTION is no longer used. */
49 static int
50 legacy_test_function (int argc __attribute__ ((unused)),
51 char **argv __attribute__ ((unused)))
53 #ifdef TEST_FUNCTION
54 return TEST_FUNCTION;
55 # undef TEST_FUNCTION
56 #else
57 return do_test (argc, argv);
58 #endif
60 #define TEST_FUNCTION_ARGV legacy_test_function
62 /* PREPARE is a function name in the new skeleton. */
63 #ifdef PREPARE
64 static void
65 legacy_prepare_function (int argc __attribute__ ((unused)),
66 char **argv __attribute__ ((unused)))
68 PREPARE (argc, argv);
70 # undef PREPARE
71 # define PREPARE legacy_prepare_function
72 #endif
74 /* CLEANUP_HANDLER is a function name in the new skeleton. */
75 #ifdef CLEANUP_HANDLER
76 static void
77 legacy_cleanup_handler_function (void)
79 CLEANUP_HANDLER;
81 # undef CLEANUP_HANDLER
82 # define CLEANUP_HANDLER legacy_cleanup_handler_function
83 #endif
85 /* CMDLINE_PROCESS is a function name in the new skeleton. */
86 #ifdef CMDLINE_PROCESS
87 static void
88 legacy_cmdline_process_function (int c)
90 switch (c)
92 CMDLINE_PROCESS
95 # undef CMDLINE_PROCESS
96 # define CMDLINE_PROCESS legacy_cmdline_process_function
97 #endif
99 /* Include the new test-skeleton. */
100 #include <support/test-driver.c>
102 /* The following functionality is only available if <pthread.h> was
103 included before this file. */
104 #ifdef _PTHREAD_H
105 # include <support/xthread.h>
106 #endif /* _PTHREAD_H */