This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFT] parallel testsuite patch for 4.3, need Ada tester


I'd like to commit Jakub's parallel testsuite patch to the 4.3 branch.
I've tested it on powerpc64-linux for all languages except Ada and would
appreciate it if someone can test it with Ada.  That's the only part of
the patch that needed adjustment, since files in gcc/ada moved somewhat.

2008-12-04  Janis Johnson  <janis187@us.ibm.com>

	Backport from mainline:
	2008-10-18  Jakub Jelinek  <jakub@redhat.com>
	            Janis Johnson  <janis187@us.ibm.com>

contrib/
	* dg-extract-results.sh: New file.
gcc/
	* Makefile.in (lang_checks_parallelized, check_gcc_parallelize,
	check_p_tool, check_p_vars, check_p_subno, check_p_comma,
	check_p_subwork, check_p_numbers, check_p_subdir, check_p_subdirs):
	New variables.
	(check-subtargets, check-%-subtargets, check-parallel-%): New
	targets.
	(check-%): For test targets listed in lang_checks_parallelized
	if -j is used and RUNTESTFLAGS doesn't specify tests to execute,
	run the testing in multiple make goals, possibly parallel, and
	afterwards run dg-extract-results.sh to merge the sum and log files.
gcc/cp/
	* Make-lang.in (check-c++-subtargets): New alias for
	check-g++-subtargets.
	(lang_checks_parallelized): Add check-g++.
	(check_g++_parallelize): New variable.
gcc/fortran/
	* Make-lang.in (check-f95-subtargets, check-fortran-subtargets): New
	aliases for check-gfortran-subtargets.
	(lang_checks_parallelized): Add check-gfortran.
	(check_gfortran_parallelize): New variable.
gcc/ada/
	* Make-lang.in (check-ada-subtargets): Depend on
	check-acats-subtargets and check-gnat-subtargets.
	(check_acats_targets): New variable.
	(check-acats-subtargets, check-acats%): New targets.
	(check-acats): If -j is used and CHAPTERS is empty, run the testing
	in multiple make goals, possibly parallel, and afterwards run
	dg-extract-results.sh to merge the sum and log files.
gcc/java/
	* Make-lang.in (check-java-subtargets): New target.
libstdc++-v3/
	* testsuite/Makefile.am (AUTOMAKE_OPTIONS): Remove dejagnu.
	(RUNTESTDEFAULTFLAGS, EXPECT, check_DEJAGNU_normal_targets): New
	variables.
	(%/site.exp, check-DEJAGNU%): New targets.
	(check-am): Run $(MAKE) check-DEJAGNU.
	* testsuite/Makefile.in: Regenerated.

