OSDN Git Service

PR libstdc++/56002
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / Makefile.am
1 ## Makefile for the testsuite subdirectory of the GNU C++ Standard library.
2 ##
3 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
4 ## 2011, 2012 Free Software Foundation, Inc.
5 ##
6 ## This file is part of the libstdc++ version 3 distribution.
7 ## Process this file with automake to produce Makefile.in.
8
9 ## This file is part of the GNU ISO C++ Library.  This library is free
10 ## software; you can redistribute it and/or modify it under the
11 ## terms of the GNU General Public License as published by the
12 ## Free Software Foundation; either version 3, or (at your option)
13 ## any later version.
14
15 ## This library is distributed in the hope that it will be useful,
16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ## GNU General Public License for more details.
19
20 ## You should have received a copy of the GNU General Public License along
21 ## with this library; see the file COPYING3.  If not see
22 ## <http://www.gnu.org/licenses/>.
23
24 AUTOMAKE_OPTIONS = nostdinc
25 RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
26 EXPECT = expect
27
28 include $(top_srcdir)/fragment.am
29
30 # Generated lists of files to run.  All of these names are valid make
31 # targets, if you wish to generate a list manually.
32 lists_of_files = \
33    testsuite_files \
34    testsuite_files_interactive \
35    testsuite_files_performance
36
37 # This rule generates all of the testsuite_files* lists at once.
38 ${lists_of_files}:
39         ${glibcxx_srcdir}/scripts/create_testsuite_files \
40           ${glibcxx_srcdir}/testsuite `${PWD_COMMAND}`
41
42 # We need more things in site.exp, but automake completely controls the
43 # creation of that file; there's no way to append to it without messing up
44 # the dependancy chains.  So we overrule automake.  This rule is exactly
45 # what it would have generated, plus our own additions.
46 site.exp: Makefile
47         @echo 'Making a new site.exp file...'
48         @echo '## these variables are automatically generated by make ##' >site.tmp
49         @echo '# Do not edit here.  If you wish to override these values' >>site.tmp
50         @echo '# edit the last section' >>site.tmp
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
59         @echo 'set target_triplet $(target_triplet)' >>site.tmp
60         @echo 'set libiconv "$(LIBICONV)"' >>site.tmp
61         @echo 'set baseline_dir "$(baseline_dir)"' >> site.tmp
62         @echo 'set baseline_subdir_switch "$(baseline_subdir_switch)"' >> site.tmp
63         @echo 'set TEST_GCC_EXEC_PREFIX "$(libdir)/gcc/"' >> site.tmp
64         @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
65         @test ! -f site.exp || \
66           sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
67         @-rm -f site.bak
68         @test ! -f site.exp || mv site.exp site.bak
69         @mv site.tmp site.exp
70
71
72 extract_symvers = $(glibcxx_builddir)/scripts/extract_symvers
73
74 baseline_subdir := $(shell $(CXX) $(baseline_subdir_switch))
75
76 baseline_symbols:
77         -@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \
78           if test ! -f $${output}; then \
79             echo "Baseline file doesn't exist."; \
80             echo "Try 'make new-abi-baseline' to create it."; \
81             exit 1; \
82           fi; true)
83
84 new-abi-baseline:
85         -@$(mkinstalldirs) ${baseline_dir}/${baseline_subdir}
86         -@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \
87           if test -f $${output}; then \
88             output=$${output}.new; \
89             t=`echo $${output} | sed 's=.*config/abi/=='`; \
90             echo "Baseline file already exists, writing to $${t} instead."; \
91           fi; \
92           ${extract_symvers} ../src/.libs/libstdc++.so $${output})
93
94 %/site.exp: site.exp
95         -test -d $* || mkdir $*
96         @srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
97         objdir=`${PWD_COMMAND}`/$*; \
98         sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
99             -e "s|^set objdir .*$$|set objdir $$objdir|" \
100             site.exp > $*/site.exp.tmp
101         @-rm -f $*/site.bak
102         @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
103         @mv $*/site.exp.tmp $*/site.exp
104
105 check_DEJAGNU_normal_targets = $(patsubst %,check-DEJAGNUnormal%,0 1 2 3 4 5 6 7 8 9)
106 $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
107
108 # Run the testsuite in normal mode.
109 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
110         AR="$(AR)"; export AR; \
111         RANLIB="$(RANLIB)"; export RANLIB; \
112         if [ -z "$*$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
113             && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
114           $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_normal_targets); \
115           for idx in 0 1 2 3 4 5 6 7 8 9; do \
116             mv -f normal$$idx/libstdc++.sum normal$$idx/libstdc++.sum.sep; \
117             mv -f normal$$idx/libstdc++.log normal$$idx/libstdc++.log.sep; \
118           done; \
119           mv -f libstdc++.sum libstdc++.sum.sep; \
120           mv -f libstdc++.log libstdc++.log.sep; \
121           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
122             libstdc++.sum.sep normal[0-9]/libstdc++.sum.sep > libstdc++.sum; \
123           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
124             libstdc++.log.sep normal[0-9]/libstdc++.log.sep > libstdc++.log; \
125           exit 0; \
126         fi; \
127         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
128         EXPECT=$(EXPECT); export EXPECT; \
129         runtest=$(RUNTEST); \
130         if [ -z "$$runtest" ]; then runtest=runtest; fi; \
131         tool=libstdc++; \
132         dirs=; \
133         case "$*" in \
134           normal0) \
135             if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
136               $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
137                         $(RUNTESTFLAGS) abi.exp prettyprinters.exp; \
138             else echo "WARNING: could not find \`runtest'" 1>&2; :;\
139             fi; \
140             dirs="`cd $$srcdir; echo [013-9][0-9]_*/*`";; \
141           normal1) \
142             dirs="`cd $$srcdir; echo [ab]* de* [ep]*/*`";; \
143           normal2) \
144             dirs="`cd $$srcdir; echo 2[01]_*/*`";; \
145           normal3) \
146             dirs="`cd $$srcdir; echo 22_*/*`";; \
147           normal4) \
148             dirs="`cd $$srcdir; echo 23_*/[a-km-tw-z]*`";; \
149           normal5) \
150             dirs="`cd $$srcdir; echo 23_*/[luv]*`";; \
151           normal6) \
152             dirs="`cd $$srcdir; echo 2[459]_*/*`";; \
153           normal7) \
154             dirs="`cd $$srcdir; echo 2[68]_*/*`";; \
155           normal8) \
156             dirs="`cd $$srcdir; echo 27_*/*`";; \
157           normal9) \
158             dirs="`cd $$srcdir; echo t*/*`";; \
159         esac; \
160         if [ -n "$*" ]; then cd "$*"; fi; \
161         if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
162           if [ -n "$$dirs" ]; then \
163             $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
164                     $(RUNTESTFLAGS) \
165                     "conformance.exp=`echo $$dirs | sed 's/ /* /g;s/$$/*/'`"; \
166           else \
167             $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
168                     $(RUNTESTFLAGS); \
169           fi; \
170         else echo "WARNING: could not find \`runtest'" 1>&2; :;\
171         fi
172
173 check-am:
174         $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
175 .PHONY: check-DEJAGNU
176
177 # Use 'new-abi-baseline' to create an initial symbol file.  Then run
178 # 'check-abi' to test for changes against that file.
179 check-abi: site.exp baseline_symbols 
180         -@runtest $(AM_RUNTESTFLAGS) --tool libstdc++ $(RUNTESTFLAGS) abi.exp
181
182 # Runs the testsuite, but in compile only mode.
183 # Can be used to test sources with non-GNU FE's at various warning
184 # levels and for checking compile time across releases.
185 # See script.
186 compile_script=${glibcxx_srcdir}/scripts/check_compile
187 check-compile: testsuite_files ${compile_script}
188         -@(chmod + ${compile_script}; \
189           ${compile_script} ${glibcxx_srcdir} ${glibcxx_builddir})
190
191
192 # Runs the testsuite/performance tests.
193 # Some of these tests create large (~75MB) files, allocate huge
194 # ammounts of memory, or otherwise tie up machine resources. Thus,
195 # running this is off by default.
196 # XXX Need to add dependency on libtestc++.a
197 check_performance_script=${glibcxx_srcdir}/scripts/check_performance
198 check-performance: testsuite_files_performance ${performance_script}
199         -@(chmod + ${check_performance_script}; \
200           ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
201
202 # Runs the testsuite in debug mode.
203 debug_flags = "unix/-D_GLIBCXX_DEBUG"
204
205 # Runs the testsuite in parallel mode.
206 libgomp_dir=${glibcxx_builddir}/../libgomp
207 libgomp_flags=-B${glibcxx_builddir}/../libgomp \
208               -I${glibcxx_builddir}/../libgomp \
209               -L${glibcxx_builddir}/../libgomp/.libs -lgomp
210
211 atomic_flags=$(ATOMIC_FLAGS)
212 parallel_flags="unix/-D_GLIBCXX_PARALLEL/-fopenmp"
213
214 # Runs the testsuite in profile mode.
215 profile_flags = "unix/-D_GLIBCXX_PROFILE"
216
217 check-debug: site.exp
218         outputdir=debug; export outputdir; \
219         if test ! -d $${outputdir}; then \
220           mkdir $${outputdir}; \
221         fi; \
222         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
223         EXPECT=$(EXPECT); export EXPECT; \
224         $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(debug_flags)" check-DEJAGNU;
225
226 check-parallel: site.exp
227         -@(if test ! -d $${libgomp_dir}; then \
228           echo "Testing parallel mode failed as libgomp not present."; \
229           exit 1; \
230         fi; \
231         outputdir=parallel; export outputdir; \
232         if test ! -d $${outputdir}; then \
233           mkdir $${outputdir}; \
234         fi; \
235         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
236         EXPECT=$(EXPECT); export EXPECT; \
237         $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; )
238
239 check-performance-parallel: testsuite_files_performance ${performance_script}
240         -@(chmod + ${check_performance_script}; \
241         CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \
242         ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
243
244 check-profile: site.exp
245         -@(outputdir=profile; export outputdir; \
246         if test ! -d $${outputdir}; then \
247           mkdir $${outputdir}; \
248         fi; \
249         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
250         EXPECT=$(EXPECT); export EXPECT; \
251         $(MAKE) CXXFLAGS="$(atomic_flags) " RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(profile_flags)" check-DEJAGNU; )
252
253 .PHONY: baseline_symbols new-abi-baseline \
254         check-abi check-compile check-performance check-parallel check-profile
255
256 # By adding these files here, automake will remove them for 'make clean'
257 CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
258              testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
259              *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb
260
261 # To remove directories.
262 clean-local:
263         rm -rf de fr debug parallel profile binaries normal*