]> git.ipfire.org Git - thirdparty/glibc.git/blob - resolv/Makefile
resolv: Add new tst-resolv-invalid-cname
[thirdparty/glibc.git] / resolv / Makefile
1 # Copyright (C) 1994-2022 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8
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
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
17
18 #
19 # Sub-makefile for resolv portion of the library.
20 #
21 subdir := resolv
22
23 include ../Makeconfig
24
25 headers := resolv.h bits/types/res_state.h \
26 netdb.h bits/netdb.h \
27 arpa/nameser.h arpa/nameser_compat.h \
28 sys/bitypes.h
29
30 routines := \
31 dn_comp \
32 dn_expand \
33 dn_skipname \
34 dns-canon \
35 dns-host \
36 dns-network \
37 herror \
38 inet_addr \
39 inet_ntop \
40 inet_pton \
41 ns_makecanon \
42 ns_name_compress \
43 ns_name_length_uncompressed \
44 ns_name_ntop \
45 ns_name_pack \
46 ns_name_pton \
47 ns_name_skip \
48 ns_name_uncompress \
49 ns_name_unpack \
50 ns_rr_cursor_init \
51 ns_rr_cursor_next \
52 ns_samebinaryname \
53 ns_samename \
54 nsap_addr \
55 nss_dns_functions \
56 res-close \
57 res-name-checking \
58 res-noaaaa \
59 res-state \
60 res_context_hostalias \
61 res_enable_icmp \
62 res_get_nsaddr \
63 res_hconf \
64 res_init \
65 res_libc \
66 res_mkquery \
67 res_nameinquery \
68 res_queriesmatch \
69 res_query \
70 res_randomid \
71 res_send \
72 resolv_conf \
73 resolv_context \
74 # routines
75
76 tests = tst-aton tst-leaks tst-inet_ntop
77 tests-container = tst-leaks2
78
79 tests-internal += tst-inet_aton_exact
80
81
82 generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
83
84 extra-libs := libresolv libnss_dns
85 ifeq ($(have-thread-library),yes)
86 routines += gai_sigqueue
87
88 tests += \
89 tst-bug18665 \
90 tst-bug18665-tcp \
91 tst-ns_name \
92 tst-ns_name_compress \
93 tst-ns_name_pton \
94 tst-res_hconf_reorder \
95 tst-res_hnok \
96 tst-resolv-aliases \
97 tst-resolv-basic \
98 tst-resolv-binary \
99 tst-resolv-byaddr \
100 tst-resolv-edns \
101 tst-resolv-invalid-cname \
102 tst-resolv-network \
103 tst-resolv-noaaaa \
104 tst-resolv-nondecimal \
105 tst-resolv-res_init-multi \
106 tst-resolv-search \
107 tst-resolv-trailing \
108
109 # This test calls __res_context_send directly, which is not exported
110 # from libresolv.
111 tests-internal += tst-resolv-txnid-collision
112 tests-static += tst-resolv-txnid-collision
113
114 # Likewise for __ns_samebinaryname.
115 tests-internal += tst-ns_samebinaryname
116 tests-static += tst-ns_samebinaryname
117
118 # Likewise for __ns_name_length_uncompressed.
119 tests-internal += tst-ns_name_length_uncompressed
120 tests-static += tst-ns_name_length_uncompressed
121
122 # Likewise for struct ns_rr_cursor and its functions.
123 tests-internal += tst-ns_rr_cursor
124 tests-static += tst-ns_rr_cursor
125
126 # These tests need libdl.
127 ifeq (yes,$(build-shared))
128 tests += \
129 tst-resolv-ai_idn \
130 tst-resolv-ai_idn-latin1 \
131 tst-resolv-ai_idn-nolibidn2 \
132 tst-resolv-canonname \
133 tst-resolv-trustad \
134
135 # Needs resolv_context.
136 tests-internal += \
137 tst-resolv-res_init \
138 tst-resolv-res_init-thread \
139 tst-resolv-res_ninit \
140 tst-resolv-threads \
141
142 # Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
143 # providing any functions in libidn2.so.0).
144 modules-names += tst-no-libidn2
145 extra-test-objs += tst-no-libidn2.os
146 LDFLAGS-tst-no-libidn2.so = -Wl,-soname,libidn2.so.0
147
148 endif # $(build-shared)
149
150 # This test accesses __inet_ntop_length, an internal libc function.
151 tests-internal += tst-inet_pton
152
153 # This test accesses the __p_secstodate compat symbol.
154 ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
155 tests += tst-p_secstodate
156 endif
157
158 # This test sends millions of packets and is rather slow.
159 xtests += tst-resolv-qtypes
160
161 # This test has dropped packet tests and runs for a long time.
162 xtests += tst-resolv-rotate
163 endif # $(have-thread-library)
164
165 extra-libs-others = $(extra-libs)
166 libresolv-routines := \
167 base64 \
168 compat-gethnamaddr \
169 compat-hooks \
170 inet_net_ntop \
171 inet_net_pton \
172 inet_neta \
173 ns_date \
174 ns_name \
175 ns_netint \
176 ns_parse \
177 ns_print \
178 ns_samedomain \
179 ns_ttl \
180 res-putget \
181 res_data \
182 res_debug \
183 res_hostalias \
184 res_isourserver \
185 resolv-deprecated \
186 # libresolv-routines
187
188 ifeq ($(have-GLIBC_2.34)$(have-thread-library),yesyes)
189 # Empty compatibility library for old binaries.
190 extra-libs += libanl
191 libanl-routines += libanl-compat
192 libanl-shared-only-routines += libanl-compat
193 endif
194
195 $(libanl-routines-var) += \
196 gai_cancel \
197 gai_error \
198 gai_misc \
199 gai_notify \
200 gai_suspend \
201 getaddrinfo_a \
202 # $(libanl-routines-var)
203
204 # Pretend that libanl.so is a linker script, so that the symbolic link
205 # is not installed.
206 install-lib-ldscripts = libanl.so
207 $(inst_libdir)/libanl.so:
208
209 subdir-dirs = nss_dns
210 vpath %.c nss_dns
211
212 # Build only an empty shared libnss_dns.
213 libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
214
215 # Pretend that libnss_dns.so is a linker script, so that the symbolic link
216 # is not installed.
217 install-lib-ldscripts = libnss_dns.so
218 $(inst_libdir)/libnss_dns.so:
219
220 ifeq ($(run-built-tests),yes)
221 ifneq (no,$(PERL))
222 tests-special += $(objpfx)mtrace-tst-leaks.out $(objpfx)mtrace-tst-leaks2.out \
223 $(objpfx)mtrace-tst-resolv-res_ninit.out
224 endif
225 endif
226
227 generated += mtrace-tst-leaks.out tst-leaks.mtrace \
228 mtrace-tst-leaks2.out tst-leaks2.mtrace \
229 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
230
231 include ../Rules
232
233 LOCALES := en_US.UTF-8 en_US.ISO-8859-1
234 include ../gen-locales.mk
235
236 CFLAGS-res_hconf.c += -fexceptions
237
238 # The DNS NSS modules needs the resolver.
239 $(objpfx)libnss_dns.so: $(objpfx)libresolv.so
240
241 # The asynchronous name lookup code needs the thread library.
242 $(objpfx)libanl.so: $(shared-thread-library)
243
244 $(objpfx)tst-res_hconf_reorder: $(shared-thread-library)
245 tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
246
247 $(objpfx)tst-leaks: $(objpfx)libresolv.so
248 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
249 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
250 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
251 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
252 $(evaluate-test)
253
254 tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace \
255 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
256 $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
257 { test -r $(objpfx)tst-leaks2.mtrace \
258 || ( echo "tst-leaks2.mtrace does not exist"; exit 77; ) \
259 && $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace; } > $@; \
260 $(evaluate-test)
261
262 tst-resolv-res_ninit-ENV = MALLOC_TRACE=$(objpfx)tst-resolv-res_ninit.mtrace \
263 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
264 $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
265 $(common-objpfx)malloc/mtrace \
266 $(objpfx)tst-resolv-res_ninit.mtrace > $@; \
267 $(evaluate-test)
268
269 $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
270 $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
271 $(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
272 $(objpfx)tst-resolv-ai_idn-latin1: \
273 $(objpfx)libresolv.so $(shared-thread-library)
274 $(objpfx)tst-resolv-ai_idn-nolibidn2: \
275 $(objpfx)libresolv.so $(shared-thread-library)
276 $(objpfx)tst-resolv-ai_idn.out: $(gen-locales)
277 $(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)
278 $(objpfx)tst-resolv-ai_idn-nolibidn2.out: \
279 $(gen-locales) $(objpfx)tst-no-libidn2.so
280 $(objpfx)tst-resolv-aliases: $(objpfx)libresolv.so $(shared-thread-library)
281 $(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)
282 $(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)
283 $(objpfx)tst-resolv-byaddr: $(objpfx)libresolv.so $(shared-thread-library)
284 $(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)
285 $(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)
286 $(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so
287 $(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \
288 $(shared-thread-library)
289 $(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \
290 $(shared-thread-library)
291 $(objpfx)tst-resolv-invalid-cname: $(objpfx)libresolv.so \
292 $(shared-thread-library)
293 $(objpfx)tst-resolv-noaaaa: $(objpfx)libresolv.so $(shared-thread-library)
294 $(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)
295 $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
296 $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)
297 $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
298 $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
299 $(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)
300 $(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
301 $(static-thread-library)
302 $(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)
303 $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
304
305 $(objpfx)tst-ns_name: $(objpfx)libresolv.so
306 $(objpfx)tst-ns_name.out: tst-ns_name.data
307 $(objpfx)tst-ns_name_compress: $(objpfx)libresolv.so
308 $(objpfx)tst-ns_name_pton: $(objpfx)libresolv.so
309 $(objpfx)tst-res_hnok: $(objpfx)libresolv.so
310 $(objpfx)tst-p_secstodate: $(objpfx)libresolv.so