Index: contrib/dg-extract-results.sh
===================================================================
--- contrib/dg-extract-results.sh	(revision 0)
+++ contrib/dg-extract-results.sh	(revision 0)
@@ -0,0 +1,416 @@
+#! /bin/sh
+
+# For a specified tool and optional list of test variants, extract
+# test results from one or more test summary (.sum) files and combine
+# the results into a new test summary file, sent to the standard output.
+# The resulting file can be used with test result comparison scripts for
+# results from tests that were run in parallel.  See usage() below.
+
+# Copyright (C) 2008 Free Software Foundation
+# Contributed by Janis Johnson <janis187@us.ibm.com>
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+PROGNAME=dg-extract-results.sh
+
+usage() {
+  cat <<EOF >&2
+Usage: $PROGNAME [-t tool] [-l variant-list] [-L] sum-file ...
+
+    tool           The tool (e.g. g++, libffi) for which to create a
+                   new test summary file.  If not specified then all
+                   specified sum files must be for the same tool.
+    variant-list   One or more test variant names.  If the list is
+                   not specified then one is constructed from all
+                   variants in the files for <tool>.
+    sum-file       A test summary file with the format of those
+                   created by runtest from DejaGnu.
+    If -L is used, merge *.log files instead of *.sum.  In this
+    mode the exact order of lines may not be preserved, just different
+    Running *.exp chunks should be in correct order.
+EOF
+}
+
+# Write a message to the standard error.
+
+msg() {
+  echo "$@" >&2
+}
+
+# Parse the command-line options.
+
+VARIANTS=""
+TOOL=""
+MODE="sum"
+
+while getopts "l:t:L" ARG; do
+  case $ARG in
+  l)  VARIANTS="${VARIANTS} ${OPTARG}";;
+  t)  test -z "$TOOL" || (msg "${PROGNAME}: only one tool can be specified"; exit 1);
+      TOOL="${OPTARG}";;
+  L)  MODE="log";;
+  \?) usage; exit 0;;
+  esac
+done
+shift `expr ${OPTIND} - 1`
+
+if test $# -lt 1 ; then
+  usage
+  exit 1
+fi
+
+TMPDIR=${TMPDIR-/tmp}
+SUM_FILES="$@"
+FIRST_SUM=$1
+TMP=
+trap 'EXIT_STATUS=$?; rm -rf $TMP && exit $EXIT_STATUS' 0
+# Create a (secure) tmp directory for tmp files.
+{
+  TMP=`(umask 077 && mktemp -d -q "${TMPDIR}/dg-combine-results-$$-XXXXXX") 2>/dev/null` &&
+  test -n "$TMP" && test -d "$TMP"
+} ||
+{
+  TMP=${TMPDIR}/dg-combine-results-$$-$RANDOM
+  (umask 077 && mkdir $TMP)
+} ||
+{
+  msg "${PROGNAME}: cannot create a temporary directory"
+  { (exit 1); exit 1; }
+}
+
+# Find a good awk.
+
+if test -z "$AWK" ; then
+  for AWK in gawk nawk awk
+  do
+    if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then
+      :
+    else
+      break
+    fi
+  done
+fi
+
+# Verify that the specified summary files exist.
+
+ERROR=0
+for FILE in $SUM_FILES
+do
+  if ! test -f $FILE ; then
+    msg "${PROGNAME}: file $FILE does not exist."
+    ERROR=1
+  fi
+done
+test $ERROR -eq 0 || exit 1
+
+if [ -z "$TOOL" ]; then
+  # If no tool was specified, all specified summary files must be for
+  # the same tool.
+
+  CNT=`grep '=== .* tests ===' $SUM_FILES | $AWK '{ print $3 }' | sort -u | wc -l`
+  if [ $CNT -eq 1 ]; then
+    TOOL=`grep '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'`
+  else
+    msg "${PROGNAME}: sum files are for multiple tools, specify a tool"
+    msg ""
+    usage
+    exit 1
+  fi
+else
+  # Ignore the specified summary files that are not for this tool.  This
+  # should keep the relevant files in the same order.
+
+  SUM_FILES=`grep -l "=== $TOOL" $SUM_FILES`
+  if test -z "$SUM_FILES" ; then
+    msg "${PROGNAME}: none of the specified files are results for $TOOL"
+    exit 1
+  fi
+fi
+
+if [ "$TOOL" = acats ]; then
+  # Acats *.sum or *.log files aren't dejagnu generated, and they have
+  # somewhat different format.
+  ACATS_AWK=${TMP}/acats.awk
+  cat <<EOF > $ACATS_AWK
+BEGIN {
+  print_prologue=1; chapter=""; insummary=0
+  passcnt=0; failcnt=0; unsupcnt=0; failures=""
+}
+/=== acats configuration ===/ {
+  insummary=0
+  if (print_prologue) print
+  next
+}
+/=== acats tests ===/ {
+  if (print_prologue) print
+  print_prologue=0
+  next
+}
+/^Running chapter / {
+  chapter=\$3
+  print > "${TMP}/chapter-"chapter
+  next
+}
+/=== acats Summary ===/ {
+  chapter=""
+  insummary=1
+  next
+}
+/^# of expected passes/		{ if (insummary == 1) passcnt += \$5; next; }
+/^# of unexpected failures/	{ if (insummary == 1) failcnt += \$5; next; }
+/^# of unsupported tests/	{ if (insummary == 1) unsupcnt += \$5; next; }
+/^\*\*\* FAILURES: / {
+  if (insummary == 1) {
+    if (failures) sub(/^\*\*\* FAILURES:/,"")
+    failures=failures""\$0
+  }
+}
+{
+  if (print_prologue) { print; next }
+  if (chapter) print > "${TMP}/chapter-"chapter
+}
+END {
+  system ("cat ${TMP}/chapter-*")
+  print "		=== acats Summary ==="
+  print "# of expected passes		" passcnt
+  print "# of unexpected failures	" failcnt
+  if (unsupcnt) print "# of unsupported tests		" unsupcnt
+  if (failures) print failures
+}
+EOF
+
+  $AWK -f $ACATS_AWK $SUM_FILES
+  exit 0
+fi
+
+# If no variants were specified, find all variants in the remaining
+# summary files.  Otherwise, ignore specified variants that aren't in
+# any of those summary files.
+
+if test -z "$VARIANTS" ; then
+  VAR_AWK=${TMP}/variants.awk
+  cat <<EOF > $VAR_AWK
+/^Schedule of variations:/      { in_vars=1; next }
+/^$/                            { in_vars=0 }
+/^Running target/               { exit }
+{ if (in_vars==1) print \$1; else next }
+EOF
+
+  touch ${TMP}/varlist
+  for FILE in $SUM_FILES; do
+    $AWK -f $VAR_AWK $FILE >> ${TMP}/varlist
+  done
+  VARIANTS="`sort -u ${TMP}/varlist`"
+else
+  VARS="$VARIANTS"
+  VARIANTS=""
+  for VAR in $VARS
+  do
+    grep -q "Running target $VAR" $SUM_FILES && VARIANTS="$VARIANTS $VAR"
+  done
+fi
+
+# Find out if we have more than one variant, or any at all.
+
+VARIANT_COUNT=0
+for VAR in $VARIANTS
+do
+  VARIANT_COUNT=`expr $VARIANT_COUNT + 1`
+done
+
+if test $VARIANT_COUNT -eq 0 ; then
+  msg "${PROGNAME}: no file for $TOOL has results for the specified variants"
+  exit 1
+fi
+
+cat $SUM_FILES \
+  | $AWK '/^Running/ { if ($2 != "target" && $3 == "...") print "EXPFILE: "$2 } ' \
+  | sort -u > ${TMP}/expfiles
+
+# Write the begining of the combined summary file.
+
+head -n 2 $FIRST_SUM
+echo
+echo "		=== $TOOL tests ==="
+echo
+echo "Schedule of variations:"
+for VAR in $VARIANTS
+do
+  echo "    $VAR"
+done
+echo
+
+# For each test variant for the tool, copy test reports from each of the
+# summary files.  Set up two awk scripts from within the loop to
+# initialize VAR and TOOL with the script, rather than assuming that the
+# available version of awk can pass variables from the command line.
+
+for VAR in $VARIANTS
+do
+  GUTS_AWK=${TMP}/guts.awk
+  cat << EOF > $GUTS_AWK
+BEGIN {
+  variant="$VAR"
+  firstvar=1
+  expfileno=1
+  cnt=0
+  print_using=0
+}
+/^EXPFILE: / {
+  expfiles[expfileno] = \$2
+  expfilesr[\$2] = expfileno
+  expfileno = expfileno + 1
+}
+/^Running target / {
+  curvar = \$3
+  if (variant == curvar && firstvar == 1) { print; print_using=1; firstvar = 0 }
+  next
+}
+/^Using / {
+  if (variant == curvar && print_using) { print; next }
+}
+/^Running / {
+  print_using=0
+  if (variant == curvar) {
+    curfile="${TMP}/list"expfilesr[\$2]
+    expfileseen[\$2]=expfileseen[\$2] + 1
+    testname="00"
+    next
+  }
+}
+/\===/ { curvar = ""; next }
+/^(PASS|XPASS|FAIL|XFAIL|UNRESOLVED|WARNING|ERROR|UNSUPPORTED|UNTESTED|KFAIL):/ {
+  testname=\$2
+  # Ugly hack for gfortran.dg/dg.exp
+  if ("$TOOL" == "gfortran" && testname ~ /^gfortran.dg\/g77\//)
+    testname="h"testname
+}
+/^$/ { if ("$MODE" == "sum") next }
+{ if (variant == curvar && curfile) {
+    if ("$MODE" == "sum") {
+      printf "%s %08d|", testname, cnt > curfile
+      cnt = cnt + 1
+    }
+    filewritten[curfile]=1
+    print > curfile
+  } else
+    next
+}
+END {
+  n=1
+  while (n < expfileno) {
+    if (expfileseen[expfiles[n]]) {
+      print "Running "expfiles[n]" ..."
+      if (filewritten["${TMP}/list"n]) {
+	if (expfileseen[expfiles[n]] == 1)
+	  cmd="cat"
+	else
+	  cmd="LC_ALL=C sort"
+	if ("$MODE" == "sum")
+	  system (cmd" ${TMP}/list"n" | sed -n 's/^[^ ]* [^ |]*|//p'")
+	else
+	  system ("cat ${TMP}/list"n)
+      }
+    }
+    n = n + 1
+  }
+}
+EOF
+
+  SUMS_AWK=${TMP}/sums.awk
+  rm -f $SUMS_AWK
+  cat << EOF > $SUMS_AWK
+BEGIN {
+  variant="$VAR"
+  tool="$TOOL"
+  passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; unsupcnt=0; unrescnt=0;
+  curvar=""; insummary=0
+}
+/^Running target /		{ curvar = \$3; next }
+/^# of /			{ if (variant == curvar) insummary = 1 }
+/^# of expected passes/		{ if (insummary == 1) passcnt += \$5; next; }
+/^# of unexpected successes/	{ if (insummary == 1) xpasscnt += \$5; next; }
+/^# of unexpected failures/	{ if (insummary == 1) failcnt += \$5; next; }
+/^# of expected failures/	{ if (insummary == 1) xfailcnt += \$5; next; }
+/^# of untested testcases/	{ if (insummary == 1) untstcnt += \$5; next; }
+/^# of unresolved testcases/	{ if (insummary == 1) unrescnt += \$5; next; }
+/^# of unsupported tests/	{ if (insummary == 1) unsupcnt += \$5; next; }
+/^$/				{ if (insummary == 1)
+				    { insummary = 0; curvar = "" }
+				  next
+				}
+{ next }
+END {
+  printf ("\t\t=== %s Summary for %s ===\n\n", tool, variant)
+  if (passcnt != 0) printf ("# of expected passes\t\t%d\n", passcnt)
+  if (xpasscnt != 0) printf ("# of unexpected successes\t%d\n", xpasscnt)
+  if (failcnt != 0) printf ("# of unexpected failures\t%d\n", failcnt)
+  if (xfailcnt != 0) printf ("# of expected failures\t\t%d\n", xfailcnt)
+  if (untstcnt != 0) printf ("# of untested testcases\t\t%d\n", untstcnt)
+  if (unrescnt != 0) printf ("# of unresolved testcases\t%d\n", unrescnt)
+  if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt)
+}
+EOF
+
+  PVAR=`echo $VAR | sed 's,/,.,g'`
+  TMPFILE=${TMP}/var-$PVAR
+  rm -f $TMPFILE
+  rm -f ${TMP}/list*
+  cat ${TMP}/expfiles $SUM_FILES | $AWK -f $GUTS_AWK
+  cat $SUM_FILES | $AWK -f $SUMS_AWK > $TMPFILE
+  # If there are multiple variants, output the counts for this one;
+  # otherwise there will just be the final counts at the end.
+  test $VARIANT_COUNT -eq 1 || cat $TMPFILE
+done
+
+# Set up an awk script to get the combined summary counts for the tool.
+
+TOTAL_AWK=${TMP}/total.awk
+cat << EOF > $TOTAL_AWK
+BEGIN {
+  tool="$TOOL"
+  passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; unsupcnt=0; unrescnt=0
+}
+/^# of expected passes/		{ passcnt += \$5 }
+/^# of unexpected failures/	{ failcnt += \$5 }
+/^# of unexpected successes/	{ xpasscnt += \$5 }
+/^# of expected failures/	{ xfailcnt += \$5 }
+/^# of untested testcases/	{ untstcnt += \$5 }
+/^# of unresolved testcases/	{ unrescnt += \$5 }
+/^# of unsupported tests/	{ unsupcnt += \$5 }
+END {
+  printf ("\n\t\t=== %s Summary ===\n\n", tool)
+  if (passcnt != 0) printf ("# of expected passes\t\t%d\n", passcnt)
+  if (failcnt != 0) printf ("# of unexpected failures\t%d\n", failcnt)
+  if (xpasscnt != 0) printf ("# of unexpected successes\t%d\n", xpasscnt)
+  if (xfailcnt != 0) printf ("# of expected failures\t\t%d\n", xfailcnt)
+  if (untstcnt != 0) printf ("# of untested testcases\t\t%d\n", untstcnt)
+  if (unrescnt != 0) printf ("# of unresolved testcases\t%d\n", unrescnt)
+  if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt)
+}
+EOF
+
+# Find the total summaries for the tool and add to the end of the output.
+cat ${TMP}/var-* | $AWK -f $TOTAL_AWK
+
+# This is ugly, but if there's version output from the compiler under test
+# at the end of the file, we want it.  The other thing that might be there
+# is the final summary counts.
+tail -n 2 $FIRST_SUM | grep -q '^#' || tail -n 2 $FIRST_SUM
+
+exit 0
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 142413)
+++ gcc/Makefile.in	(working copy)
@@ -420,6 +420,23 @@
 xm_include_list=@xm_include_list@
 xm_defines=@xm_defines@
 lang_checks=check-gcc
