about summary refs log tree commit diff
path: root/conform/Makefile
blob: 6291ca9642ed4283969664e92b78794f45cc7638 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# Copyright (C) 1999-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.

# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.

#
#	Sub-makefile for conform portion of the library.
#
subdir	:= conform

include ../Makeconfig

conformtest-headers-data := $(wildcard data/*.h-data) \
			    $(wildcard data/*/*.h-data)

conformtest-standards := ISO ISO99 ISO11 POSIX XPG3 XPG4 UNIX98 XOPEN2K \
			 POSIX2008 XOPEN2K8

conformtest-headers-ISO := assert.h ctype.h errno.h float.h limits.h locale.h \
			   math.h setjmp.h signal.h stdarg.h stddef.h stdio.h \
			   stdlib.h string.h time.h
conformtest-headers-ISO99 := $(conformtest-headers-ISO) complex.h fenv.h \
			     inttypes.h iso646.h stdbool.h stdint.h tgmath.h \
			     wchar.h wctype.h
# Missing ISO11 expectations for: stdatomic.h threads.h.
conformtest-headers-ISO11 := $(conformtest-headers-ISO99) stdalign.h \
			     stdnoreturn.h uchar.h
conformtest-headers-POSIX := $(conformtest-headers-ISO) aio.h dirent.h \
			     fcntl.h fnmatch.h glob.h grp.h mqueue.h \
			     pthread.h pwd.h regex.h sched.h semaphore.h \
			     sys/mman.h sys/stat.h sys/times.h sys/types.h \
			     sys/utsname.h sys/wait.h tar.h termios.h \
			     unistd.h utime.h wordexp.h
# Missing XPG3 expectations for: regexp.h wchar.h.
conformtest-headers-XPG3 := $(conformtest-headers-ISO) cpio.h dirent.h \
			    fcntl.h fnmatch.h ftw.h glob.h grp.h iconv.h \
			    langinfo.h monetary.h nl_types.h pwd.h regex.h \
			    search.h sys/ipc.h sys/msg.h sys/sem.h sys/shm.h \
			    sys/stat.h sys/times.h sys/types.h sys/utsname.h \
			    sys/wait.h tar.h termios.h ulimit.h unistd.h \
			    utime.h varargs.h wordexp.h
# Missing XPG4 expectations for: re_comp.h regexp.h wchar.h.
# XPG4 includes XTI, but xti.h is outside the scope of these tests.
conformtest-headers-XPG4 := $(conformtest-headers-XPG3) arpa/inet.h fmtmsg.h \
			    libgen.h ndbm.h netdb.h netinet/in.h poll.h \
			    strings.h stropts.h sys/mman.h sys/resource.h \
			    sys/socket.h sys/statvfs.h sys/time.h sys/timeb.h \
			    sys/uio.h sys/un.h syslog.h ucontext.h utmpx.h
# Missing UNIX98 expectations for: inttypes.h re_comp.h regexp.h.
# The online UNIX98 includes XCURSES, but curses.h, term.h and
# unctrl.h are outside the scope of these tests.  It also includes
# XTI, but xti.h is outside the scope of these tests.
conformtest-headers-UNIX98 := $(conformtest-headers-POSIX) arpa/inet.h cpio.h \
			      dlfcn.h fmtmsg.h ftw.h iconv.h iso646.h \
			      langinfo.h libgen.h monetary.h ndbm.h netdb.h \
			      netinet/in.h nl_types.h poll.h search.h \
			      strings.h stropts.h sys/ipc.h sys/msg.h \
			      sys/resource.h sys/sem.h sys/shm.h sys/socket.h \
			      sys/statvfs.h sys/time.h sys/timeb.h sys/uio.h \
			      sys/un.h syslog.h ucontext.h ulimit.h utmpx.h \
			      varargs.h wchar.h wctype.h
# Missing XOPEN2K expectations for: trace.h.
conformtest-headers-XOPEN2K := $(conformtest-headers-POSIX) arpa/inet.h \
			       complex.h cpio.h dlfcn.h fenv.h fmtmsg.h ftw.h \
			       iconv.h inttypes.h iso646.h langinfo.h \
			       libgen.h monetary.h ndbm.h net/if.h netdb.h \
			       netinet/in.h netinet/tcp.h nl_types.h poll.h \
			       search.h spawn.h stdbool.h stdint.h strings.h \
			       stropts.h sys/ipc.h sys/msg.h sys/resource.h \
			       sys/select.h sys/sem.h sys/shm.h sys/socket.h \
			       sys/statvfs.h sys/time.h sys/timeb.h sys/uio.h \
			       sys/un.h syslog.h tgmath.h ucontext.h ulimit.h \
			       utmpx.h wchar.h wctype.h
