]>
Commit | Line | Data |
---|---|---|
7f98c6bc GDR |
1 | ## Makefile for the testsuite subdirectory of the GNU C++ Standard library. |
2 | ## | |
8d9254fc | 3 | ## Copyright (C) 2001-2020 Free Software Foundation, Inc. |
7f98c6bc GDR |
4 | ## |
5 | ## This file is part of the libstdc++ version 3 distribution. | |
6 | ## Process this file with automake to produce Makefile.in. | |
7 | ||
8 | ## This file is part of the GNU ISO C++ Library. This library is free | |
9 | ## software; you can redistribute it and/or modify it under the | |
10 | ## terms of the GNU General Public License as published by the | |
748086b7 | 11 | ## Free Software Foundation; either version 3, or (at your option) |
7f98c6bc GDR |
12 | ## any later version. |
13 | ||
14 | ## This library is distributed in the hope that it will be useful, | |
15 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ## GNU General Public License for more details. | |
18 | ||
19 | ## You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
20 | ## with this library; see the file COPYING3. If not see |
21 | ## <http://www.gnu.org/licenses/>. | |
7f98c6bc | 22 | |
7134e605 JJ |
23 | AUTOMAKE_OPTIONS = nostdinc |
24 | RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir | |
25 | EXPECT = expect | |
7f98c6bc | 26 | |
0df3f383 | 27 | include $(top_srcdir)/fragment.am |
a1af4623 | 28 | |
4b260c20 BK |
29 | # Generated lists of files to run. All of these names are valid make |
30 | # targets, if you wish to generate a list manually. | |
31 | lists_of_files = \ | |
32 | testsuite_files \ | |
33 | testsuite_files_interactive \ | |
34 | testsuite_files_performance | |
35 | ||
5305b1ae BK |
36 | # This rule generates all of the testsuite_files* lists at once. |
37 | ${lists_of_files}: | |
38 | ${glibcxx_srcdir}/scripts/create_testsuite_files \ | |
39 | ${glibcxx_srcdir}/testsuite `${PWD_COMMAND}` | |
4b260c20 | 40 | |
d54bc1d8 PE |
41 | # We need more things in site.exp, but automake completely controls the |
42 | # creation of that file; there's no way to append to it without messing up | |
43 | # the dependancy chains. So we overrule automake. This rule is exactly | |
44 | # what it would have generated, plus our own additions. | |
45 | site.exp: Makefile | |
46 | @echo 'Making a new site.exp file...' | |
47 | @echo '## these variables are automatically generated by make ##' >site.tmp | |
48 | @echo '# Do not edit here. If you wish to override these values' >>site.tmp | |
49 | @echo '# edit the last section' >>site.tmp | |
bc7a4f2f | 50 | @echo 'set tool libstdc++' >>site.tmp |
d54bc1d8 PE |
51 | @echo 'set srcdir $(srcdir)' >>site.tmp |
52 | @echo "set objdir `pwd`" >>site.tmp | |
53 | @echo 'set build_alias "$(build_alias)"' >>site.tmp | |
54 | @echo 'set build_triplet $(build_triplet)' >>site.tmp | |
55 | @echo 'set host_alias "$(host_alias)"' >>site.tmp | |
56 | @echo 'set host_triplet $(host_triplet)' >>site.tmp | |
57 | @echo 'set target_alias "$(target_alias)"' >>site.tmp | |
58 | @echo 'set target_triplet $(target_triplet)' >>site.tmp | |
d54bc1d8 | 59 | @echo 'set libiconv "$(LIBICONV)"' >>site.tmp |
68c512f6 | 60 | @echo 'set baseline_dir "$(baseline_dir)"' >> site.tmp |
00fc1bf6 | 61 | @echo 'set baseline_subdir_switch "$(baseline_subdir_switch)"' >> site.tmp |
0805e111 | 62 | @echo 'set TEST_GCC_EXEC_PREFIX "$(libdir)/gcc/"' >> site.tmp |
d54bc1d8 PE |
63 | @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp |
64 | @test ! -f site.exp || \ | |
65 | sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp | |
66 | @-rm -f site.bak | |
67 | @test ! -f site.exp || mv site.exp site.bak | |
68 | @mv site.tmp site.exp | |
69 | ||
5305b1ae | 70 | |
e1208a57 | 71 | extract_symvers = $(glibcxx_builddir)/scripts/extract_symvers |
c4c064e7 | 72 | |
00fc1bf6 | 73 | baseline_subdir := $(shell $(CXX) $(baseline_subdir_switch)) |
c18dc5cc | 74 | |
c4c064e7 | 75 | baseline_symbols: |
c18dc5cc | 76 | -@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \ |
c4c064e7 BK |
77 | if test ! -f $${output}; then \ |
78 | echo "Baseline file doesn't exist."; \ | |
79 | echo "Try 'make new-abi-baseline' to create it."; \ | |
80 | exit 1; \ | |
7685a26d | 81 | fi; true) |
c4c064e7 | 82 | |
ca618b60 | 83 | new-abi-baseline: |
33f49367 | 84 | -@$(mkinstalldirs) ${baseline_dir}/${baseline_subdir} |
c18dc5cc | 85 | -@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \ |
c4c064e7 BK |
86 | if test -f $${output}; then \ |
87 | output=$${output}.new; \ | |
88 | t=`echo $${output} | sed 's=.*config/abi/=='`; \ | |
89 | echo "Baseline file already exists, writing to $${t} instead."; \ | |
90 | fi; \ | |
91 | ${extract_symvers} ../src/.libs/libstdc++.so $${output}) | |
92 | ||
7134e605 | 93 | %/site.exp: site.exp |
2eac0853 | 94 | -@test -d $* || mkdir $* |
7134e605 | 95 | @srcdir=`cd $(srcdir); ${PWD_COMMAND}`; |
2eac0853 | 96 | @objdir=`${PWD_COMMAND}`/$*; \ |
7134e605 JJ |
97 | sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \ |
98 | -e "s|^set objdir .*$$|set objdir $$objdir|" \ | |
99 | site.exp > $*/site.exp.tmp | |
100 | @-rm -f $*/site.bak | |
101 | @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak | |
102 | @mv $*/site.exp.tmp $*/site.exp | |
103 | ||
717c4789 JJ |
104 | check_p_numbers0:=1 2 3 4 5 6 7 8 9 |
105 | check_p_numbers1:=0 $(check_p_numbers0) | |
106 | check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1))) | |
107 | check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2) | |
108 | check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3))) | |
109 | check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4) | |
110 | check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5))) | |
111 | check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6) | |
112 | check_p_subdirs=$(wordlist 1,$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128),$(check_p_numbers)) | |
113 | check_DEJAGNU_normal_targets = $(addprefix check-DEJAGNUnormal,$(check_p_subdirs)) | |
7134e605 JJ |
114 | $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp |
115 | ||
116 | # Run the testsuite in normal mode. | |
117 | check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp | |
2eac0853 | 118 | $(if $*,@)AR="$(AR)"; export AR; \ |
8927b7c0 | 119 | RANLIB="$(RANLIB)"; export RANLIB; \ |
b2b0acbe | 120 | if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \ |
717c4789 JJ |
121 | rm -rf normal-parallel || true; \ |
122 | mkdir normal-parallel; \ | |
f1ee724c | 123 | $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_normal_targets); \ |
717c4789 JJ |
124 | rm -rf normal-parallel || true; \ |
125 | for idx in $(check_p_subdirs); do \ | |
126 | if [ -d normal$$idx ]; then \ | |
127 | mv -f normal$$idx/libstdc++.sum normal$$idx/libstdc++.sum.sep; \ | |
128 | mv -f normal$$idx/libstdc++.log normal$$idx/libstdc++.log.sep; \ | |
129 | fi; \ | |
7134e605 | 130 | done; \ |
7134e605 | 131 | $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \ |
717c4789 | 132 | normal[0-9]*/libstdc++.sum.sep > libstdc++.sum; \ |
7134e605 | 133 | $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \ |
717c4789 | 134 | normal[0-9]*/libstdc++.log.sep > libstdc++.log; \ |
7134e605 JJ |
135 | exit 0; \ |
136 | fi; \ | |
137 | srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ | |
138 | EXPECT=$(EXPECT); export EXPECT; \ | |
139 | runtest=$(RUNTEST); \ | |
140 | if [ -z "$$runtest" ]; then runtest=runtest; fi; \ | |
141 | tool=libstdc++; \ | |
717c4789 JJ |
142 | if [ -n "$*" ]; then \ |
143 | if [ -f normal-parallel/finished ]; then rm -rf "$*"; exit 0; fi; \ | |
144 | GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/normal-parallel; \ | |
145 | export GCC_RUNTEST_PARALLELIZE_DIR; \ | |
146 | cd "$*"; \ | |
147 | fi; \ | |
7134e605 | 148 | if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ |
717c4789 | 149 | $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \ |
7134e605 | 150 | $(RUNTESTFLAGS); \ |
717c4789 JJ |
151 | if [ -n "$*" ]; then \ |
152 | touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished; \ | |
7134e605 | 153 | fi; \ |
717c4789 JJ |
154 | else \ |
155 | echo "WARNING: could not find \`runtest'" 1>&2; :;\ | |
7134e605 JJ |
156 | fi |
157 | ||
158 | check-am: | |
159 | $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU | |
160 | .PHONY: check-DEJAGNU | |
161 | ||
c4c064e7 BK |
162 | # Use 'new-abi-baseline' to create an initial symbol file. Then run |
163 | # 'check-abi' to test for changes against that file. | |
4569a895 | 164 | check-abi: site.exp baseline_symbols |
68c512f6 | 165 | -@runtest $(AM_RUNTESTFLAGS) --tool libstdc++ $(RUNTESTFLAGS) abi.exp |
6b543e86 | 166 | |
5305b1ae BK |
167 | # Runs the testsuite, but in compile only mode. |
168 | # Can be used to test sources with non-GNU FE's at various warning | |
169 | # levels and for checking compile time across releases. | |
170 | # See script. | |
171 | compile_script=${glibcxx_srcdir}/scripts/check_compile | |
172 | check-compile: testsuite_files ${compile_script} | |
173 | -@(chmod + ${compile_script}; \ | |
174 | ${compile_script} ${glibcxx_srcdir} ${glibcxx_builddir}) | |
0676e930 BK |
175 | |
176 | ||
ca618b60 | 177 | # Runs the testsuite/performance tests. |
0676e930 BK |
178 | # Some of these tests create large (~75MB) files, allocate huge |
179 | # ammounts of memory, or otherwise tie up machine resources. Thus, | |
180 | # running this is off by default. | |
4569a895 AT |
181 | # XXX Need to add dependency on libtestc++.a |
182 | check_performance_script=${glibcxx_srcdir}/scripts/check_performance | |
ac3d7b44 | 183 | check-performance: testsuite_files_performance ${performance_script} |
4569a895 | 184 | -@(chmod + ${check_performance_script}; \ |
6ce2cb11 | 185 | CXXFLAGS='$(CXXFLAGS)'; export CXXFLAGS; \ |
4569a895 AT |
186 | ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir}) |
187 | ||
da9debb8 PC |
188 | # Runs the testsuite in debug mode. |
189 | debug_flags = "unix/-D_GLIBCXX_DEBUG" | |
0676e930 | 190 | |
c2ba9709 JS |
191 | # Runs the testsuite in parallel mode. |
192 | libgomp_dir=${glibcxx_builddir}/../libgomp | |
193 | libgomp_flags=-B${glibcxx_builddir}/../libgomp \ | |
194 | -I${glibcxx_builddir}/../libgomp \ | |
195 | -L${glibcxx_builddir}/../libgomp/.libs -lgomp | |
196 | ||
197 | atomic_flags=$(ATOMIC_FLAGS) | |
198 | parallel_flags="unix/-D_GLIBCXX_PARALLEL/-fopenmp" | |
199 | ||
da9debb8 PC |
200 | check-debug: site.exp |
201 | outputdir=debug; export outputdir; \ | |
202 | if test ! -d $${outputdir}; then \ | |
203 | mkdir $${outputdir}; \ | |
204 | fi; \ | |
205 | srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ | |
206 | EXPECT=$(EXPECT); export EXPECT; \ | |
207 | $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(debug_flags)" check-DEJAGNU; | |
208 | ||
c2ba9709 JS |
209 | check-parallel: site.exp |
210 | -@(if test ! -d $${libgomp_dir}; then \ | |
211 | echo "Testing parallel mode failed as libgomp not present."; \ | |
212 | exit 1; \ | |
213 | fi; \ | |
214 | outputdir=parallel; export outputdir; \ | |
215 | if test ! -d $${outputdir}; then \ | |
216 | mkdir $${outputdir}; \ | |
217 | fi; \ | |
218 | srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ | |
219 | EXPECT=$(EXPECT); export EXPECT; \ | |
18080e8e | 220 | $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; ) |
c2ba9709 JS |
221 | |
222 | check-performance-parallel: testsuite_files_performance ${performance_script} | |
223 | -@(chmod + ${check_performance_script}; \ | |
224 | CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \ | |
225 | ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir}) | |
ac3d7b44 | 226 | |
5305b1ae | 227 | .PHONY: baseline_symbols new-abi-baseline \ |
544be2be | 228 | check-abi check-compile check-performance check-parallel |
0676e930 | 229 | |
6b543e86 | 230 | # By adding these files here, automake will remove them for 'make clean' |
0c45b8e0 | 231 | CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \ |
fd1e1726 | 232 | testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \ |
cbef15a5 | 233 | *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb |
c2ba9709 JS |
234 | |
235 | # To remove directories. | |
236 | clean-local: | |
544be2be | 237 | rm -rf de fr debug parallel binaries normal* |