]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/pthread/Makefile
y2038: Add test coverage
[thirdparty/glibc.git] / sysdeps / pthread / Makefile
1 # sysdeps makefile fragment for all pthread-supporting configurations.
2 # Copyright (C) 2014-2021 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 ifeq ($(subdir),rt)
20
21 ifeq (yes,$(build-shared))
22 $(objpfx)tst-timer: $(objpfx)librt.so $(shared-thread-library)
23 else
24 $(objpfx)tst-timer: $(objpfx)librt.a $(static-thread-library)
25 endif
26
27 endif
28
29 ifneq (,$(filter $(subdir),htl nptl))
30 headers += threads.h
31
32 routines += thrd_current thrd_equal thrd_sleep thrd_yield
33
34 $(libpthread-routines-var) += \
35 call_once \
36 cnd_broadcast \
37 cnd_destroy \
38 cnd_init \
39 cnd_signal \
40 cnd_timedwait \
41 cnd_wait \
42 mtx_destroy \
43 mtx_init \
44 mtx_lock \
45 mtx_timedlock \
46 mtx_trylock \
47 mtx_unlock \
48 thrd_create \
49 thrd_detach \
50 thrd_exit \
51 thrd_join \
52 tss_create \
53 tss_delete \
54 tss_get \
55 tss_set \
56
57 tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
58 tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
59 tst-mtx-recursive tst-tss-basic tst-call-once tst-mtx-timedlock \
60 \
61 tst-abstime \
62 tst-pt-align tst-pt-align3 \
63 tst-attr1 \
64 tst-backtrace1 \
65 tst-bad-schedattr \
66 tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
67 tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
68 tst-basic7 \
69 tst-cancel-self tst-cancel-self-cancelstate \
70 tst-cancel-self-canceltype tst-cancel-self-testcancel \
71 tst-cancel1 tst-cancel2 tst-cancel3 \
72 tst-cancel4 tst-cancel5 \
73 tst-cancel6 tst-cancel8 tst-cancel9 tst-cancel10 tst-cancel11 \
74 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 tst-cancel16 \
75 tst-cancel18 tst-cancel19 tst-cancel20 tst-cancel21 \
76 tst-cancel22 tst-cancel23 tst-cancel26 tst-cancel27 tst-cancel28 \
77 tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 \
78 tst-clock1 \
79 tst-cond-except \
80 tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
81 tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
82 tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
83 tst-cond20 tst-cond21 tst-cond23 tst-cond24 tst-cond25 tst-cond27 \
84 tst-create-detached \
85 tst-detach1 \
86 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 \
87 tst-exec1 tst-exec2 tst-exec3 \
88 tst-exit1 tst-exit2 tst-exit3 \
89 tst-flock1 tst-flock2 \
90 tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
91 tst-atfork1 \
92 tst-getpid3 \
93 tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 tst-join6 tst-join7 \
94 tst-join8 tst-join9 tst-join10 tst-join11 tst-join12 tst-join13 \
95 tst-join14 tst-join15 \
96 tst-key1 tst-key2 tst-key3 tst-key4 \
97 tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
98 tst-locale1 tst-locale2 \
99 tst-memstream \
100 tst-mutex-errorcheck tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 \
101 tst-mutex5 tst-mutex6 tst-mutex7 tst-mutex7robust tst-mutex9 \
102 tst-mutex10 tst-mutex11 tst-pthread-mutexattr \
103 tst-once1 tst-once2 tst-once3 tst-once4 \
104 tst-pt-popen1 \
105 tst-raise1 \
106 tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
107 tst-robust6 tst-robust7 tst-robust9 tst-robust10 \
108 tst-rwlock1 tst-rwlock4 tst-rwlock5 tst-rwlock12 \
109 tst-rwlock13 tst-rwlock14 tst-rwlock16 \
110 tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
111 tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
112 tst-sem8 tst-sem9 tst-sem10 tst-sem14 tst-sem15 tst-sem16 \
113 tst-setuid3 \
114 tst-signal1 tst-signal2 \
115 tst-signal4 tst-signal5 tst-signal6 tst-signal8 \
116 tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
117 tst-stack1 \
118 tst-stdio1 tst-stdio2 \
119 tst-pt-sysconf \
120 tst-pt-tls1 tst-pt-tls2 \
121 tst-tsd1 tst-tsd2 tst-tsd5 tst-tsd6 \
122 tst-umask1 \
123 tst-unload \
124 tst-unwind-thread \
125 tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
126
127 tests-time64 := \
128 tst-abstime-time64 \
129 tst-cnd-timedwait-time64 \
130 tst-cond11-time64 \
131 tst-join14-time64 \
132 tst-mtx-timedlock-time64 \
133 tst-rwlock14-time64 \
134 tst-sem5-time64 \
135 tst-thrd-sleep-time64 \
136
137
138 # Files which must not be linked with libpthread.
139 tests-nolibpthread += tst-unload
140
141 # GCC-4.9 compiles 'sprintf(NULL, ...)' into UD2 on x86_64 without -fno-builtin
142 CFLAGS-tst-cleanup2.c += -fno-builtin
143 CFLAGS-tst-cleanupx2.c += -fno-builtin
144
145 tests += tst-cancelx2 tst-cancelx3 tst-cancelx6 tst-cancelx8 tst-cancelx9 \
146 tst-cancelx4 tst-cancelx5 \
147 tst-cancelx10 tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 \
148 tst-cancelx15 tst-cancelx16 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
149 tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3
150
151 ifeq ($(build-shared),yes)
152 tests += tst-atfork2 tst-pt-tls4 tst-_res1 tst-fini1
153 tests-nolibpthread += tst-fini1
154 endif
155
156 modules-names += tst-atfork2mod tst-tls4moda tst-tls4modb \
157 tst-_res1mod1 tst-_res1mod2 tst-fini1mod
158 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
159
160 tst-atfork2mod.so-no-z-defs = yes
161
162 ifeq ($(build-shared),yes)
163 # Build all the modules even when not actually running test programs.
164 tests: $(test-modules)
165 endif
166
167
168 tests-static += tst-locale1 tst-locale2 tst-cancel21-static
169
170 tests += tst-cancel21-static tst-cond11-static
171
172 # These tests are linked with libc before libpthread
173 tests-reverse += tst-cancel5 tst-cancel23 tst-vfork1x tst-vfork2x
174
175 ifeq ($(run-built-tests),yes)
176 ifeq ($(build-shared),yes)
177 tests-special += $(objpfx)tst-cleanup0-cmp.out
178 endif
179 endif
180
181 # The sigmask macro is deprecated and triggers are compiler warning
182 # which cannot be suppressed (as of GCC 9).
183 CFLAGS-tst-cancel4.c += -Wno-error
184 CFLAGS-tst-cancel5.c += -Wno-error
185 CFLAGS-tst-cancelx4.c += -Wno-error
186 CFLAGS-tst-cancelx5.c += -Wno-error
187
188 # Run the cancellation and cleanup tests also for the modern, exception-based
189 # implementation. For this we have to pass the -fexceptions parameter.
190 CFLAGS-tst-cancelx2.c += -fexceptions
191 CFLAGS-tst-cancelx3.c += -fexceptions
192 CFLAGS-tst-cancelx4.c += -fexceptions
193 CFLAGS-tst-cancelx5.c += -fexceptions
194 CFLAGS-tst-cancelx6.c += -fexceptions
195 CFLAGS-tst-cancelx8.c += -fexceptions
196 CFLAGS-tst-cancelx9.c += -fexceptions
197 CFLAGS-tst-cancelx10.c += -fexceptions
198 CFLAGS-tst-cancelx11.c += -fexceptions
199 CFLAGS-tst-cancelx12.c += -fexceptions
200 CFLAGS-tst-cancelx13.c += -fexceptions
201 CFLAGS-tst-cancelx14.c += -fexceptions
202 CFLAGS-tst-cancelx15.c += -fexceptions
203 CFLAGS-tst-cancelx16.c += -fexceptions
204 CFLAGS-tst-cancelx18.c += -fexceptions
205 CFLAGS-tst-cancelx20.c += -fexceptions -fasynchronous-unwind-tables
206 CFLAGS-tst-cancelx21.c += -fexceptions -fasynchronous-unwind-tables
207 CFLAGS-tst-cleanupx0.c += -fexceptions -fasynchronous-unwind-tables
208 CFLAGS-tst-cleanupx1.c += -fexceptions -fasynchronous-unwind-tables
209 CFLAGS-tst-cleanupx2.c += -fexceptions
210 CFLAGS-tst-cleanupx3.c += -fexceptions
211 CFLAGS-tst-pt-align.c += $(stack-align-test-flags)
212 CFLAGS-tst-pt-align3.c += $(stack-align-test-flags)
213
214 tst-umask1-ARGS = $(objpfx)tst-umask1.temp
215
216 $(objpfx)tst-atfork2: $(shared-thread-library)
217 LDFLAGS-tst-atfork2 = -rdynamic
218 tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
219 $(objpfx)tst-atfork2mod.so: $(shared-thread-library)
220
221 ifeq ($(build-shared),yes)
222 $(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
223 endif
224
225 ifeq ($(build-shared),yes)
226 $(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
227 $(make-test-out) > $@ 2>&1; \
228 $(evaluate-test)
229
230 $(objpfx)tst-cleanup0-cmp.out: $(..)sysdeps/pthread/tst-cleanup0.expect $(objpfx)tst-cleanup0.out
231 cmp $^ > $@; \
232 $(evaluate-test)
233
234 $(objpfx)tst-cancel28: $(common-objpfx)rt/librt.so
235 else
236 $(objpfx)tst-cancel28: $(common-objpfx)rt/librt.a
237 endif
238
239 $(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
240
241 $(objpfx)tst-fini1mod.so: $(shared-thread-library)
242
243 $(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
244 LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
245 LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
246 $(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
247 $(shared-thread-library)
248
249 $(objpfx)tst-pt-tls4: $(shared-thread-library)
250 $(objpfx)tst-pt-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
251
252 generated += tst-atfork2.mtrace
253
254 generated += $(objpfx)tst-atfork2.mtrace \
255 $(addsuffix .so,$(strip $(modules-names)))
256
257 tests-internal += tst-cancel25 tst-robust8
258
259 tests += tst-oncex3 tst-oncex4 tst-oncey3 tst-oncey4
260
261 modules-names += tst-join7mod
262
263 ifeq ($(build-shared),yes)
264 tests-static += tst-cond8-static
265 tests += tst-cond8-static
266 endif
267
268 CFLAGS-tst-oncex3.c += -fexceptions
269 CFLAGS-tst-oncex4.c += -fexceptions
270 CFLAGS-tst-oncey3.c += -fno-exceptions -fno-asynchronous-unwind-tables
271 CFLAGS-tst-oncey4.c += -fno-exceptions -fno-asynchronous-unwind-tables
272
273 $(objpfx)tst-join7: $(shared-thread-library)
274 $(objpfx)tst-join7.out: $(objpfx)tst-join7mod.so
275 $(objpfx)tst-join7mod.so: $(shared-thread-library)
276 LDFLAGS-tst-join7mod.so = -Wl,-soname,tst-join7mod.so
277
278 CFLAGS-tst-unwind-thread.c += -funwind-tables
279
280 endif