# Missing POSIX2008 expectations for: trace.h.
conformtest-headers-POSIX2008 := $(conformtest-headers-POSIX) arpa/inet.h \
				 complex.h cpio.h dlfcn.h fenv.h iconv.h \
				 inttypes.h iso646.h langinfo.h monetary.h \
				 net/if.h netdb.h netinet/in.h netinet/tcp.h \
				 nl_types.h poll.h spawn.h stdbool.h stdint.h \
				 strings.h stropts.h sys/select.h \
				 sys/socket.h sys/statvfs.h sys/un.h tgmath.h \
				 wchar.h wctype.h
# Missing XOPEN2K8 expectations for: trace.h.
conformtest-headers-XOPEN2K8 := $(conformtest-headers-POSIX2008) fmtmsg.h \
				ftw.h libgen.h ndbm.h search.h sys/ipc.h \
				sys/msg.h sys/resource.h sys/sem.h sys/shm.h \
				sys/time.h sys/uio.h syslog.h ulimit.h utmpx.h

conformtest-header-list-base := $(foreach std,$(conformtest-standards),\
					      header-list-$(std).out)
conformtest-header-list-tests := $(addprefix $(objpfx),\
					     $(conformtest-header-list-base))
tests-special += $(conformtest-header-list-tests)
generated += $(conformtest-header-list-base)

conformtest-header-base := $(foreach std,\
				     $(conformtest-standards),\
				     $(foreach h,\
					       $(conformtest-headers-$(std)),\
					       $(std)/$(h)/conform.out))
conformtest-header-tests := $(addprefix $(objpfx),$(conformtest-header-base))
ifneq (yes,$(fast-check))
ifeq (no,$(cross-compiling))
tests-special += $(conformtest-header-tests)
generated += $(conformtest-header-base)
endif
endif

linknamespace-symlists-base := $(foreach std,$(conformtest-standards),\
					     symlist-$(std))
linknamespace-symlists-tests := $(addprefix $(objpfx),\
					    $(linknamespace-symlists-base))
tests-special += $(linknamespace-symlists-tests)

linknamespace-symlist-stdlibs-base := $(foreach std,$(conformtest-standards),\
						    symlist-stdlibs-$(std))
linknamespace-symlist-stdlibs-tests := \
	$(addprefix $(objpfx),\
		    $(linknamespace-symlist-stdlibs-base))

tests-special += $(linknamespace-symlist-stdlibs-tests)

linknamespace-header-base := $(foreach std,\
				       $(conformtest-standards),\
				       $(foreach h,\
						 $(conformtest-headers-$(std)),\
						 $(std)/$(h)/linknamespace.out))
linknamespace-header-tests := $(addprefix $(objpfx),\
					  $(linknamespace-header-base))
tests-special += $(linknamespace-header-tests)

include ../Rules

$(conformtest-header-list-tests): $(objpfx)header-list-%.out: \
				  check-header-lists.sh \
				  $(conformtest-headers-data)
	$(SHELL) $< "$*" "$(CC)" "$(strip $(conformtest-headers-$*))" \
		 "$(conformtest-headers-data)" > $@; \
	$(evaluate-test)

# Pre-standard C feature no longer supported by GCC (obsoleted in
# newer POSIX standards).
test-xfail-XPG3/varargs.h/conform = yes
test-xfail-XPG4/varargs.h/conform = yes
test-xfail-UNIX98/varargs.h/conform = yes

# Header not provided by glibc.
test-xfail-XPG4/ndbm.h/conform = yes
test-xfail-UNIX98/ndbm.h/conform = yes
test-xfail-XOPEN2K/ndbm.h/conform = yes
test-xfail-XOPEN2K8/ndbm.h/conform = yes