+lang_checks_parallelized=check-gcc
+# This lists a couple of test files that take most time during check-gcc.
+# When doing parallelized check-gcc, these can run in parallel with the
+# remaining tests.  Each word in this variable stands for work for one
+# make goal and one extra make goal is added to handle all the *.exp
+# files not handled explicitly already.  If multiple *.exp files
+# should be run in the same runtest invocation (usually if they aren't
+# very long running, but still should be split of from the check-parallel-$lang
+# remaining tests runtest invocation), they should be concatenated with commas.
+# Note that [a-zA-Z] wildcards need to have []s prefixed with \ (needed
+# by tcl) and as the *.exp arguments are mached both as is and with
+# */ prefixed to it in runtest_file_p, it is usually desirable to include
+# a subdirectory name.
+check_gcc_parallelize=execute.exp=execute/2* \
+		      execute.exp=execute/\[013-9a-zA-Z\]* \
+		      compile.exp dg.exp \
+		      struct-layout-1.exp,unsorted.exp,stackalign.exp,i386.exp
 lang_opt_files=@lang_opt_files@ $(srcdir)/c.opt $(srcdir)/common.opt
 lang_specs_files=@lang_specs_files@
 lang_tree_files=@lang_tree_files@
@@ -4275,6 +4292,8 @@
 
 check: $(CHECK_TARGETS)
 
