1/* Legacy test skeleton.
2 Copyright (C) 1998-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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
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.
14
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/>. */
18
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. */
23
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 <malloc.h>
31#include <paths.h>
32#include <search.h>
33#include <signal.h>
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <unistd.h>
38#include <sys/resource.h>
39#include <sys/wait.h>
40#include <sys/param.h>
41#include <time.h>
42#include <stdint.h>
43
44#include <support/support.h>
45#include <support/check.h>
46#include <support/xsignal.h>
47#include <support/temp_file.h>
48
49/* TEST_FUNCTION is no longer used. */
50static int
51legacy_test_function (int argc __attribute__ ((unused)),
52 char **argv __attribute__ ((unused)))
53{
54#ifdef TEST_FUNCTION
55 return TEST_FUNCTION;
56# undef TEST_FUNCTION
57#else
58 return do_test (argc, argv);
59#endif
60}
61#define TEST_FUNCTION_ARGV legacy_test_function
62
63/* PREPARE is a function name in the new skeleton. */
64#ifdef PREPARE
65static void
66legacy_prepare_function (int argc __attribute__ ((unused)),
67 char **argv __attribute__ ((unused)))
68{
69 PREPARE (argc, argv);
70}
71# undef PREPARE
72# define PREPARE legacy_prepare_function
73#endif
74
75/* CLEANUP_HANDLER is a function name in the new skeleton. */
76#ifdef CLEANUP_HANDLER
77static void
78legacy_cleanup_handler_function (void)
79{
80 CLEANUP_HANDLER;
81}
82# undef CLEANUP_HANDLER
83# define CLEANUP_HANDLER legacy_cleanup_handler_function
84#endif
85
86/* CMDLINE_PROCESS is a function name in the new skeleton. */
87#ifdef CMDLINE_PROCESS
88static void
89legacy_cmdline_process_function (int c)
90{
91 switch (c)
92 {
93 CMDLINE_PROCESS
94 }
95}
96# undef CMDLINE_PROCESS
97# define CMDLINE_PROCESS legacy_cmdline_process_function
98#endif
99
100/* Include the new test-skeleton. */
101#include <support/test-driver.c>
102
103/* The following functionality is only available if <pthread.h> was
104 included before this file. */
105#ifdef _PTHREAD_H
106# include <support/xthread.h>
107#endif /* _PTHREAD_H */
108

source code of glibc/test-skeleton.c