OSDN Git Service

Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.
[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, 2009
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_file}; \
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_file}; \
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         if [ -z "$*$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
107             && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
108           $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNUnormal0 check-DEJAGNUnormal1 \
109                   check-DEJAGNUnormal2 check-DEJAGNUnormal3; \
110           for idx in 0 1 2 3; do \
111             mv -f normal$$idx/libstdc++.sum normal$$idx/libstdc++.sum.sep; \
112             mv -f normal$$idx/libstdc++.log normal$$idx/libstdc++.log.sep; \
113           done; \
114           mv -f libstdc++.sum libstdc++.sum.sep; \
115           mv -f libstdc++.log libstdc++.log.sep; \
116           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
117             libstdc++.sum.sep normal0/libstdc++.sum.sep \
118             normal1/libstdc++.sum.sep normal2/libstdc++.sum.sep \
119             normal3/libstdc++.sum.sep > libstdc++.sum; \
120           $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
121             libstdc++.log.sep normal0/libstdc++.log.sep \
122             normal1/libstdc++.log.sep normal2/libstdc++.log.sep \
123             normal3/libstdc++.log.sep > libstdc++.log; \
124           exit 0; \
125         fi; \
126         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
127         EXPECT=$(EXPECT); export EXPECT; \
128         runtest=$(RUNTEST); \
129         if [ -z "$$runtest" ]; then runtest=runtest; fi; \
130         tool=libstdc++; \
131         dirs=; \
132         case "$*" in \
133           normal0) \
134             if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
135               $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
136                         $(RUNTESTFLAGS) abi.exp; \
137             else echo "WARNING: could not find \`runtest'" 1>&2; :;\
138             fi; \
139             dirs="`cd $$srcdir; echo [013-9][0-9]_*/* [abep]*/*`";; \
140           normal1) \
141             dirs="`cd $$srcdir; echo 2[0-2]_*/*`";; \
142           normal2) \
143             dirs="`cd $$srcdir; echo 2[4-9]_*/*`";; \
144           normal3) \
145             dirs="`cd $$srcdir; echo 23_*/* t*/*`";; \
146         esac; \
147         if [ -n "$*" ]; then cd "$*"; fi; \
148         if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
149           if [ -n "$$dirs" ]; then \
150             $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
151                     $(RUNTESTFLAGS) \
152                     "conformance.exp=`echo $$dirs | sed 's/ /* /g;s/$$/*/'`"; \
153           else \
154             $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
155                     $(RUNTESTFLAGS); \
156           fi; \
157         else echo "WARNING: could not find \`runtest'" 1>&2; :;\
158         fi
159
160 check-am:
161         $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
162 .PHONY: check-DEJAGNU
163
164 # Use 'new-abi-baseline' to create an initial symbol file.  Then run
165 # 'check-abi' to test for changes against that file.
166 check-abi: site.exp baseline_symbols 
167         -@runtest $(AM_RUNTESTFLAGS) --tool libstdc++ $(RUNTESTFLAGS) abi.exp
168
169 # Runs the testsuite, but in compile only mode.
170 # Can be used to test sources with non-GNU FE's at various warning
171 # levels and for checking compile time across releases.
172 # See script.
173 compile_script=${glibcxx_srcdir}/scripts/check_compile
174 check-compile: testsuite_files ${compile_script}
175         -@(chmod + ${compile_script}; \
176           ${compile_script} ${glibcxx_srcdir} ${glibcxx_builddir})
177
178
179 # Runs the testsuite/performance tests.
180 # Some of these tests create large (~75MB) files, allocate huge
181 # ammounts of memory, or otherwise tie up machine resources. Thus,
182 # running this is off by default.
183 # XXX Need to add dependency on libtestc++.a
184 check_performance_script=${glibcxx_srcdir}/scripts/check_performance
185 check-performance: testsuite_files_performance ${performance_script}
186         -@(chmod + ${check_performance_script}; \
187           ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
188
189
190 # Runs the testsuite in parallel mode.
191 libgomp_dir=${glibcxx_builddir}/../libgomp
192 libgomp_flags=-B${glibcxx_builddir}/../libgomp \
193               -I${glibcxx_builddir}/../libgomp \
194               -L${glibcxx_builddir}/../libgomp/.libs -lgomp
195
196 atomic_flags=$(ATOMIC_FLAGS)
197 parallel_flags="unix/-D_GLIBCXX_PARALLEL/-fopenmp"
198
199 check-parallel: site.exp
200         -@(if test ! -d $${libgomp_dir}; then \
201           echo "Testing parallel mode failed as libgomp not present."; \
202           exit 1; \
203         fi; \
204         outputdir=parallel; export outputdir; \
205         if test ! -d $${outputdir}; then \
206           mkdir $${outputdir}; \
207         fi; \
208         srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
209         EXPECT=$(EXPECT); export EXPECT; \
210         $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; )
211
212 check-performance-parallel: testsuite_files_performance ${performance_script}
213         -@(chmod + ${check_performance_script}; \
214         CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \
215         ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
216
217 .PHONY: baseline_symbols new-abi-baseline \
218         check-abi check-compile check-performance check-parallel
219
220 # By adding these files here, automake will remove them for 'make clean'
221 CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
222              testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
223              *.s *.o *.cc *.a *.so *.xml 
224
225 # To remove directories.
226 clean-local:
227         rm -rf parallel