+check-subtargets: $(patsubst %,%-subtargets,$(CHECK_TARGETS))
+
 # The idea is to parallelize testing of multilibs, for example:
 #   make -j3 check-gcc//sh-hms-sim/{-m1,-m2,-m3,-m3e,-m4}/{,-nofpu}
 # will run 3 concurrent sessions of check-gcc, eventually testing
@@ -4296,7 +4315,8 @@
 	-rm -f $@
 	sed '/set tmpdir/ s|testsuite|$(TESTSUITEDIR)|' < site.exp > $@
 
-$(lang_checks): check-% : site.exp
+# This is only used for check-% targets that aren't parallelized.
+$(filter-out $(lang_checks_parallelized),$(lang_checks)): check-% : site.exp
 	-test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR)
 	test -d $(TESTSUITEDIR)/$* || mkdir $(TESTSUITEDIR)/$*
 	-(rootme=`${PWD_COMMAND}`; export rootme; \
@@ -4313,6 +4333,108 @@
 	GCC_EXEC_PREFIX="$(libdir)/gcc/" ; export GCC_EXEC_PREFIX ; \
 	$(RUNTEST) --tool $* $(RUNTESTFLAGS))
 
+$(patsubst %,%-subtargets,$(filter-out $(lang_checks_parallelized),$(lang_checks))): check-%-subtargets:
+	@echo check-$*
+
+check_p_tool=$(firstword $(subst _, ,$*))
+check_p_vars=$(check_$(check_p_tool)_parallelize)
+check_p_subno=$(word 2,$(subst _, ,$*))
+check_p_comma=,
+check_p_subwork=$(subst $(check_p_comma), ,$(if $(check_p_subno),$(word $(check_p_subno),$(check_p_vars))))
+check_p_numbers=1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+check_p_subdir=$(subst _,,$*)
+check_p_subdirs=$(wordlist 1,$(words $(check_$*_parallelize)),$(check_p_numbers))
+
+# For parallelized check-% targets, this decides whether parallelization
+# is desirable (if -jN is used and RUNTESTFLAGS doesn't contain anything
+# but optionally --target_board argument).  If it is desirable,
+# recursive make is run with check-parallel-$lang{,1,2,3,4,5} etc. goals,
+# which can be executed in parallel, as they are run in separate directories.
+# check-parallel-$lang{1,2,3,4,5} etc. goals invoke runtest with the longest
+# running *.exp files from the testsuite, as determined by check_$lang_parallelize
+# variable.  The check-parallel-$lang goal in that case invokes runtest with
+# all the remaining *.exp files not handled by the separate goals.
+# Afterwards contrib/dg-extract-results.sh is used to merge the sum and log
+# files.  If parallelization isn't desirable, only one recursive make
+# is run with check-parallel-$lang goal and check_$lang_parallelize variable
+# cleared to say that no additional arguments beyond $(RUNTESTFLAGS)
+# should be passed to runtest.
+#
+# To parallelize some language check, add the corresponding check-$lang
+# to lang_checks_parallelized variable and define check_$lang_parallelize
+# variable (see above check_gcc_parallelize description).
+$(lang_checks_parallelized): check-% : site.exp
+	@if [ -z "$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
+	    && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
+	  $(MAKE) TESTSUITEDIR="$(TESTSUITEDIR)" RUNTESTFLAGS="$(RUNTESTFLAGS)" \
+	    check-parallel-$* \
+	    $(patsubst %,check-parallel-$*_%, $(check_p_subdirs)); \
+	  for file in $(TESTSUITEDIR)/$*/$* \
+		      $(patsubst %,$(TESTSUITEDIR)/$*%/$*,$(check_p_subdirs));\
+	  do \
+	    mv -f $$file.sum $$file.sum.sep; mv -f $$file.log $$file.log.sep; \
+	  done; \
+	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh \
+	    $(TESTSUITEDIR)/$*/$*.sum.sep \
+	    $(patsubst %,$(TESTSUITEDIR)/$*%/$*.sum.sep,$(check_p_subdirs)) \
+	    > $(TESTSUITEDIR)/$*/$*.sum; \
+	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh -L \
+	    $(TESTSUITEDIR)/$*/$*.log.sep \
+	    $(patsubst %,$(TESTSUITEDIR)/$*%/$*.log.sep,$(check_p_subdirs)) \
+	    > $(TESTSUITEDIR)/$*/$*.log; \
+	else \
+	  $(MAKE) TESTSUITEDIR="$(TESTSUITEDIR)" RUNTESTFLAGS="$(RUNTESTFLAGS)" \
+	    check_$*_parallelize= check-parallel-$*; \
+	fi
+
+# Just print the parallelized subtargets for those that want to split
+# the testing across machines.
+$(patsubst %,%-subtargets,$(lang_checks_parallelized)): check-%-subtargets:
+	@echo check-parallel-$* \
+	  $(patsubst %,check-parallel-$*_%, $(check_p_subdirs))
+
+# In the if [ -n "$(check_p_subno)" ] case runtest should be given the name of
+# the given *.exp file(s).  See comment above check_gcc_parallelize variable
+# for details on the content of these variables.
+#
+# In the elif [ -n "$(check_p_vars)" ] case runtest should be given
+# names of all the *.exp files for this tool that aren't already handled by
+# other goals.  First it finds all the *.exp files for this tool, then
+# prunes those already specified in check_$lang_parallelize or duplicates.
+#
+# Otherwise check-$lang isn't parallelized and runtest is invoked just with
+# the $(RUNTESTFLAGS) arguments.
+check-parallel-% : site.exp
+	-test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR)
+	test -d $(TESTSUITEDIR)/$(check_p_subdir) || mkdir $(TESTSUITEDIR)/$(check_p_subdir)
+	-(rootme=`${PWD_COMMAND}`; export rootme; \
+	srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \
+	cd $(TESTSUITEDIR)/$(check_p_subdir); \
+	rm -f tmp-site.exp; \
+	sed '/set tmpdir/ s|testsuite|$(TESTSUITEDIR)/$(check_p_subdir)|' \
+		< ../../site.exp > tmp-site.exp; \
+	$(SHELL) $${srcdir}/../move-if-change tmp-site.exp site.exp; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	if [ -f $${rootme}/../expect/expect ] ; then  \
+	   TCL_LIBRARY=`cd .. ; cd $${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \
+	    export TCL_LIBRARY ; fi ; \
+	GCC_EXEC_PREFIX="$(libdir)/gcc/" ; export GCC_EXEC_PREFIX ; \
+	runtestflags= ; \
+	if [ -n "$(check_p_subno)" ] ; then \
+	  runtestflags="$(check_p_subwork)"; \
+	elif [ -n "$(check_p_vars)" ] ; then \
+	  parts="`echo ' $(strip $(subst $(check_p_comma), ,$(check_p_vars))) ' \
+		  | sed 's/=[^ ]* / /g'`"; \
+	  for part in `find $$srcdir/testsuite/$(check_p_tool)* -name \*.exp` ; do \
+	    part=`basename $$part` ; \
+	    case " $$parts $$runtestflags " in \
+	      *" $$part "*) ;; \
+	      *) runtestflags="$$runtestflags $$part" ;; \
+	    esac ; \
+	  done ; \
+	fi ; \
+	$(RUNTEST) --tool $(check_p_tool) $(RUNTESTFLAGS) $$runtestflags)
+
 check-consistency: testsuite/site.exp
 	-rootme=`${PWD_COMMAND}`; export rootme; \
 	srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \
@@ -4350,7 +4472,7 @@
 ${QMTEST_DIR} stamp-qmtest:
 	${QMTEST} -D ${QMTEST_DIR} create-tdb \
 	    -c gcc_database.GCCDatabase \
-            -a srcdir=`cd ${srcdir}/testsuite && ${PWD_COMMAND}` && \
+	    -a srcdir=`cd ${srcdir}/testsuite && ${PWD_COMMAND}` && \
 	    $(STAMP) stamp-qmtest
 
 # Create the QMTest context file.
Index: gcc/cp/Make-lang.in
===================================================================
--- gcc/cp/Make-lang.in	(revision 142413)
+++ gcc/cp/Make-lang.in	(working copy)
@@ -136,8 +136,12 @@
 # check targets.  However, our DejaGNU framework requires 'check-g++' as its
 # entry point.  We feed the former to the latter here.
 check-c++ : check-g++
+check-c++-subtargets : check-g++-subtargets
 # List of targets that can use the generic check- rule and its // variant.
 lang_checks += check-g++
+lang_checks_parallelized += check-g++
+# For description see comment above check_gcc_parallelize in gcc/Makefile.in.
+check_g++_parallelize = old-deja.exp dg.exp
 
 #
 # Install hooks:
Index: gcc/fortran/Make-lang.in
===================================================================
--- gcc/fortran/Make-lang.in	(revision 142413)
+++ gcc/fortran/Make-lang.in	(working copy)
@@ -141,7 +141,14 @@
 
 check-f95 : check-gfortran
 check-fortran : check-gfortran
+check-f95-subtargets : check-gfortran-subtargets
+check-fortran-subtargets : check-gfortran-subtargets
 lang_checks += check-gfortran
+lang_checks_parallelized += check-gfortran
+# For description see comment above check_gcc_parallelize in gcc/Makefile.in.
+check_gfortran_parallelize = dg.exp=gfortran.dg/\[a-cA-C\]* \
+			     dg.exp=gfortran.dg/\[d-mD-M\]* \
+			     dg.exp=gfortran.dg/\[n-zN-Z0-9\]*
 
 # GFORTRAN documentation.
 GFORTRAN_TEXI = \
Index: gcc/ada/Make-lang.in
===================================================================
--- gcc/ada/Make-lang.in	(revision 142413)
+++ gcc/ada/Make-lang.in	(working copy)
@@ -859,16 +859,48 @@
 lang_checks += check-gnat
 
 check-ada: check-acats check-gnat
+check-ada-subtargets: check-acats-subtargets check-gnat-subtargets
 
 ACATSDIR = $(TESTSUITEDIR)/ada/acats
 
+check_acats_targets = $(patsubst %,check-acats%, 0 1 2)
+
 check-acats:
-	test -d $(ACATSDIR) || mkdir -p $(ACATSDIR)
+	@test -d $(ACATSDIR) || mkdir -p $(ACATSDIR); \
+	if [ -z "$(CHAPTERS)" ] && [ "$(filter -j, $(MFLAGS))" = "-j" ]; \
+	then \
+	  $(MAKE) $(check_acats_targets); \
+	  for idx in 0 1 2; do \
+	    mv -f $(ACATSDIR)$$idx/acats.sum $(ACATSDIR)$$idx/acats.sum.sep; \
+	    mv -f $(ACATSDIR)$$idx/acats.log $(ACATSDIR)$$idx/acats.log.sep; \
+	  done; \
+	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh \
+	    $(ACATSDIR)0/acats.sum.sep $(ACATSDIR)1/acats.sum.sep \
+	    $(ACATSDIR)2/acats.sum.sep > $(ACATSDIR)/acats.sum; \
+	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh -L \
+	    $(ACATSDIR)0/acats.log.sep $(ACATSDIR)1/acats.log.sep \
+	    $(ACATSDIR)2/acats.log.sep > $(ACATSDIR)/acats.log; \
+	  exit 0; \
+	fi; \
 	testdir=`cd ${srcdir}/${ACATSDIR}; ${PWD_COMMAND}`; \
 	export testdir; cd $(ACATSDIR); $(SHELL) $${testdir}/run_acats $(CHAPTERS)
 
-.PHONY: check-acats
+check-acats-subtargets:
+	@echo $(check_acats_targets)
 
+# Parallelized check-acats
+$(check_acats_targets): check-acats%:
+	test -d $(ACATSDIR)$* || mkdir -p $(ACATSDIR)$*; \
+	testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \
+	case "$*" in \
+	  0) chapters="`cd $$testdir/tests; echo [a-b]* c[0-4]*`";; \
+	  1) chapters="`cd $$testdir/tests; echo c[5-9ab]*`";; \
+	  2) chapters="`cd $$testdir/tests; echo c[c-z]* [d-z]*`";; \
+	esac; \
+	export testdir; cd $(ACATSDIR)$* && $(SHELL) $${testdir}/run_acats $$chapters
+
+.PHONY: check-acats $(check_acats_targets)
+
 
 # Bootstrapping targets for just GNAT - use the same stage directories
 gnatboot: force
Index: gcc/java/Make-lang.in
===================================================================
--- gcc/java/Make-lang.in	(revision 142413)
+++ gcc/java/Make-lang.in	(working copy)
@@ -150,6 +150,7 @@
 	-cp -p $^ $(srcdir)/doc
 
 check-java :
+check-java-subtargets :
 
 # Install hooks:
 # jc1, gcj, and jvgenmain are installed elsewhere as part
Index: libstdc++-v3/testsuite/Makefile.am
===================================================================
--- libstdc++-v3/testsuite/Makefile.am	(revision 142413)
+++ libstdc++-v3/testsuite/Makefile.am	(working copy)
@@ -21,7 +21,9 @@
 ## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 ## USA.
 
-AUTOMAKE_OPTIONS = dejagnu nostdinc
+AUTOMAKE_OPTIONS = nostdinc
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+EXPECT = expect
 
 include $(top_srcdir)/fragment.am
 
@@ -86,6 +88,80 @@
 	  fi; \
 	  ${extract_symvers} ../src/.libs/libstdc++.so $${output})
 
+%/site.exp: site.exp
+	-test -d $* || mkdir $*
+	@srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
+	objdir=`${PWD_COMMAND}`/$*; \
+	sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
+	    -e "s|^set objdir .*$$|set objdir $$objdir|" \
+	    site.exp > $*/site.exp.tmp
+	@-rm -f $*/site.bak
+	@test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
+	@mv $*/site.exp.tmp $*/site.exp
+
+check_DEJAGNU_normal_targets = $(patsubst %,check-DEJAGNUnormal%,0 1 2 3)
+$(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
+
+# Run the testsuite in normal mode.
+check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
+	if [ -z "$*$(filter-out --target_board=%, $(RUNTESTFLAGS))" ] \
+	    && [ "$(filter -j, $(MFLAGS))" = "-j" ]; then \
+	  $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNUnormal0 check-DEJAGNUnormal1 \
+		  check-DEJAGNUnormal2 check-DEJAGNUnormal3; \
+	  for idx in 0 1 2 3; do \
+	    mv -f normal$$idx/libstdc++.sum normal$$idx/libstdc++.sum.sep; \
+	    mv -f normal$$idx/libstdc++.log normal$$idx/libstdc++.log.sep; \
+	  done; \
+	  mv -f libstdc++.sum libstdc++.sum.sep; \
+	  mv -f libstdc++.log libstdc++.log.sep; \
+	  $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
+	    libstdc++.sum.sep normal0/libstdc++.sum.sep \
+	    normal1/libstdc++.sum.sep normal2/libstdc++.sum.sep \
+	    normal3/libstdc++.sum.sep > libstdc++.sum; \
+	  $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
+	    libstdc++.log.sep normal0/libstdc++.log.sep \
+	    normal1/libstdc++.log.sep normal2/libstdc++.log.sep \
+	    normal3/libstdc++.log.sep > libstdc++.log; \
+	  exit 0; \
+	fi; \
+	srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+	EXPECT=$(EXPECT); export EXPECT; \
+	runtest=$(RUNTEST); \
+	if [ -z "$$runtest" ]; then runtest=runtest; fi; \
+	tool=libstdc++; \
+	dirs=; \
+	case "$*" in \
+	  normal0) \
+	    if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+	      $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
+			$(RUNTESTFLAGS) abi.exp; \
+	    else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+	    fi; \
+	    dirs="`cd $$srcdir; echo [013-9][0-9]_*/* [abep]*/*`";; \
+	  normal1) \
+	    dirs="`cd $$srcdir; echo 2[0-2]_*/*`";; \
+	  normal2) \
+	    dirs="`cd $$srcdir; echo 2[4-9]_*/*`";; \
+	  normal3) \
+	    dirs="`cd $$srcdir; echo 23_*/* t*/*`";; \
+	esac; \
+	if [ -n "$*" ]; then cd "$*"; fi; \
+	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+	  if [ -n "$$dirs" ]; then \
+	    $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
+		    $(RUNTESTFLAGS) \
+		    "conformance.exp=`echo $$dirs | sed 's/ /* /g;s/$$/*/'`"; \
+	  else \
+	    $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
+		    $(RUNTESTFLAGS); \
+	  fi; \
+	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+	fi
+
+check-am:
+	$(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+.PHONY: check-DEJAGNU
+
 # Use 'new-abi-baseline' to create an initial symbol file.  Then run
 # 'check-abi' to test for changes against that file.
 check-abi: site.exp baseline_symbols 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]