blob: 81aa619435dcf49dc309fbacca0c6ff013776e93 (
plain)
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
|
##
## Copyright (C) 2016 and later: Unicode, Inc. and others.
## License & terms of use: http://www.unicode.org/copyright.html
## Copyright (c) 1999-2011, International Business Machines Corporation and
## others. All Rights Reserved.
##
##
## THE PURPOSE OF THIS TEST
##
## This tests all public header files - as installed. icu-config needs to be on the PATH
##
## To run it simply type 'make check' after ICU is installed. You SHOULD see:
##
## unicode/uchar.h - 0
## unicode/uchriter.h - 0
## unicode/ucnv.h - 0
##
## .. etc. Anything other than zero is an error. (except for the deprecation tests, where '1' is the correct value)
##
##
## If a header fails the C compile because it's a C++ header, add it to the
## file named 'cxxfiles.txt' in this directory.
##
## If a header fails because it is deprecated, add it to the 'dfiles.txt'
##
##
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ../..
subdir = test/hdrtst
include $(shell icu-config --incfile)
DIRS=$(prefix)/include/unicode
LDIRS=$(prefix)/include/layout
ECHO_T=@ECHO_T@
ECHO_C=@ECHO_C@
ECHO_N=@ECHO_N@
all:
@echo Please read this Makefile for more information.
@echo run \'$(MAKE) check\' to run the test "(use -k if you don't want to stop on errs)"
E_NUM=8
E_D="[1/$(E_NUM)] Deprecated: "
E_C="[2/$(E_NUM)] C : "
E_CXX="[3/$(E_NUM)] C++: "
E_CXX_L="[4/$(E_NUM)] C++ layout: "
E_DRF="[5/$(E_NUM)] Hide Draft: "
E_DEP="[6/$(E_NUM)] Hide Deprecated: "
E_INT="[7/$(E_NUM)] Hide Internal: "
E_OBS="[8/$(E_NUM)] Hide Obsolete: "
check: dtest ctest cpptest doclean drafttest deprtest internaltest obsoletetest
ifeq ($(MAKECMDGOALS),check)
$(MAKE) clean
else
@echo "(not cleaning automatically)"
endif
# break dependency
doclean:
make clean
cpptest:
@FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo "$@ unicode/$$incfile.h" ; \
echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \
echo 'void junk(){}' >> ht_$$incfile.cpp ; \
$(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp || FAIL=1 ; \
done ;\
exit $$FAIL
# layout is removed
dtest:
@FAIL=0;NONE="(No deprecated headers)";for stub in `cat $(srcdir)/dfiles.txt | grep -v '^#'` ; do \
file=unicode/$$stub ; \
NONE="" ; \
incfile=`basename $$file .h` ; \
echo "$@ unicode/$$incfile.h" ; \
echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \
echo 'void junk(){}' >> ht_$$incfile.cpp ; \
echo > ht_dep.junk ; \
$(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp 2>&1 | sed -e 's/^.*#error[^"]*"//' | fgrep -v ht_ | tee ht_dep.junk | fgrep -v "$$incfile.h header is obsolete" ; \
RES=$$? ; \
echo $$RES ; \
fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || echo "** FAIL Header unicode/$$incfile.h is not obsoleted properly" ; \
fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || FAIL=1 ; \
rm -f unicode/$$stub ; \
done ; \
echo "$@: $$NONE - exit status $$FAIL" ; \
exit $$FAIL
# < ht_dep.junk && ; \
ctest:
@echo Building test harness for header files in ../../common and ../../i18n
@FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/cxxfiles.txt | tee cfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo "$@ unicode/$$incfile.h" ; \
echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.c ; \
echo 'void junk(void);' >> ht_$$incfile.c ; \
echo 'void junk(){}' >> ht_$$incfile.c ; \
$(COMPILE.c) -c $(cppflags) ht_$$incfile.c || FAIL=1 ; \
done ;\
exit $$FAIL
drafttest:
@FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo "$@ unicode/$$incfile.h" ; \
echo '#define U_HIDE_DRAFT_API' > hd_$$incfile.c; \
echo '#include "'unicode/$$incfile'.h"' >> hd_$$incfile.c ; \
echo 'void junk(void);' >> hd_$$incfile.c ; \
echo 'void junk(){}' >> hd_$$incfile.c ; \
$(COMPILE.cc) -c $(cppflags) hd_$$incfile.c ||FAIL=1 ; \
done ;\
exit $$FAIL
deprtest:
@FAIL=0; for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo "$@ unicode/$$incfile.h" ; \
echo '#define U_HIDE_DEPRECATED_API' > hdp_$$incfile.c; \
echo '#include "'unicode/$$incfile'.h"' >> hdp_$$incfile.c ; \
echo 'void junk(void);' >> hdp_$$incfile.c ; \
echo 'void junk(){}' >> hdp_$$incfile.c ; \
$(COMPILE.cc) -c $(cppflags) hdp_$$incfile.c || FAIL=1; \
done ; \
exit $$FAIL
internaltest:
@FAIL=0;\
for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo "$@ unicode/$$incfile.h" ; \
echo '#define U_HIDE_INTERNAL_API' > hin_$$incfile.c; \
echo '#include "'unicode/$$incfile'.h"' >> hin_$$incfile.c ; \
echo 'void junk(void);' >> hin_$$incfile.c ; \
echo 'void junk(){}' >> hin_$$incfile.c ; \
$(COMPILE.cc) -c $(cppflags) hin_$$incfile.c || FAIL=1 ; \
done ; \
exit $$FAIL
obsoletetest:
@FAIL=0;for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo "$@ unicode/$$incfile.h" ; \
echo '#define U_HIDE_OBSOLETE_API' > hob_$$incfile.c; \
echo '#include "'unicode/$$incfile'.h"' >> hob_$$incfile.c ; \
echo 'void junk(void);' >> hob_$$incfile.c ; \
echo 'void junk(){}' >> hob_$$incfile.c ; \
$(COMPILE.cc) -c $(cppflags) hob_$$incfile.c || FAIL=1 ; \
done ; \
exit $$FAIL
clean:
-@echo cleaning..
-@rm -f *.h *.c *.cpp *.o *.junk cfiles.txt
distclean: clean
-@rm -f Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
.PHONY: doclean check all cpptest dtest ctest clean distclean
|