1 ## Makefile for the testsuite subdirectory of the GNU C++ Standard library.
3 ## Copyright (C) 2001-2014 Free Software Foundation, Inc.
5 ## This file is part of the libstdc++ version 3 distribution.
6 ## Process this file with automake to produce Makefile.in.
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
11 ## Free Software Foundation; either version 3, or (at your option)
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.
19 ## You should have received a copy of the GNU General Public License along
20 ## with this library; see the file COPYING3. If not see
21 ## <http://www.gnu.org/licenses/>.
23 AUTOMAKE_OPTIONS = nostdinc
24 RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
27 include $(top_srcdir)/fragment.am
29 # Generated lists of files to run. All of these names are valid make
30 # targets, if you wish to generate a list manually.
33 testsuite_files_interactive \
34 testsuite_files_performance
36 # This rule generates all of the testsuite_files* lists at once.
38 ${glibcxx_srcdir}/scripts/create_testsuite_files \
39 ${glibcxx_srcdir}/testsuite `${PWD_COMMAND}`
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.
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
50 @echo 'set srcdir $(srcdir)' >>site.tmp
51 @echo "set objdir `pwd`" >>site.tmp
52 @echo 'set build_alias "$(build_alias)"' >>site.tmp
53 @echo 'set build_triplet $(build_triplet)' >>site.tmp
54 @echo 'set host_alias "$(host_alias)"' >>site.tmp
55 @echo 'set host_triplet $(host_triplet)' >>site.tmp
56 @echo 'set target_alias "$(target_alias)"' >>site.tmp
57 @echo 'set target_triplet $(target_triplet)' >>site.tmp
58 @echo 'set target_triplet $(target_triplet)' >>site.tmp
59 @echo 'set libiconv "$(LIBICONV)"' >>site.tmp
60 @echo 'set baseline_dir "$(baseline_dir)"' >> site.tmp
61 @echo 'set baseline_subdir_switch "$(baseline_subdir_switch)"' >> site.tmp
62 @echo 'set TEST_GCC_EXEC_PREFIX "$(libdir)/gcc/"' >> site.tmp
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
67 @test ! -f site.exp || mv site.exp site.bak
71 extract_symvers = $(glibcxx_builddir)/scripts/extract_symvers
73 baseline_subdir := $(shell $(CXX) $(baseline_subdir_switch))
76 -@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \
77 if test ! -f $${output}; then \
78 echo "Baseline file doesn't exist."; \
79 echo "Try 'make new-abi-baseline' to create it."; \
84 -@$(mkinstalldirs) ${baseline_dir}/${baseline_subdir}
85 -@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \
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."; \
91 ${extract_symvers} ../src/.libs/libstdc++.so $${output})
94 -test -d $* || mkdir $*
95 @srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
96 objdir=`${PWD_COMMAND}`/$*; \
97 sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
98 -e "s|^set objdir .*$$|set objdir $$objdir|" \
99 site.exp > $*/site.exp.tmp
101 @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
102 @mv $*/site.exp.tmp $*/site.exp
104 check_DEJAGNU_normal_targets = $(patsubst %,check-DEJAGNUnormal%,0 1 2 3 4 5 6 7 8 9 10)
105 $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
107 # Run the testsuite in normal mode.
108 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
109 AR="$(AR)"; export AR; \
110 RANLIB="$(RANLIB)"; export RANLIB; \
111 if [ -z "$*$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
112 && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
113 $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_normal_targets); \
114 for idx in 0 1 2 3 4 5 6 7 8 9 10; do \
115 mv -f normal$$idx/libstdc++.sum normal$$idx/libstdc++.sum.sep; \
116 mv -f normal$$idx/libstdc++.log normal$$idx/libstdc++.log.sep; \
118 mv -f libstdc++.sum libstdc++.sum.sep; \
119 mv -f libstdc++.log libstdc++.log.sep; \
120 $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
121 libstdc++.sum.sep normal[0-9]*/libstdc++.sum.sep > libstdc++.sum; \
122 $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
123 libstdc++.log.sep normal[0-9]*/libstdc++.log.sep > libstdc++.log; \
126 srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
127 EXPECT=$(EXPECT); export EXPECT; \
128 runtest=$(RUNTEST); \
129 if [ -z "$$runtest" ]; then runtest=runtest; fi; \
134 if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
135 $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
136 $(RUNTESTFLAGS) abi.exp prettyprinters.exp; \
137 else echo "WARNING: could not find \`runtest'" 1>&2; :;\
139 dirs="`cd $$srcdir; echo [013-9][0-9]_*/*`";; \
141 dirs="`cd $$srcdir; echo [ab]* de* [ep]*/*`";; \
143 dirs="`cd $$srcdir; echo 2[01]_*/*`";; \
145 dirs="`cd $$srcdir; echo 22_*/*`";; \
147 dirs="`cd $$srcdir; echo 23_*/[a-km-tw-z]*`";; \
149 dirs="`cd $$srcdir; echo 23_*/[luv]*`";; \
151 dirs="`cd $$srcdir; echo 2[459]_*/*`";; \
153 dirs="`cd $$srcdir; echo 26_*/* 28_*/[c-z]*`";; \
155 dirs="`cd $$srcdir; echo 27_*/*`";; \
157 dirs="`cd $$srcdir; echo 28_*/[ab]*`";; \
159 dirs="`cd $$srcdir; echo t*/*`";; \
161 if [ -n "$*" ]; then cd "$*"; fi; \
162 if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
163 if [ -n "$$dirs" ]; then \
164 $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
166 "conformance.exp=`echo $$dirs | sed 's/ /* /g;s/$$/*/'`"; \
168 $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
171 else echo "WARNING: could not find \`runtest'" 1>&2; :;\
175 $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
176 .PHONY: check-DEJAGNU
178 # Use 'new-abi-baseline' to create an initial symbol file. Then run
179 # 'check-abi' to test for changes against that file.
180 check-abi: site.exp baseline_symbols
181 -@runtest $(AM_RUNTESTFLAGS) --tool libstdc++ $(RUNTESTFLAGS) abi.exp
183 # Runs the testsuite, but in compile only mode.
184 # Can be used to test sources with non-GNU FE's at various warning
185 # levels and for checking compile time across releases.
187 compile_script=${glibcxx_srcdir}/scripts/check_compile
188 check-compile: testsuite_files ${compile_script}
189 -@(chmod + ${compile_script}; \
190 ${compile_script} ${glibcxx_srcdir} ${glibcxx_builddir})
193 # Runs the testsuite/performance tests.
194 # Some of these tests create large (~75MB) files, allocate huge
195 # ammounts of memory, or otherwise tie up machine resources. Thus,
196 # running this is off by default.
197 # XXX Need to add dependency on libtestc++.a
198 check_performance_script=${glibcxx_srcdir}/scripts/check_performance
199 check-performance: testsuite_files_performance ${performance_script}
200 -@(chmod + ${check_performance_script}; \
201 ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
203 # Runs the testsuite in debug mode.
204 debug_flags = "unix/-D_GLIBCXX_DEBUG"
206 # Runs the testsuite in parallel mode.
207 libgomp_dir=${glibcxx_builddir}/../libgomp
208 libgomp_flags=-B${glibcxx_builddir}/../libgomp \
209 -I${glibcxx_builddir}/../libgomp \
210 -L${glibcxx_builddir}/../libgomp/.libs -lgomp
212 atomic_flags=$(ATOMIC_FLAGS)
213 parallel_flags="unix/-D_GLIBCXX_PARALLEL/-fopenmp"
215 # Runs the testsuite in profile mode.
216 profile_flags = "unix/-D_GLIBCXX_PROFILE"
218 check-debug: site.exp
219 outputdir=debug; export outputdir; \
220 if test ! -d $${outputdir}; then \
221 mkdir $${outputdir}; \
223 srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
224 EXPECT=$(EXPECT); export EXPECT; \
225 $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(debug_flags)" check-DEJAGNU;
227 check-parallel: site.exp
228 -@(if test ! -d $${libgomp_dir}; then \
229 echo "Testing parallel mode failed as libgomp not present."; \
232 outputdir=parallel; export outputdir; \
233 if test ! -d $${outputdir}; then \
234 mkdir $${outputdir}; \
236 srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
237 EXPECT=$(EXPECT); export EXPECT; \
238 $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; )
240 check-performance-parallel: testsuite_files_performance ${performance_script}
241 -@(chmod + ${check_performance_script}; \
242 CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \
243 ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
245 check-profile: site.exp
246 -@(outputdir=profile; export outputdir; \
247 if test ! -d $${outputdir}; then \
248 mkdir $${outputdir}; \
250 srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
251 EXPECT=$(EXPECT); export EXPECT; \
252 $(MAKE) CXXFLAGS="$(atomic_flags) " RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(profile_flags)" check-DEJAGNU; )
254 .PHONY: baseline_symbols new-abi-baseline \
255 check-abi check-compile check-performance check-parallel check-profile
257 # By adding these files here, automake will remove them for 'make clean'
258 CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
259 testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
260 *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb
262 # To remove directories.
264 rm -rf de fr debug parallel profile binaries normal*