[gdb/testsuite] Set language in gdb.ada/minsym.exp
[deliverable/binutils-gdb.git] / gdb / testsuite / Makefile.in
1 # Makefile for regression testing the GNU debugger.
2 # Copyright 1992-2020 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 abs_srcdir = @abs_srcdir@
25
26 target_alias = @target_noncanonical@
27 program_transform_name = @program_transform_name@
28 build_canonical = @build@
29 host_canonical = @host@
30 target_canonical = @target@
31
32 SHELL = @SHELL@
33 EXEEXT = @EXEEXT@
34 SUBDIRS = @subdirs@
35 RPATH_ENVVAR = @RPATH_ENVVAR@
36
37 EXTRA_RULES = @EXTRA_RULES@
38
39 CC=@CC@
40
41 EXPECT = `if [ "$${READ1}" != "" ] ; then \
42 echo $${rootme}/expect-read1; \
43 elif [ -f $${rootme}/../../expect/expect ] ; then \
44 echo $${rootme}/../../expect/expect ; \
45 else \
46 echo expect ; \
47 fi`
48
49 RUNTEST = $(RUNTEST_FOR_TARGET)
50
51 RUNTESTFLAGS =
52
53 FORCE_PARALLEL =
54
55 GDB_DEBUG =
56 GDBSERVER_DEBUG =
57
58 # Default number of iterations that we will use to run the testsuite
59 # if the user does not specify the RACY_ITER environment variable
60 # (e.g., when the user calls the make rule directly from the command
61 # line).
62 DEFAULT_RACY_ITER = 3
63
64 RUNTEST_FOR_TARGET = `\
65 if [ -f $${srcdir}/../../dejagnu/runtest ]; then \
66 echo $${srcdir}/../../dejagnu/runtest; \
67 else \
68 if [ "$(host_canonical)" = "$(target_canonical)" ]; then \
69 echo runtest; \
70 else \
71 t='$(program_transform_name)'; echo runtest | sed -e $$t; \
72 fi; \
73 fi`
74
75 #### host, target, and site specific Makefile frags come in here.
76
77 # The use of $$(x_FOR_TARGET) reduces the command line length by not
78 # duplicating the lengthy definition.
79
80 TARGET_FLAGS_TO_PASS = \
81 "prefix=$(prefix)" \
82 "exec_prefix=$(exec_prefix)" \
83 "against=$(against)" \
84 'CC=$$(CC_FOR_TARGET)' \
85 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
86 "CFLAGS=$(TESTSUITE_CFLAGS)" \
87 'CXX=$$(CXX_FOR_TARGET)' \
88 "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
89 "CXXFLAGS=$(CXXFLAGS)" \
90 "MAKEINFO=$(MAKEINFO)" \
91 "INSTALL=$(INSTALL)" \
92 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
93 "INSTALL_DATA=$(INSTALL_DATA)" \
94 "LDFLAGS=$(LDFLAGS)" \
95 "LIBS=$(LIBS)" \
96 "RUNTEST=$(RUNTEST)" \
97 "RUNTESTFLAGS=$(RUNTESTFLAGS)"
98
99 all: $(EXTRA_RULES)
100 @echo "Nothing to be done for all..."
101
102 .NOEXPORT:
103 INFODIRS=doc
104 info:
105 install-info:
106 dvi:
107 pdf:
108 install-pdf:
109 html:
110 install-html:
111
112 install:
113
114 uninstall: force
115
116 # Use absolute `site.exp' path everywhere to suppress VPATH lookups for it.
117 # Bare `site.exp' is used as a target here if user requests it explicitly.
118 # $(RUNTEST) is looking up `site.exp' only in the current directory.
119
120 $(abs_builddir)/site.exp site.exp: ./config.status Makefile
121 @echo "Making a new config file..."
122 -@rm -f ./tmp?
123 @touch site.exp
124 -@mv site.exp site.bak
125 @echo "## these variables are automatically generated by make ##" > ./tmp0
126 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
127 @echo "# add them to the last section" >> ./tmp0
128 @echo "set host_triplet ${host_canonical}" >> ./tmp0
129 @echo "set target_alias $(target_alias)" >> ./tmp0
130 @echo "set target_triplet ${target_canonical}" >> ./tmp0
131 @echo "set build_triplet ${build_canonical}" >> ./tmp0
132 @echo "set srcdir ${abs_srcdir}" >> ./tmp0
133 @echo "set tool gdb" >> ./tmp0
134 @echo 'source $${srcdir}/lib/append_gdb_boards_dir.exp' >> ./tmp0
135 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
136 @cat ./tmp0 > site.exp
137 @cat site.bak | sed \
138 -e '1,/^## All variables above are.*##/ d' >> site.exp
139 -@rm -f ./tmp?
140
141 installcheck:
142
143 # See whether -j was given to make. Before GNU make 4.2, either it was
144 # given with no arguments, and appears as "j" in the first word, or it was
145 # given an argument and appears as "-j" in a separate word. Starting with
146 # GNU make 4.2, it always appears as "-j"/"-jN" in a separate word.
147 saw_dash_j = $(or $(findstring j,$(firstword $(MAKEFLAGS))),$(filter -j%,$(MAKEFLAGS)))
148
149 # Try to run the tests in parallel if any -j option is given. If RUNTESTFLAGS
150 # is not empty, then by default the tests will be serialized. This can be
151 # overridden by setting FORCE_PARALLEL to any non-empty value.
152 CHECK_TARGET_TMP = $(if $(FORCE_PARALLEL),check-parallel,$(if $(RUNTESTFLAGS),check-single,$(if $(saw_dash_j),check-parallel,check-single)))
153 CHECK_TARGET = $(if $(RACY_ITER),$(addsuffix -racy,$(CHECK_TARGET_TMP)),$(CHECK_TARGET_TMP))
154
155 # Note that we must resort to a recursive make invocation here,
156 # because GNU make 3.82 has a bug preventing MAKEFLAGS from being used
157 # in conditions.
158 check: all $(abs_builddir)/site.exp
159 $(MAKE) $(CHECK_TARGET)
160
161 check-read1:
162 $(MAKE) READ1="1" check
163
164 # Check whether we need to print the timestamp for each line of
165 # status.
166 TIMESTAMP = $(if $(TS),| $(srcdir)/print-ts.py $(if $(TS_FORMAT),$(TS_FORMAT),),)
167
168 gdb_debug = $(if $(GDB_DEBUG),GDB_DEBUG=$(GDB_DEBUG) ; export GDB_DEBUG ;,)
169 gdbserver_debug = $(if $(GDBSERVER_DEBUG),GDBSERVER_DEBUG=$(GDBSERVER_DEBUG) ; export GDBSERVER_DEBUG ;,)
170
171
172 # All the hair to invoke dejagnu. A given invocation can just append
173 # $(RUNTESTFLAGS)
174 DO_RUNTEST = \
175 rootme=`pwd`; export rootme; \
176 srcdir=${srcdir} ; export srcdir ; \
177 EXPECT=${EXPECT} ; export EXPECT ; \
178 EXEEXT=${EXEEXT} ; export EXEEXT ; $(gdb_debug) $(gdbserver_debug) \
179 $(RPATH_ENVVAR)=$$rootme/../../expect:$$rootme/../../libstdc++:$$rootme/../../tk/unix:$$rootme/../../tcl/unix:$$rootme/../../bfd:$$rootme/../../opcodes:$$$(RPATH_ENVVAR); \
180 export $(RPATH_ENVVAR); \
181 if [ -f $${rootme}/../../expect/expect ] ; then \
182 TCL_LIBRARY=$${srcdir}/../../tcl/library ; \
183 export TCL_LIBRARY ; fi ; \
184 $(RUNTEST) --status
185
186 # TESTS exists for the user to pass on the command line to easily
187 # say "Only run these tests." With check-single it's not necessary, but
188 # with check-parallel there's no other way to (easily) specify a subset
189 # of tests. For consistency we support it for check-single as well.
190 # To specify all tests in a subdirectory, use TESTS=gdb.subdir/*.exp.
191 # E.g., make check TESTS="gdb.server/*.exp gdb.threads/*.exp".
192 TESTS :=
193
194 ifeq ($(strip $(TESTS)),)
195 expanded_tests_or_none :=
196 else
197 expanded_tests := $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/,$(TESTS))))
198 expanded_tests_or_none := $(or $(expanded_tests),no-matching-tests-found)
199 endif
200
201 # Shorthand for running all the tests in a single directory.
202 check-gdb.%:
203 $(MAKE) check TESTS="gdb.$*/*.exp"
204
205 check-single:
206 $(DO_RUNTEST) $(RUNTESTFLAGS) $(expanded_tests_or_none) $(TIMESTAMP)
207
208 check-single-racy:
209 -rm -rf cache racy_outputs temp
210 mkdir -p racy_outputs; \
211 racyiter="$(RACY_ITER)"; \
212 test "x$$racyiter" == "x" && \
213 racyiter=$(DEFAULT_RACY_ITER); \
214 if test $$racyiter -lt 2 ; then \
215 echo "RACY_ITER must be at least 2."; \
216 exit 1; \
217 fi; \
218 trap "exit" INT; \
219 for n in `seq $$racyiter` ; do \
220 mkdir -p racy_outputs/$$n; \
221 $(DO_RUNTEST) --outdir=racy_outputs/$$n $(RUNTESTFLAGS) \
222 $(expanded_tests_or_none) $(TIMESTAMP); \
223 done; \
224 $(srcdir)/analyze-racy-logs.py \
225 `ls racy_outputs/*/gdb.sum` > racy.sum; \
226 sed -n '/=== gdb Summary ===/,$$ p' racy.sum
227
228 check-parallel:
229 -rm -rf cache outputs temp
230 $(MAKE) -k do-check-parallel; \
231 result=$$?; \
232 $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
233 `find outputs -name gdb.sum -print` > gdb.sum; \
234 $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
235 `find outputs -name gdb.log -print` > gdb.log; \
236 sed -n '/=== gdb Summary ===/,$$ p' gdb.sum; \
237 exit $$result
238
239 check-parallel-racy:
240 -rm -rf cache racy_outputs temp
241 racyiter="$(RACY_ITER)"; \
242 test "x$$racyiter" == "x" && \
243 racyiter=$(DEFAULT_RACY_ITER); \
244 if test $$racyiter -lt 2 ; then \
245 echo "RACY_ITER must be at least 2."; \
246 exit 1; \
247 fi; \
248 trap "exit" INT; \
249 for n in `seq $$racyiter` ; do \
250 $(MAKE) -k do-check-parallel-racy \
251 RACY_OUTPUT_N=$$n; \
252 $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
253 `find racy_outputs/$$n -name gdb.sum -print` > \
254 racy_outputs/$$n/gdb.sum; \
255 $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
256 `find racy_outputs/$$n -name gdb.log -print` > \
257 racy_outputs/$$n/gdb.log; \
258 sed -n '/=== gdb Summary ===/,$$ p' racy_outputs/$$n/gdb.sum; \
259 done; \
260 $(srcdir)/analyze-racy-logs.py \
261 `ls racy_outputs/*/gdb.sum` > racy.sum; \
262 sed -n '/=== gdb Summary ===/,$$ p' racy.sum
263
264 # Turn a list of .exp files into "check/" targets. Only examine .exp
265 # files appearing in a gdb.* directory -- we don't want to pick up
266 # lib/ by mistake. For example, gdb.linespec/linespec.exp becomes
267 # check/gdb.linespec/linespec.exp. The list is generally sorted
268 # alphabetically, but we take a few tests known to be slow and push
269 # them to the front of the list to try to lessen the overall time
270 # taken by the test suite -- if one of these tests happens to be run
271 # late, it will cause the overall time to increase.
272 ifeq ($(strip $(TESTS)),)
273 slow_tests = gdb.base/break-interp.exp gdb.base/interp.exp \
274 gdb.base/multi-forks.exp
275 all_tests := $(shell cd $(srcdir) && find gdb.* -name '*.exp' -print)
276 reordered_tests := $(slow_tests) $(filter-out $(slow_tests),$(all_tests))
277 TEST_TARGETS := $(addprefix $(if $(RACY_ITER),check-racy,check)/,$(reordered_tests))
278 else
279 TEST_TARGETS := $(addprefix $(if $(RACY_ITER),check-racy,check)/,$(expanded_tests_or_none))
280 endif
281
282 do-check-parallel: $(TEST_TARGETS)
283 @:
284
285 check/%.exp:
286 -mkdir -p outputs/$*
287 @$(DO_RUNTEST) GDB_PARALLEL=yes --outdir=outputs/$* $*.exp $(RUNTESTFLAGS) $(TIMESTAMP)
288
289 do-check-parallel-racy: $(TEST_TARGETS)
290 @:
291
292 check-racy/%.exp:
293 -mkdir -p racy_outputs/$(RACY_OUTPUT_N)/$*
294 $(DO_RUNTEST) GDB_PARALLEL=yes \
295 --outdir=racy_outputs/$(RACY_OUTPUT_N)/$* $*.exp \
296 $(RUNTESTFLAGS) $(TIMESTAMP)
297
298 check/no-matching-tests-found:
299 @echo ""
300 @echo "No matching tests found."
301 @echo ""
302
303 # Utility rule invoked by step 2 of the build-perf rule.
304 workers/%.worker:
305 mkdir -p gdb.perf/outputs/$*
306 $(DO_RUNTEST) --outdir=gdb.perf/outputs/$* lib/build-piece.exp WORKER=$* GDB_PARALLEL=gdb.perf $(RUNTESTFLAGS) GDB_PERFTEST_MODE=compile GDB_PERFTEST_SUBMODE=build-pieces $(TIMESTAMP)
307
308 # Utility rule to build tests that support it in parallel.
309 # The build is broken into 3 steps distinguished by GDB_PERFTEST_SUBMODE:
310 # gen-workers, build-pieces, final.
311 #
312 # GDB_PERFTEST_MODE appears *after* RUNTESTFLAGS here because we don't want
313 # anything in RUNTESTFLAGS to override it.
314 #
315 # We don't delete the outputs directory here as these programs can take
316 # awhile to build, and perftest.exp has support for deciding whether to
317 # recompile them. If you want to remove these directories, make clean.
318 #
319 # The point of step 1 is to construct the set of worker tasks for step 2.
320 # All of the information needed by build-piece.exp is contained in the name
321 # of the generated .worker file.
322 build-perf: $(abs_builddir)/site.exp
323 rm -rf gdb.perf/workers
324 mkdir -p gdb.perf/workers
325 @: Step 1: Generate the build .worker files.
326 $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf/workers GDB_PARALLEL=gdb.perf $(RUNTESTFLAGS) GDB_PERFTEST_MODE=compile GDB_PERFTEST_SUBMODE=gen-workers $(TIMESTAMP)
327 @: Step 2: Compile the pieces. Here is the build parallelism.
328 $(MAKE) $$(cd gdb.perf && echo workers/*/*.worker)
329 @: Step 3: Do the final link.
330 $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf GDB_PARALLEL=gdb.perf $(RUNTESTFLAGS) GDB_PERFTEST_MODE=compile GDB_PERFTEST_SUBMODE=final $(TIMESTAMP)
331
332 # The default is to both compile and run the tests.
333 GDB_PERFTEST_MODE = both
334
335 check-perf: all $(abs_builddir)/site.exp
336 @if test ! -d gdb.perf; then mkdir gdb.perf; fi
337 $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf GDB_PERFTEST_MODE=$(GDB_PERFTEST_MODE) $(RUNTESTFLAGS) $(TIMESTAMP)
338
339 force:;
340
341 clean mostlyclean:
342 -rm -f *~ core *.o a.out xgdb *.x *.grt bigcore.corefile .gdb_history
343 -rm -f core.* *.tf *.cl tracecommandsscript copy1.txt zzz-gdbscript
344 -rm -f *.dwo *.dwp
345 -rm -rf outputs temp cache
346 -rm -rf gdb.perf/workers gdb.perf/outputs gdb.perf/temp gdb.perf/cache
347 -rm -f read1.so expect-read1
348
349 distclean maintainer-clean realclean: clean
350 -rm -f *~ core
351 -rm -f Makefile config.status *-init.exp
352 -rm -fr *.log summary detail *.plog *.sum *.psum site.*
353
354 Makefile : Makefile.in config.status $(host_makefile_frag)
355 $(SHELL) config.status
356
357 config.status: configure
358 $(SHELL) config.status --recheck
359
360 TAGS: force
361 find $(srcdir) -name '*.exp' -print | \
362 etags \
363 --regex='/\(proc\|proc_with_prefix\|gdb_caching_proc\)[ \t]+\([^ \t]+\)/\2/' \
364 -
365
366 # Build the expect wrapper script that preloads the read1.so library.
367 expect-read1:
368 @echo Making expect-read1
369 @rm -f expect-read1-tmp
370 @touch expect-read1-tmp
371 @echo "# THIS FILE IS GENERATED -*- buffer-read-only: t -*- \n" >>expect-read1-tmp
372 @echo "# vi:set ro: */\n\n" >>expect-read1-tmp
373 @echo "# To regenerate this file, run:\n" >>expect-read1-tmp
374 @echo "# make clean; make/\n" >>expect-read1-tmp
375 @echo "export LD_PRELOAD=`pwd`/read1.so" >>expect-read1-tmp
376 @echo 'exec expect "$$@"' >>expect-read1-tmp
377 @chmod +x expect-read1-tmp
378 @mv expect-read1-tmp expect-read1
379
380 # Build the read1.so preload library. This overrides the `read'
381 # function, making it read one byte at a time. Running the testsuite
382 # with this catches racy tests.
383 read1.so: lib/read1.c
384 $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC $(CFLAGS)
385
386 # Build the read1 machinery.
387 .PHONY: read1
388 read1: read1.so expect-read1
389
390 # Disable implicit make rules.
391 include $(srcdir)/../disable-implicit-rules.mk
This page took 0.044455 seconds and 4 git commands to generate.