OSDN Git Service

* configure.ac (gcc_cv_ld_eh_gc_sections): Redirect objdump errors
[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 ## 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 '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
63         @test ! -f site.exp || \
64           sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
65         @-rm -f site.bak
66         @test ! -f site.exp || mv site.exp site.bak
67         @mv site.tmp site.exp
68
69
70 extract_symvers = $(glibcxx_srcdir)/scripts/extract_symvers
71
72 baseline_symbols:
73         -@(output=${baseline_dir}/baseline_symbols.txt; \
74           if test ! -f $${output}; then \
75             echo "Baseline file doesn't exist."; \
76             echo "Try 'make new-abi-baseline' to create it."; \
77             exit 1; \
78           fi; true)
79
80 new-abi-baseline:
81         -@$(mkinstalldirs) ${baseline_dir}
82         -@(output=${baseline_dir}/baseline_symbols.txt; \
83           if test -f $${output}; then \
84             output=$${output}.new; \
85             t=`echo $${output} | sed 's=.*config/abi/=='`; \
86             echo "Baseline file already exists, writing to $${t} instead."; \
87           fi; \
88           ${extract_symvers} ../src/.libs/libstdc++.so $${output})
89
90 %/site.exp: site.exp
91         -test -d $* || mkdir $*
92         @srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
93         objdir=`${PWD_COMMAND}`/$*; \
94         sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
95             -e "s|^set objdir .*$$|set objdir $$objdir|" \
96             site.exp > $*/site.exp.tmp
97         @-rm -f $*/site.bak
98         @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
99         @mv $*/site.exp.tmp $*/site.exp
100
101 check_DEJAGNU_normal_targets = $(patsubst %,check-DEJAGNUnormal%,0 1 2 3)
102 $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
103
104 # Run the testsuite in normal mode.
105 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
106         AR="$(AR)"; export AR; \
107         RANLIB="$(RANLIB)"; export RANLIB; \
108         if [ -z "$*$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
109             && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
110           $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNUnormal0 check-DEJAGNUnormal1 \
111                   check-DEJAGNUnormal2 check-DEJAGNUnormal3; \
112           for idx in 0 1 2 3; do \
113             mv -f normal$$idx/libstdc++.sum normal$$idx/libstdc++.sum.sep; \
114             mv -f normal$$idx/libstdc++.log normal$$idx/libstdc++.log.sep; \
115           done; \
116           mv -f libstdc++.sum libstdc++.sum.sep; \
117           mv -f libstdc++.log libstdc++.log.sep; \
118           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
119             libstdc++.sum.sep normal0/libstdc++.sum.sep \
120             normal1/libstdc++.sum.sep normal2/libstdc++.sum.sep \
121             normal3/libstdc++.sum.sep > libstdc++.sum; \
122           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
123             libstdc++.log.sep normal0/libstdc++.log.sep \
124             normal1/libstdc++.log.sep normal2/libstdc++.log.sep \
125             normal3/libstdc++.log.sep > libstdc++.log; \
126           exit 0; \
127         fi; \
128         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
129         EXPECT=$(EXPECT); export EXPECT; \
130         runtest=$(RUNTEST); \
131         if [ -z "$$runtest" ]; then runtest=runtest; fi; \
132         tool=libstdc++; \
133         dirs=; \
134         case "$*" in \
135           normal0) \
136             if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
137               $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
138                         $(RUNTESTFLAGS) abi.exp; \
139             else echo "WARNING: could not find \`runtest'" 1>&2; :;\
140             fi; \
141             dirs="`cd $$srcdir; echo [013-9][0-9]_*/* [ab]* de* [ep]*/*`";; \
142           normal1) \
143             dirs="`cd $$srcdir; echo 2[0-2]_*/*`";; \
144           normal2) \
145             dirs="`cd $$srcdir; echo 2[4-9]_*/*`";; \
146           normal3) \
147             dirs="`cd $$srcdir; echo 23_*/* t*/*`";; \
148         esac; \
149         if [ -n "$*" ]; then cd "$*"; fi; \
150         if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
151           if [ -n "$$dirs" ]; then \
152             $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
153                     $(RUNTESTFLAGS) \
154                     "conformance.exp=`echo $$dirs | sed 's/ /* /g;s/$$/*/'`"; \
155           else \
156             $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
157                     $(RUNTESTFLAGS); \
158           fi; \
159         else echo "WARNING: could not find \`runtest'" 1>&2; :;\
160         fi
161
162 check-am:
163         $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
164 .PHONY: check-DEJAGNU
165
166 # Use 'new-abi-baseline' to create an initial symbol file.  Then run
167 # 'check-abi' to test for changes against that file.
168 check-abi: site.exp baseline_symbols 
169         -@runtest $(AM_RUNTESTFLAGS) --tool libstdc++ $(RUNTESTFLAGS) abi.exp
170
171 # Runs the testsuite, but in compile only mode.
172 # Can be used to test sources with non-GNU FE's at various warning
173 # levels and for checking compile time across releases.
174 # See script.
175 compile_script=${glibcxx_srcdir}/scripts/check_compile
176 check-compile: testsuite_files ${compile_script}
177         -@(chmod + ${compile_script}; \
178           ${compile_script} ${glibcxx_srcdir} ${glibcxx_builddir})
179
180
181 # Runs the testsuite/performance tests.
182 # Some of these tests create large (~75MB) files, allocate huge
183 # ammounts of memory, or otherwise tie up machine resources. Thus,
184 # running this is off by default.
185 # XXX Need to add dependency on libtestc++.a
186 check_performance_script=${glibcxx_srcdir}/scripts/check_performance
187 check-performance: testsuite_files_performance ${performance_script}
188         -@(chmod + ${check_performance_script}; \
189           ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
190
191 # Runs the testsuite in debug mode.
192 debug_flags = "unix/-D_GLIBCXX_DEBUG"
193
194 # Runs the testsuite in parallel mode.
195 libgomp_dir=${glibcxx_builddir}/../libgomp
196 libgomp_flags=-B${glibcxx_builddir}/../libgomp \
197               -I${glibcxx_builddir}/../libgomp \
198               -L${glibcxx_builddir}/../libgomp/.libs -lgomp
199
200 atomic_flags=$(ATOMIC_FLAGS)
201 parallel_flags="unix/-D_GLIBCXX_PARALLEL/-fopenmp"
202
203 # Runs the testsuite in profile mode.
204 profile_flags = "unix/-D_GLIBCXX_PROFILE"
205
206 check-debug: site.exp
207         outputdir=debug; export outputdir; \
208         if test ! -d $${outputdir}; then \
209           mkdir $${outputdir}; \
210         fi; \
211         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
212         EXPECT=$(EXPECT); export EXPECT; \
213         $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(debug_flags)" check-DEJAGNU;
214
215 check-parallel: site.exp
216         -@(if test ! -d $${libgomp_dir}; then \
217           echo "Testing parallel mode failed as libgomp not present."; \
218           exit 1; \
219         fi; \
220         outputdir=parallel; export outputdir; \
221         if test ! -d $${outputdir}; then \
222           mkdir $${outputdir}; \
223         fi; \
224         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
225         EXPECT=$(EXPECT); export EXPECT; \
226         $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; )
227
228 check-performance-parallel: testsuite_files_performance ${performance_script}
229         -@(chmod + ${check_performance_script}; \
230         CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \
231         ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
232
233 check-profile: site.exp
234         -@(outputdir=profile; export outputdir; \
235         if test ! -d $${outputdir}; then \
236           mkdir $${outputdir}; \
237         fi; \
238         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
239         EXPECT=$(EXPECT); export EXPECT; \
240         $(MAKE) CXXFLAGS="$(atomic_flags) " RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(profile_flags)" check-DEJAGNU; )
241
242 .PHONY: baseline_symbols new-abi-baseline \
243         check-abi check-compile check-performance check-parallel check-profile
244
245 # By adding these files here, automake will remove them for 'make clean'
246 CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
247              testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
248              *.s *.o *.cc *.a *.so *.xml 
249
250 # To remove directories.
251 clean-local:
252         rm -rf debug parallel profile