# Unsorted expected failures.
test-xfail-XPG3/fcntl.h/conform = yes
test-xfail-XPG3/ftw.h/conform = yes
test-xfail-XPG3/limits.h/conform = yes
test-xfail-XPG3/pwd.h/conform = yes
test-xfail-XPG3/search.h/conform = yes
test-xfail-XPG3/signal.h/conform = yes
test-xfail-XPG3/stdlib.h/conform = yes
test-xfail-XPG3/string.h/conform = yes
test-xfail-XPG3/sys/wait.h/conform = yes
test-xfail-XPG3/termios.h/conform = yes
test-xfail-XPG3/time.h/conform = yes
test-xfail-XPG3/unistd.h/conform = yes
test-xfail-XPG4/arpa/inet.h/conform = yes
test-xfail-XPG4/fcntl.h/conform = yes
test-xfail-XPG4/netdb.h/conform = yes
test-xfail-XPG4/netinet/in.h/conform = yes
test-xfail-XPG4/signal.h/conform = yes
test-xfail-XPG4/stdlib.h/conform = yes
test-xfail-XPG4/sys/stat.h/conform = yes
test-xfail-XPG4/sys/wait.h/conform = yes
test-xfail-XPG4/termios.h/conform = yes
test-xfail-XPG4/ucontext.h/conform = yes
test-xfail-XPG4/unistd.h/conform = yes
test-xfail-POSIX/sys/wait.h/conform = yes
test-xfail-UNIX98/arpa/inet.h/conform = yes
test-xfail-UNIX98/netdb.h/conform = yes
test-xfail-UNIX98/netinet/in.h/conform = yes
test-xfail-UNIX98/signal.h/conform = yes
test-xfail-UNIX98/stdlib.h/conform = yes
test-xfail-UNIX98/sys/wait.h/conform = yes
test-xfail-UNIX98/ucontext.h/conform = yes
test-xfail-XOPEN2K/semaphore.h/conform = yes
test-xfail-XOPEN2K/signal.h/conform = yes
test-xfail-XOPEN2K/sys/wait.h/conform = yes
test-xfail-XOPEN2K/ucontext.h/conform = yes
test-xfail-POSIX2008/arpa/inet.h/conform = yes
test-xfail-POSIX2008/netdb.h/conform = yes
test-xfail-POSIX2008/netinet/in.h/conform = yes
test-xfail-POSIX2008/signal.h/conform = yes
test-xfail-POSIX2008/sys/socket.h/conform = yes
test-xfail-POSIX2008/sys/wait.h/conform = yes
test-xfail-XOPEN2K8/signal.h/conform = yes
test-xfail-XOPEN2K8/sys/wait.h/conform = yes

conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I..
$(conformtest-header-tests): $(objpfx)%/conform.out: \
			     conformtest.pl $(conformtest-headers-data)
	(set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \
	 mkdir -p $(@D)/scratch; \
	 $(PERL) conformtest.pl --tmpdir=$(@D)/scratch --cc='$(CC)' \
		 --flags='$(conformtest-cc-flags)' --standard=$$std \
		 --headers=$$hdr > $@); \
	$(evaluate-test)

$(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.pl
	$(PERL) -w $< --tmpdir=$(objpfx) --cc='$(CC)' \
		--flags='$(conformtest-cc-flags)' --standard=$* \
		--headers="$(strip $(conformtest-headers-$*))" \
		> $@ 2> $@.err; \
	$(evaluate-test)

linknamespace-libs-isoc = $(common-objpfx)libc.a $(common-objpfx)math/libm.a
linknamespace-libs = $(linknamespace-libs-isoc) \
		     $(common-objpfx)rt/librt.a $(static-thread-library)
linknamespace-libs-ISO = $(linknamespace-libs-isoc)
linknamespace-libs-ISO99 = $(linknamespace-libs-isoc)
linknamespace-libs-ISO11 = $(linknamespace-libs-isoc)
linknamespace-libs-XPG3 = $(linknamespace-libs-isoc)
linknamespace-libs-XPG4 = $(linknamespace-libs-isoc)
linknamespace-libs-POSIX = $(linknamespace-libs)
linknamespace-libs-UNIX98 = $(linknamespace-libs)
linknamespace-libs-XOPEN2K = $(linknamespace-libs)
linknamespace-libs-POSIX2008 = $(linknamespace-libs)
linknamespace-libs-XOPEN2K8 = $(linknamespace-libs)

$(linknamespace-symlist-stdlibs-tests): $(objpfx)symlist-stdlibs-%: \
					$(linknamespace-libs)
	LC_ALL=C $(READELF) -W -s $(linknamespace-libs-$*) > $@; \
	$(evaluate-test)

$(linknamespace-header-tests): $(objpfx)%/linknamespace.out: \
			       linknamespace.pl \
			       $(linknamespace-symlist-stdlibs-tests)
	(set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \
	 mkdir -p $(@D)/scratch; \
	 $(PERL) -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \
		 --flags='$(conformtest-cc-flags)' --standard=$$std \
		 --stdsyms=$(objpfx)symlist-$$std --header=$$hdr \
		 --libsyms=$(objpfx)symlist-stdlibs-$$std \
		 --readelf='$(READELF)' \
		 > $@ 2>&1); \
	$(evaluate-test)

# Pre-standard C feature no longer supported by GCC (obsoleted in
# newer POSIX standards).
test-xfail-XPG3/varargs.h/linknamespace = yes
test-xfail-XPG4/varargs.h/linknamespace = yes
test-xfail-UNIX98/varargs.h/linknamespace = yes

# Header not provided by glibc.
test-xfail-XPG4/ndbm.h/linknamespace = yes
test-xfail-UNIX98/ndbm.h/linknamespace = yes
test-xfail-XOPEN2K/ndbm.h/linknamespace = yes
test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes