OSDN Git Service

contrib/
[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, 2005, 2007 Free Software Foundation, Inc.
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
11 ## Free Software Foundation; either version 2, or (at your option)
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
20 ## with this library; see the file COPYING.  If not, write to the Free
21 ## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 ## USA.
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_file "$(baseline_file)"' >> 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 baseline_file = ${baseline_dir}/baseline_symbols.txt
71 extract_symvers = $(glibcxx_srcdir)/scripts/extract_symvers
72
73 baseline_symbols:
74         -@(output=${baseline_file}; \
75           if test ! -f $${output}; then \
76             echo "Baseline file doesn't exist."; \
77             echo "Try 'make new-abi-baseline' to create it."; \
78             exit 1; \
79           fi; true)
80
81 new-abi-baseline:
82         -@$(mkinstalldirs) ${baseline_dir}
83         -@(output=${baseline_file}; \
84           if test -f $${output}; then \
85             output=$${output}.new; \
86             t=`echo $${output} | sed 's=.*config/abi/=='`; \
87             echo "Baseline file already exists, writing to $${t} instead."; \
88           fi; \
89           ${extract_symvers} ../src/.libs/libstdc++.so $${output})
90
91 %/site.exp: site.exp
92         -test -d $* || mkdir $*
93         @srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
94         objdir=`${PWD_COMMAND}`/$*; \
95         sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
96             -e "s|^set objdir .*$$|set objdir $$objdir|" \
97             site.exp > $*/site.exp.tmp
98         @-rm -f $*/site.bak
99         @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
100         @mv $*/site.exp.tmp $*/site.exp
101
102 check_DEJAGNU_normal_targets = $(patsubst %,check-DEJAGNUnormal%,0 1 2 3)
103 $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
104
105 # Run the testsuite in normal mode.
106 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
107         if [ -z "$*$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
108             && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
109           $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNUnormal0 check-DEJAGNUnormal1 \
110                   check-DEJAGNUnormal2 check-DEJAGNUnormal3; \
111           for idx in 0 1 2 3; do \
112             mv -f normal$$idx/libstdc++.sum normal$$idx/libstdc++.sum.sep; \
113             mv -f normal$$idx/libstdc++.log normal$$idx/libstdc++.log.sep; \
114           done; \
115           mv -f libstdc++.sum libstdc++.sum.sep; \
116           mv -f libstdc++.log libstdc++.log.sep; \
117           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
118             libstdc++.sum.sep normal0/libstdc++.sum.sep \
119             normal1/libstdc++.sum.sep normal2/libstdc++.sum.sep \
120             normal3/libstdc++.sum.sep > libstdc++.sum; \
121           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
122             libstdc++.log.sep normal0/libstdc++.log.sep \
123             normal1/libstdc++.log.sep normal2/libstdc++.log.sep \
124             normal3/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; \
138             else echo "WARNING: could not find \`runtest'" 1>&2; :;\
139             fi; \
140             dirs="`cd $$srcdir; echo [013-9][0-9]_*/* [abep]*/*`";; \
141           normal1) \
142             dirs="`cd $$srcdir; echo 2[0-2]_*/*`";; \
143           normal2) \
144             dirs="`cd $$srcdir; echo 2[4-9]_*/*`";; \
145           normal3) \
146             dirs="`cd $$srcdir; echo 23_*/* t*/*`";; \
147         esac; \
148         if [ -n "$*" ]; then cd "$*"; fi; \
149         if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
150           if [ -n "$$dirs" ]; then \
151             $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
152                     $(RUNTESTFLAGS) \
153                     "conformance.exp=`echo $$dirs | sed 's/ /* /g;s/$$/*/'`"; \
154           else \
155             $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
156                     $(RUNTESTFLAGS); \
157           fi; \
158         else echo "WARNING: could not find \`runtest'" 1>&2; :;\
159         fi
160
161 check-am:
162         $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
163 .PHONY: check-DEJAGNU
164
165 # Use 'new-abi-baseline' to create an initial symbol file.  Then run
166 # 'check-abi' to test for changes against that file.
167 check-abi: site.exp baseline_symbols 
168         -@runtest --tool libstdc++ abi.exp
169
170 # Runs the testsuite, but in compile only mode.
171 # Can be used to test sources with non-GNU FE's at various warning
172 # levels and for checking compile time across releases.
173 # See script.
174 compile_script=${glibcxx_srcdir}/scripts/check_compile
175 check-compile: testsuite_files ${compile_script}
176         -@(chmod + ${compile_script}; \
177           ${compile_script} ${glibcxx_srcdir} ${glibcxx_builddir})
178
179
180 # Runs the testsuite/performance tests.
181 # Some of these tests create large (~75MB) files, allocate huge
182 # ammounts of memory, or otherwise tie up machine resources. Thus,
183 # running this is off by default.
184 # XXX Need to add dependency on libtestc++.a
185 check_performance_script=${glibcxx_srcdir}/scripts/check_performance
186 check-performance: testsuite_files_performance ${performance_script}
187         -@(chmod + ${check_performance_script}; \
188           ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
189
190
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
200 check-parallel: site.exp
201         -@(if test ! -d $${libgomp_dir}; then \
202           echo "Testing parallel mode failed as libgomp not present."; \
203           exit 1; \
204         fi; \
205         outputdir=parallel; export outputdir; \
206         if test ! -d $${outputdir}; then \
207           mkdir $${outputdir}; \
208         fi; \
209         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
210         EXPECT=$(EXPECT); export EXPECT; \
211         $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; )
212
213 check-performance-parallel: testsuite_files_performance ${performance_script}
214         -@(chmod + ${check_performance_script}; \
215         CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \
216         ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
217
218 .PHONY: baseline_symbols new-abi-baseline \
219         check-abi check-compile check-performance check-parallel
220
221 # By adding these files here, automake will remove them for 'make clean'
222 CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
223              testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
224              *.s *.o *.cc *.a *.so *.xml 
225
226 # To remove directories.
227 clean-local:
228         rm -rf parallel