New TESTS variable to run a subset of tests in parallel.
[deliverable/binutils-gdb.git] / gdb / testsuite / Makefile.in
1 # Makefile for regression testing the GNU debugger.
2 # Copyright 1992-2014 Free Software Foundation, Inc.
3
4 # This file is part of GDB.
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 VPATH = @srcdir@
20 srcdir = @srcdir@
21 prefix = @prefix@
22 exec_prefix = @exec_prefix@
23 abs_builddir = @abs_builddir@
24
25 target_alias = @target_noncanonical@
26 program_transform_name = @program_transform_name@
27 build_canonical = @build@
28 host_canonical = @host@
29 target_canonical = @target@
30
31 SHELL = @SHELL@
32 EXEEXT = @EXEEXT@
33 SUBDIRS = @subdirs@
34 RPATH_ENVVAR = @RPATH_ENVVAR@
35 ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.btrace gdb.cell gdb.cp \
36 gdb.disasm gdb.dlang gdb.dwarf2 gdb.fortran gdb.gdb gdb.go gdb.hp \
37 gdb.java gdb.linespec gdb.mi gdb.modula2 gdb.multi \
38 gdb.objc gdb.opencl gdb.opt gdb.pascal gdb.python gdb.server \
39 gdb.stabs gdb.reverse gdb.threads gdb.trace gdb.xml \
40 $(SUBDIRS)
41
42 EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \
43 echo $${rootme}/../../expect/expect ; \
44 else echo expect ; fi`
45
46 RUNTEST = $(RUNTEST_FOR_TARGET)
47
48 RUNTESTFLAGS =
49
50 FORCE_PARALLEL =
51
52 RUNTEST_FOR_TARGET = `\
53 if [ -f $${srcdir}/../../dejagnu/runtest ]; then \
54 echo $${srcdir}/../../dejagnu/runtest; \
55 else \
56 if [ "$(host_canonical)" = "$(target_canonical)" ]; then \
57 echo runtest; \
58 else \
59 t='$(program_transform_name)'; echo runtest | sed -e $$t; \
60 fi; \
61 fi`
62
63 #### host, target, and site specific Makefile frags come in here.
64
65 # The use of $$(x_FOR_TARGET) reduces the command line length by not
66 # duplicating the lengthy definition.
67
68 TARGET_FLAGS_TO_PASS = \
69 "prefix=$(prefix)" \
70 "exec_prefix=$(exec_prefix)" \
71 "against=$(against)" \
72 'CC=$$(CC_FOR_TARGET)' \
73 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
74 "CFLAGS=$(TESTSUITE_CFLAGS)" \
75 'CXX=$$(CXX_FOR_TARGET)' \
76 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
77 "CXXFLAGS=$(CXXFLAGS)" \
78 "MAKEINFO=$(MAKEINFO)" \
79 "INSTALL=$(INSTALL)" \
80 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
81 "INSTALL_DATA=$(INSTALL_DATA)" \
82 "LDFLAGS=$(LDFLAGS)" \
83 "LIBS=$(LIBS)" \
84 "RUNTEST=$(RUNTEST)" \
85 "RUNTESTFLAGS=$(RUNTESTFLAGS)"
86
87 all:
88 @echo "Nothing to be done for all..."
89
90 .NOEXPORT:
91 INFODIRS=doc
92 info:
93 install-info:
94 dvi:
95 pdf:
96 install-pdf:
97 html:
98 install-html:
99
100 install:
101
102 uninstall: force
103
104 # Use absolute `site.exp' path everywhere to suppress VPATH lookups for it.
105 # Bare `site.exp' is used as a target here if user requests it explicitly.
106 # $(RUNTEST) is looking up `site.exp' only in the current directory.
107
108 $(abs_builddir)/site.exp site.exp: ./config.status Makefile
109 @echo "Making a new config file..."
110 -@rm -f ./tmp?
111 @touch site.exp
112 -@mv site.exp site.bak
113 @echo "## these variables are automatically generated by make ##" > ./tmp0
114 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
115 @echo "# add them to the last section" >> ./tmp0
116 @echo "set host_triplet ${host_canonical}" >> ./tmp0
117 @echo "set target_alias $(target_alias)" >> ./tmp0
118 @echo "set target_triplet ${target_canonical}" >> ./tmp0
119 @echo "set build_triplet ${build_canonical}" >> ./tmp0
120 @echo "set srcdir ${srcdir}" >> ./tmp0
121 @echo "set tool gdb" >> ./tmp0
122 @echo 'source $${srcdir}/lib/append_gdb_boards_dir.exp' >> ./tmp0
123 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
124 @cat ./tmp0 > site.exp
125 @cat site.bak | sed \
126 -e '1,/^## All variables above are.*##/ d' >> site.exp
127 -@rm -f ./tmp?
128
129 installcheck:
130
131 # See whether -j was given to make. Either it was given with no
132 # arguments, and appears as "j" in the first word, or it was given an
133 # argument and appears as "-j" in a separate word.
134 @GMAKE_TRUE@saw_dash_j = $(or $(findstring j,$(firstword $(MAKEFLAGS))),$(filter -j,$(MAKEFLAGS)))
135
136 # For GNU make, try to run the tests in parallel if any -j option is
137 # given. If RUNTESTFLAGS is not empty, then by default the tests will
138 # be serialized. This can be overridden by setting FORCE_PARALLEL to
139 # any non-empty value. For a non-GNU make, do not parallelize.
140 @GMAKE_TRUE@CHECK_TARGET = $(if $(FORCE_PARALLEL),check-parallel,$(if $(RUNTESTFLAGS),check-single,$(if $(saw_dash_j),check-parallel,check-single)))
141 @GMAKE_FALSE@CHECK_TARGET = check-single
142
143 # Note that we must resort to a recursive make invocation here,
144 # because GNU make 3.82 has a bug preventing MAKEFLAGS from being used
145 # in conditions.
146 check: all $(abs_builddir)/site.exp
147 $(MAKE) $(CHECK_TARGET)
148
149 # All the hair to invoke dejagnu. A given invocation can just append
150 # $(RUNTESTFLAGS)
151 DO_RUNTEST = \
152 rootme=`pwd`; export rootme; \
153 srcdir=${srcdir} ; export srcdir ; \
154 EXPECT=${EXPECT} ; export EXPECT ; \
155 EXEEXT=${EXEEXT} ; export EXEEXT ; \
156 $(RPATH_ENVVAR)=$$rootme/../../expect:$$rootme/../../libstdc++:$$rootme/../../tk/unix:$$rootme/../../tcl/unix:$$rootme/../../bfd:$$rootme/../../opcodes:$$$(RPATH_ENVVAR); \
157 export $(RPATH_ENVVAR); \
158 if [ -f $${rootme}/../../expect/expect ] ; then \
159 TCL_LIBRARY=$${srcdir}/../../tcl/library ; \
160 export TCL_LIBRARY ; fi ; \
161 $(RUNTEST)
162
163 # TESTS exists for the user to pass on the command line to easily
164 # say "Only run these tests." With check-single it's not necessary, but
165 # with check-parallel there's no other way to (easily) specify a subset
166 # of tests. For consistency we support it for check-single as well.
167 # To specify all tests in a subdirectory, use TESTS=gdb.subdir/*.exp.
168 # E.g., make check TESTS="gdb.server/*.exp gdb.threads/*.exp".
169 @GMAKE_TRUE@TESTS :=
170 @GMAKE_FALSE@TESTS =
171
172 @GMAKE_TRUE@ifeq ($(strip $(TESTS)),)
173 @GMAKE_TRUE@expanded_tests_or_none :=
174 @GMAKE_TRUE@else
175 @GMAKE_TRUE@expanded_tests := $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/,$(TESTS))))
176 @GMAKE_TRUE@expanded_tests_or_none := $(or $(expanded_tests),no-matching-tests-found)
177 @GMAKE_TRUE@endif
178 @GMAKE_FALSE@expanded_tests_or_none = $(TESTS)
179
180 check-single:
181 $(DO_RUNTEST) $(RUNTESTFLAGS) $(expanded_tests_or_none)
182
183 check-parallel:
184 -rm -rf cache outputs temp
185 $(MAKE) -k do-check-parallel; \
186 $(SHELL) $(srcdir)/dg-extract-results.sh \
187 `find outputs -name gdb.sum -print` > gdb.sum; \
188 $(SHELL) $(srcdir)/dg-extract-results.sh -L \
189 `find outputs -name gdb.log -print` > gdb.log
190 @sed -n '/=== gdb Summary ===/,$$ p' gdb.sum
191
192 # Turn a list of .exp files into "check/" targets. Only examine .exp
193 # files appearing in a gdb.* directory -- we don't want to pick up
194 # lib/ by mistake. For example, gdb.linespec/linespec.exp becomes
195 # check/gdb.linespec/linespec.exp. The list is generally sorted
196 # alphabetically, but we take a few tests known to be slow and push
197 # them to the front of the list to try to lessen the overall time
198 # taken by the test suite -- if one of these tests happens to be run
199 # late, it will cause the overall time to increase.
200 @GMAKE_TRUE@ifeq ($(strip $(TESTS)),)
201 slow_tests = gdb.base/break-interp.exp gdb.base/interp.exp \
202 gdb.base/multi-forks.exp
203 @GMAKE_TRUE@all_tests := $(shell cd $(srcdir) && find gdb.* -name '*.exp' -print)
204 @GMAKE_TRUE@reordered_tests := $(slow_tests) $(filter-out $(slow_tests),$(all_tests))
205 @GMAKE_TRUE@TEST_TARGETS := $(addprefix check/,$(reordered_tests))
206 @GMAKE_TRUE@else
207 @GMAKE_TRUE@TEST_TARGETS := $(addprefix check/,$(expanded_tests_or_none))
208 @GMAKE_TRUE@endif
209
210 do-check-parallel: $(TEST_TARGETS)
211 @:
212
213 @GMAKE_TRUE@check/%.exp:
214 @GMAKE_TRUE@ -mkdir -p outputs/$*
215 @GMAKE_TRUE@ @$(DO_RUNTEST) GDB_PARALLEL=yes --outdir=outputs/$* $*.exp $(RUNTESTFLAGS)
216
217 check/no-matching-tests-found:
218 @echo ""
219 @echo "No matching tests found."
220 @echo ""
221
222 check-perf: all $(abs_builddir)/site.exp
223 @if test ! -d gdb.perf; then mkdir gdb.perf; fi
224 $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf GDB_PERFTEST_MODE=both $(RUNTESTFLAGS)
225
226 force:;
227
228 clean mostlyclean:
229 -rm -f *~ core *.o a.out xgdb *.x *.grt bigcore.corefile .gdb_history
230 -rm -f core.* *.tf *.cl *.py tracecommandsscript copy1.txt zzz-gdbscript
231 -rm -f *.dwo *.dwp
232 -rm -rf outputs temp cache
233 if [ x"${ALL_SUBDIRS}" != x ] ; then \
234 for dir in ${ALL_SUBDIRS}; \
235 do \
236 echo "$$dir:"; \
237 if [ -d $$dir ]; then \
238 (cd $$dir; $(MAKE) clean); \
239 fi; \
240 done ; \
241 else true; fi
242
243 distclean maintainer-clean realclean: clean
244 -rm -f *~ core
245 -rm -f Makefile config.status *-init.exp
246 -rm -fr *.log summary detail *.plog *.sum *.psum site.*
247 if [ x"${ALL_SUBDIRS}" != x ] ; then \
248 for dir in ${ALL_SUBDIRS}; \
249 do \
250 echo "$$dir:"; \
251 if [ -d $$dir ]; then \
252 (cd $$dir; $(MAKE) distclean); \
253 fi; \
254 done ; \
255 else true; fi
256
257 Makefile : Makefile.in config.status $(host_makefile_frag)
258 $(SHELL) config.status
259
260 config.status: configure
261 $(SHELL) config.status --recheck
262
263 TAGS: force
264 find $(srcdir) -name '*.exp' -print | \
265 etags --regex='/proc[ \t]+\([^ \t]+\)/\1/' -
This page took 0.051656 seconds and 5 git commands to generate.