+check-parallel:
+ -rm -rf cache outputs temp
+ $(MAKE) -k do-check-parallel; \
+ result=$$?; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
+ `find outputs -name gdb.sum -print` > gdb.sum; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
+ `find outputs -name gdb.log -print` > gdb.log; \
+ sed -n '/=== gdb Summary ===/,$$ p' gdb.sum; \
+ exit $$result
+
+check-parallel-racy:
+ -rm -rf cache racy_outputs temp
+ racyiter="$(RACY_ITER)"; \
+ test "x$$racyiter" == "x" && \
+ racyiter=$(DEFAULT_RACY_ITER); \
+ if test $$racyiter -lt 2 ; then \
+ echo "RACY_ITER must be at least 2."; \
+ exit 1; \
+ fi; \
+ trap "exit" INT; \
+ for n in `seq $$racyiter` ; do \
+ $(MAKE) -k do-check-parallel-racy \
+ RACY_OUTPUT_N=$$n; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
+ `find racy_outputs/$$n -name gdb.sum -print` > \
+ racy_outputs/$$n/gdb.sum; \
+ $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
+ `find racy_outputs/$$n -name gdb.log -print` > \
+ racy_outputs/$$n/gdb.log; \
+ sed -n '/=== gdb Summary ===/,$$ p' racy_outputs/$$n/gdb.sum; \
+ done; \
+ $(srcdir)/analyze-racy-logs.py \
+ `ls racy_outputs/*/gdb.sum` > racy.sum; \
+ sed -n '/=== gdb Summary ===/,$$ p' racy.sum
+
+# Turn a list of .exp files into "check/" targets. Only examine .exp
+# files appearing in a gdb.* directory -- we don't want to pick up
+# lib/ by mistake. For example, gdb.linespec/linespec.exp becomes
+# check/gdb.linespec/linespec.exp. The list is generally sorted
+# alphabetically, but we take a few tests known to be slow and push
+# them to the front of the list to try to lessen the overall time
+# taken by the test suite -- if one of these tests happens to be run
+# late, it will cause the overall time to increase.
+ifeq ($(strip $(TESTS)),)
+slow_tests = gdb.base/break-interp.exp gdb.base/interp.exp \
+ gdb.base/multi-forks.exp
+all_tests := $(shell cd $(srcdir) && find gdb.* -name '*.exp' -print)
+reordered_tests := $(slow_tests) $(filter-out $(slow_tests),$(all_tests))
+TEST_TARGETS := $(addprefix $(if $(RACY_ITER),check-racy,check)/,$(reordered_tests))
+else
+TEST_TARGETS := $(addprefix $(if $(RACY_ITER),check-racy,check)/,$(expanded_tests_or_none))
+endif
+
+do-check-parallel: $(TEST_TARGETS)
+ @:
+
+check/%.exp:
+ -mkdir -p outputs/$*
+ @$(DO_RUNTEST) GDB_PARALLEL=yes --outdir=outputs/$* $*.exp $(RUNTESTFLAGS) $(TIMESTAMP)
+
+do-check-parallel-racy: $(TEST_TARGETS)
+ @:
+
+check-racy/%.exp:
+ -mkdir -p racy_outputs/$(RACY_OUTPUT_N)/$*
+ $(DO_RUNTEST) GDB_PARALLEL=yes \
+ --outdir=racy_outputs/$(RACY_OUTPUT_N)/$* $*.exp \
+ $(RUNTESTFLAGS) $(TIMESTAMP)
+
+check/no-matching-tests-found:
+ @echo ""
+ @echo "No matching tests found."
+ @echo ""
+
+# Utility rule invoked by step 2 of the build-perf rule.
+workers/%.worker:
+ mkdir -p gdb.perf/outputs/$*
+ $(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)
+
+# Utility rule to build tests that support it in parallel.
+# The build is broken into 3 steps distinguished by GDB_PERFTEST_SUBMODE:
+# gen-workers, build-pieces, final.
+#
+# GDB_PERFTEST_MODE appears *after* RUNTESTFLAGS here because we don't want
+# anything in RUNTESTFLAGS to override it.
+#
+# We don't delete the outputs directory here as these programs can take
+# awhile to build, and perftest.exp has support for deciding whether to
+# recompile them. If you want to remove these directories, make clean.
+#
+# The point of step 1 is to construct the set of worker tasks for step 2.
+# All of the information needed by build-piece.exp is contained in the name
+# of the generated .worker file.
+build-perf: $(abs_builddir)/site.exp
+ rm -rf gdb.perf/workers
+ mkdir -p gdb.perf/workers
+ @: Step 1: Generate the build .worker files.
+ $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf/workers GDB_PARALLEL=gdb.perf $(RUNTESTFLAGS) GDB_PERFTEST_MODE=compile GDB_PERFTEST_SUBMODE=gen-workers $(TIMESTAMP)
+ @: Step 2: Compile the pieces. Here is the build parallelism.
+ $(MAKE) $$(cd gdb.perf && echo workers/*/*.worker)
+ @: Step 3: Do the final link.
+ $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf GDB_PARALLEL=gdb.perf $(RUNTESTFLAGS) GDB_PERFTEST_MODE=compile GDB_PERFTEST_SUBMODE=final $(TIMESTAMP)
+
+# The default is to both compile and run the tests.
+GDB_PERFTEST_MODE = both
+
+check-perf: all $(abs_builddir)/site.exp
+ @if test ! -d gdb.perf; then mkdir gdb.perf; fi
+ $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf GDB_PERFTEST_MODE=$(GDB_PERFTEST_MODE) $(RUNTESTFLAGS) $(TIMESTAMP)
+
+force:;