summaryrefslogtreecommitdiff
path: root/gdb/testsuite/Makefile.in
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-06-29 16:41:42 +0000
committerTom Tromey <tromey@redhat.com>2009-06-29 16:41:42 +0000
commit470cc31de5bc9fefc1da1c414b0f1fb046d5f437 (patch)
treea11ca5320f089493b9e2968966e203699e4b02ac /gdb/testsuite/Makefile.in
parent18f3a435e465a337435fc166cf6fdfb3809d669b (diff)
downloadgdb-470cc31de5bc9fefc1da1c414b0f1fb046d5f437.tar.gz
gdb
* README: Mention parallel check. gdb/testsuite * dg-extract-results.sh: New file. * Makefile.in (FORCE_PARALLEL): New variable. (CHECK_TARGET): New conditional variable. (check): Use CHECK_TARGET. (DO_RUNTEST): New variable. (check-single): New target. (TEST_DIRS): New variable. (TEST_TARGETS): Likewise. (check-parallel): New target. (check-gdb.%): New pattern. (BASE1_FILES): New variable. (BASE2_FILES): Likewise. (check-gdb.base%): New pattern. (%/.dir): New pattern. * configure: Rebuild. * aclocal.m4 (AM_CONDITIONAL): New defun. * configure.ac: Check whether user is using GNU make. (GMAKE): New conditional.
Diffstat (limited to 'gdb/testsuite/Makefile.in')
-rw-r--r--gdb/testsuite/Makefile.in56
1 files changed, 54 insertions, 2 deletions
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 92f1a67191a..5344418664c 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -48,6 +48,8 @@ RUNTEST = $(RUNTEST_FOR_TARGET)
RUNTESTFLAGS =
+FORCE_PARALLEL =
+
RUNTEST_FOR_TARGET = `\
if [ -f $${srcdir}/../../dejagnu/runtest ]; then \
echo $${srcdir}/../../dejagnu/runtest; \
@@ -122,7 +124,18 @@ site.exp: ./config.status Makefile
installcheck:
-check: all site.exp
+# For GNU make, try to run the tests in parallel. If RUNTESTFLAGS is
+# not empty, then by default the tests will be serialized. This can
+# be overridden by setting FORCE_PARALLEL to any non-empty value.
+# For a non-GNU make, do not parallelize.
+@GMAKE_TRUE@CHECK_TARGET = $(if $(FORCE_PARALLEL),check-parallel,$(if $(RUNTESTFLAGS),check-single,check-parallel))
+@GMAKE_FALSE@CHECK_TARGET = check-single
+
+check: $(CHECK_TARGET)
+
+# All the hair to invoke dejagnu. A given invocation can just append
+# $(RUNTESTFLAGS)
+DO_RUNTEST = \
rootme=`pwd`; export rootme; \
srcdir=${srcdir} ; export srcdir ; \
EXPECT=${EXPECT} ; export EXPECT ; \
@@ -132,7 +145,46 @@ check: all site.exp
if [ -f $${rootme}/../../expect/expect ] ; then \
TCL_LIBRARY=$${srcdir}/../../tcl/library ; \
export TCL_LIBRARY ; fi ; \
- $(RUNTEST) $(RUNTESTFLAGS)
+ $(RUNTEST)
+
+check-single: all site.exp
+ $(DO_RUNTEST) $(RUNTESTFLAGS)
+
+# A list of all directories named "gdb.*" which also hold a .exp file.
+# We filter out gdb.base and add fake entries, because that directory
+# takes the longest to process, and so we split it in half.
+TEST_DIRS = gdb.base1 gdb.base2 $(filter-out gdb.base,$(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(srcdir)/gdb.*/*.exp))))))
+
+TEST_TARGETS = $(addprefix check-,$(TEST_DIRS))
+
+# We explicitly re-invoke make here for two reasons. First, it lets
+# us add a -k option, which makes the parallel check mimic the
+# behavior of the serial check; and second, it means that we can still
+# regenerate the sum and log files even if a sub-make fails -- which
+# it usually does because dejagnu exits with an error if any test
+# fails.
+check-parallel:
+ $(MAKE) -k $(TEST_TARGETS); \
+ $(SHELL) $(srcdir)/dg-extract-results.sh \
+ $(addsuffix /gdb.sum,$(TEST_DIRS)) > gdb.sum; \
+ $(SHELL) $(srcdir)/dg-extract-results.sh -L \
+ $(addsuffix /gdb.log,$(TEST_DIRS)) > gdb.log
+
+$(filter-out check-gdb.base%,$(TEST_TARGETS)): check-gdb.%: all site.exp gdb.%/.dir
+ $(DO_RUNTEST) --directory=gdb.$* --outdir=gdb.$* $(RUNTESTFLAGS)
+
+# Each half (roughly) of the .exp files from gdb.base.
+BASE1_FILES = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/gdb.base/[a-m]*.exp))
+BASE2_FILES = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/gdb.base/[n-z]*.exp))
+
+# Handle each half of gdb.base.
+check-gdb.base%: all site.exp gdb.base%/.dir
+ @if test ! -d gdb.base$*; then mkdir gdb.base$*; fi
+ $(DO_RUNTEST) $(BASE$*_FILES) --outdir gdb.base$* $(RUNTESTFLAGS)
+
+%/.dir:
+ @-if test ! -d $*; then mkdir $*; fi
+ @echo > $@
subdir_do: force
@for i in $(DODIRS); do \