OSDN Git Service

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