]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
parallel-tests: add auxiliary script 'test-driver', refactor
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 10 May 2011 09:30:05 +0000 (11:30 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 21 Jun 2011 20:27:25 +0000 (22:27 +0200)
This refactoring should cause no API of functionality change,
and is meant only to simplify the future implementation of TAP
and SubUnit testsuite drivers.  More precisely, our roadmap is
to move most of the "testsuite driving" features out of the
Automake-generated Makefiles, and into external scripts with
well-defined interfaces.  This will allow the user to define
its own personalized testsuite drivers, and will also offer us
a framework upon which to implement our new TAP and SubUnit
drivers, all in a very unobtrusive way and retaining an high
degree of code reuse and backward-compatibility.

* lib/test-driver: New auxiliary script.
* lib/Makefile.am (dist_SCRIPT_DATA): Add it.
* automake.in (handle_tests): Require the new auxiliary script
`test-driver', and define a new internal makefile variable
`$(am__test_driver)', used to call it.  Perform new substitution
on `DRIVER' when processing the `check2.am' file.
* lib/check.am (am__tty_colors): Define new shell variable
`$am__color_tests'.
(am__rst_section): Removed, its role taken over by the new
`test-driver' script.
(am__test_driver_flags): New variable, contains the command
line options passed to `test-driver'.
(am__check_pre): Do not deal with temporary files and exit
traps anymore, as the `test-driver' script takes care of that
now.  Define shell variable `$am__enable_hard_errors', used by
`$(am__test_driver_flags)'.  Reorder so that we don't need to
save and restore the value of the `TERM' environment variable
anymore.
Other related adjustments.
(am__check_post): Remove, as its role has been completely taken
over by the `test-driver' script.
* am/check2.am (?GENERIC?%EXT%$(EXEEXT).log, ?GENERIC?%EXT%.log,
?!GENERIC?%OBJ%): Call the test script through the Automake
substituted `%DRIVER%', and honor the command-line options
in `$(am__test_driver_flags)'.  Do not call the obsoleted
`$(am__check_post)' anymore.
* doc/automake.texi (Auxiliary Programs): Mention the new
`test-driver' script.
(Optional): Mention `test-driver' in AC_CONFIG_AUX_DIR.
Since we are at it, break the list of auxiliary scripts by
placing one per line, to simplify potential future additions
of new scripts.
* tests/check.test: Adjust.
* tests/check2.test : Likewise.
* tests/check3.test : Likewise.
* tests/check4.test : Likewise.
* tests/check10.test: Likewise.
* tests/color.test: Likewise.
* tests/color2.test: Likewise.
* tests/comment9.test: Likewise.
* tests/dejagnu.test: Likewise.
* tests/exeext4.test: Likewise.
* tests/maken3.test: Likewise.
* tests/maken4.test: Likewise.
* tests/parallel-tests-interrupt.test: Likewise.
* tests/posixsubst-tests.test: Likewise.
* tests/repeated-options.test: Likewise.
* tests/check-no-test-driver.test: New test.
* tests/parallel-test-driver-install.test: Likewise.
* tests/Makefile.am (TESTS): Update.
* NEWS: Update.

29 files changed:
ChangeLog
NEWS
automake.in
doc/automake.texi
lib/Automake/tests/Makefile.in
lib/Makefile.am
lib/Makefile.in
lib/am/check.am
lib/am/check2.am
lib/test-driver [new file with mode: 0755]
tests/Makefile.am
tests/Makefile.in
tests/check-no-test-driver.test [new file with mode: 0755]
tests/check.test
tests/check10.test
tests/check2.test
tests/check3.test
tests/check4.test
tests/color.test
tests/color2.test
tests/comment9.test
tests/dejagnu.test
tests/exeext4.test
tests/maken3.test
tests/maken4.test
tests/parallel-test-driver-install.test [new file with mode: 0755]
tests/parallel-tests-interrupt.test
tests/posixsubst-tests.test
tests/repeated-options.test

index 8cb078ae9a86773e28097ae596db2d68ce725312..81a54d285bc91d5d391e3b4db0166acb1075309e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,68 @@
+2011-06-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: add auxiliary script 'test-driver', refactor
+       This refactoring should cause no API of functionality change,
+       and is meant only to simplify the future implementation of TAP
+       and SubUnit testsuite drivers.  More precisely, our roadmap is
+       to move most of the "testsuite driving" features out of the
+       Automake-generated Makefiles, and into external scripts with
+       well-defined interfaces.  This will allow the user to define
+       its own personalized testsuite drivers, and will also offer us
+       a framework upon which to implement our new TAP and SubUnit
+       drivers, all in a very unobtrusive way and retaining an high
+       degree of code reuse and backward-compatibility.
+       * lib/test-driver: New auxiliary script.
+       * lib/Makefile.am (dist_SCRIPT_DATA): Add it.
+       * automake.in (handle_tests): Require the new auxiliary script
+       `test-driver', and define a new internal makefile variable
+       `$(am__test_driver)', used to call it.  Perform new substitution
+       on `DRIVER' when processing the `check2.am' file.
+       * lib/check.am (am__tty_colors): Define new shell variable
+       `$am__color_tests'.
+       (am__rst_section): Removed, its role taken over by the new
+       `test-driver' script.
+       (am__test_driver_flags): New variable, contains the command
+       line options passed to `test-driver'.
+       (am__check_pre): Do not deal with temporary files and exit
+       traps anymore, as the `test-driver' script takes care of that
+       now.  Define shell variable `$am__enable_hard_errors', used by
+       `$(am__test_driver_flags)'.  Reorder so that we don't need to
+       save and restore the value of the `TERM' environment variable
+       anymore.
+       Other related adjustments.
+       (am__check_post): Remove, as its role has been completely taken
+       over by the `test-driver' script.
+       * am/check2.am (?GENERIC?%EXT%$(EXEEXT).log, ?GENERIC?%EXT%.log,
+       ?!GENERIC?%OBJ%): Call the test script through the Automake
+       substituted `%DRIVER%', and honor the command-line options
+       in `$(am__test_driver_flags)'.  Do not call the obsoleted
+       `$(am__check_post)' anymore.
+       * doc/automake.texi (Auxiliary Programs): Mention the new
+       `test-driver' script.
+       (Optional): Mention `test-driver' in AC_CONFIG_AUX_DIR.
+       Since we are at it, break the list of auxiliary scripts by
+       placing one per line, to simplify potential future additions
+       of new scripts.
+       * tests/check.test: Adjust.
+       * tests/check2.test : Likewise.
+       * tests/check3.test : Likewise.
+       * tests/check4.test : Likewise.
+       * tests/check10.test: Likewise.
+       * tests/color.test: Likewise.
+       * tests/color2.test: Likewise.
+       * tests/comment9.test: Likewise.
+       * tests/dejagnu.test: Likewise.
+       * tests/exeext4.test: Likewise.
+       * tests/maken3.test: Likewise.
+       * tests/maken4.test: Likewise.
+       * tests/parallel-tests-interrupt.test: Likewise.
+       * tests/posixsubst-tests.test: Likewise.
+       * tests/repeated-options.test: Likewise.
+       * tests/check-no-test-driver.test: New test.
+       * tests/parallel-test-driver-install.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
 2011-06-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        maintcheck: extend 'sc_tests_plain_*' checks
diff --git a/NEWS b/NEWS
index 35b223aabb170df287567c56e7febe448ec8343b..41d0dfe58ce39456af189620b30acc3858a6fc19 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,47 @@ New in 1.11a:
 
   - New `cscope' target to build a cscope database for the source tree.
 
+* Changes to Automake-generated testsuite harnesses:
+
+  - The parallel-tests driver is now implemented (partly at least) with
+    the help of automake-provided auxiliary scripts (e.g., `test-driver'),
+    instead of relying entirely on code in the generated Makefile.in.
+    This has two noteworthy implications.  The first one is that projects
+    using the `parallel-tests' option should now either run automake with
+    the `--add-missing' option, or manually copy the `test-driver' script
+    into their tree.  The second, and more important, implication is that
+    now, when the `parallel-tests' option is in use, TESTS_ENVIRONMENT can
+    not be used anymore to define a test runner, and the command specified
+    in LOG_COMPILER (and <ext>_LOG_COMPILER) must be a *real* executable
+    program or script.  For example, this is still a valid usage (albeit
+    a little contorted):
+
+      TESTS_ENVIRONMENT = \
+        if test -n '$(STRICT_TESTS)'; then \
+          maybe_errexit='-e'; \
+        else \
+          maybe_errexit=''; \
+        fi;
+      LOG_COMPILER = $(SHELL) $$maybe_errexit
+
+    while this is not anymore:
+
+      TESTS_ENVIRONMENT = \
+        $(SHELL) `test -n '$(STRICT_TESTS_CHECKING)' && echo ' -e'`
+
+    neither is this:
+
+      TESTS_ENVIRONMENT = \
+        run_with_perl_or_shell () \
+        { \
+          if grep -q '^#!.*perl' $$1; then
+            $(PERL) $$1; \
+          else \
+            $(SHELL) $$1; \
+          fi; \
+        }
+      LOG_COMPILER = run_with_per_or_shell
+
 * WARNING: Future backward-incompatibilities!
 
   - The Automake support for automatic de-ANSI-fication will be removed in
index 782768022d60a07d86572bc242eacc0a48a75008..e1c7a9231a0665e3de59720d3c6d1f0471374593 100644 (file)
@@ -4989,8 +4989,13 @@ sub handle_tests
       append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
        if (var ('XFAIL_TESTS'));
 
-      if (option 'parallel-tests')
+      if (my $parallel_tests = option 'parallel-tests')
         {
+          require_conf_file ($parallel_tests->{position}, FOREIGN,
+                             'test-driver');
+          define_variable ('am__test_driver',
+                           "\$(SHELL) $am_config_aux_dir/test-driver",
+                           INTERNAL);
          define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
          define_variable ('TEST_SUITE_HTML', '$(TEST_SUITE_LOG:.log=.html)', INTERNAL);
          my $suff = '.test';
@@ -5041,6 +5046,7 @@ sub handle_tests
                                                GENERIC => 0,
                                                OBJ => $obj,
                                                SOURCE => $val,
+                                               DRIVER => '$(am__test_driver)',
                                                COMPILE =>'$(' . $compile . ')',
                                                EXT => '',
                                                am__EXEEXT => 'FALSE');
@@ -5080,6 +5086,7 @@ sub handle_tests
                                                  GENERIC => 1,
                                                  OBJ => '',
                                                  SOURCE => '$<',
+                                                 DRIVER => '$(am__test_driver)',
                                                  COMPILE => '$(' . $compile . ')',
                                                  EXT => $test_suffix,
                                                  am__EXEEXT => $am_exeext);
index 59ddcfd12b0f1bcd736c607a39e1360c53b1345c..dd3a340059dfdd5df209536d43fe87796d0e2b53 100644 (file)
@@ -2308,6 +2308,10 @@ instead of copying files.  Such an operation is performed when building
 multilibs (@pxref{Multilibs}).  This file is maintained in the GCC
 tree at @url{http://gcc.gnu.org/svn.html}.
 
+@item test-driver
+This implements the default testsuite driver offered by the
+@option{parallel-tests} testsuite harness.
+
 @item texinfo.tex
 Not a program, this file is required for @samp{make dvi}, @samp{make
 ps} and @samp{make pdf} to work when Texinfo sources are in the
@@ -2901,12 +2905,24 @@ The Autoconf Manual}.
 @item AC_CONFIG_AUX_DIR
 Automake will look for various helper scripts, such as
 @file{install-sh}, in the directory named in this macro invocation.
-@c This list is accurate relative to version 1.8
-(The full list of scripts is: @file{ar-lib}, @file{config.guess},
-@file{config.sub}, @file{depcomp}, @file{elisp-comp}, @file{compile},
-@file{install-sh}, @file{ltmain.sh}, @file{mdate-sh}, @file{missing},
-@file{mkinstalldirs}, @file{py-compile}, @file{texinfo.tex}, and
-@file{ylwrap}.)  Not all scripts are always searched for; some scripts
+@c This list is accurate relative to version 1.11
+(The full list of scripts is:
+@file{ar-lib},
+@file{config.guess},
+@file{config.sub},
+@file{depcomp},
+@file{elisp-comp},
+@file{compile},
+@file{install-sh},
+@file{ltmain.sh},
+@file{mdate-sh},
+@file{missing},
+@file{mkinstalldirs},
+@file{py-compile},
+@file{test-driver},
+@file{texinfo.tex},
+@file{ylwrap}.)
+Not all scripts are always searched for; some scripts
 will only be sought if the generated @file{Makefile.in} requires them.
 
 If @code{AC_CONFIG_AUX_DIR} is not given, the scripts are looked for in
index 67a0747755cc5ce609bc203037f1bdb249b1941e..6ae57f18d75dced9b02a7809ae59a0625aa0b9ed 100644 (file)
@@ -75,11 +75,13 @@ DIST_SOURCES =
 # then this fails; a conservative approach.  Of course do not redirect
 # stdout here, just stderr.
 am__tty_colors = \
+am__color_tests=no; \
 red=; grn=; lgn=; blu=; std=; \
 test "X$(AM_COLOR_TESTS)" != Xno \
 && test "X$$TERM" != Xdumb \
 && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
 && { \
+  am__color_tests=yes; \
   red='\e[0;31m'; \
   grn='\e[0;32m'; \
   lgn='\e[1;32m'; \
@@ -107,9 +109,8 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-# Restructured Text title and section.
+# Restructured Text title.
 am__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
-am__rst_section = sed 'p;s/./=/g;p;g'
 # Put stdin (possibly several lines separated by ".  ") in a box.
 # Prefix each line by 'col' and terminate each with 'std', for coloring.
 # Multi line coloring is problematic with "less -R", so we really need
@@ -131,60 +132,46 @@ am__text_box = $(AWK) '{                  \
 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
 # by disabling -e (using the XSI extension "set +e") if it's set.
 am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to all log compiler wrappers.
+am__test_driver_flags = \
+  --test-name "$$f" \
+  --log-file '$@' \
+  --color-tests "$$am__color_tests" \
+  --enable-hard-errors "$$am__enable_hard_errors" \
+  --expect-failure "$$am__expect_failure"
 # To be inserted before the command running the test.  Creates the
 # directory for the log if needed.  Stores in $dir the directory
 # containing $f, in $tst the test, in $log the log.  Executes the
 # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
-# passes TESTS_ENVIRONMENT.  Saves and restores TERM around uses of
-# TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT, in case any of them
-# unsets it.
+# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
 am__check_pre = \
 $(am__sh_e_setup);                                     \
 $(am__vpath_adj_setup) $(am__vpath_adj)                        \
+$(am__tty_colors);                                     \
 srcdir=$(srcdir); export srcdir;                       \
-rm -f $@-t;                                            \
-am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \
-trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2;      \
-trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \
 am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;           \
 test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?;        \
 if test -f "./$$f"; then dir=./;                       \
 elif test -f "$$f"; then dir=;                         \
 else dir="$(srcdir)/"; fi;                             \
-tst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM;           \
-$(AM_TESTS_ENVIRONMENT)                                        \
-$(TESTS_ENVIRONMENT)
-# To be appended to the command running the test.  Handle the stdout
-# and stderr redirection, and catch the exit status.
-am__check_post = \
->$@-t 2>&1;                                            \
-estatus=$$?;                                           \
-if test -n '$(DISABLE_HARD_ERRORS)'                    \
-   && test $$estatus -eq 99; then                      \
-  estatus=1;                                           \
-fi;                                                    \
-TERM=$$__SAVED_TERM; export TERM;                      \
-$(am__tty_colors);                                     \
-xfailed=PASS;                                          \
+tst=$$dir$$f; log='$@';                                \
+if test -n '$(DISABLE_HARD_ERRORS)'; then              \
+  am__enable_hard_errors=no;                           \
+else                                                   \
+  am__enable_hard_errors=yes;                          \
+fi;                                                    \
 case " $(XFAIL_TESTS) " in                             \
   *[\ \        ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
-    xfailed=XFAIL;;                                    \
-esac;                                                  \
-case $$estatus.$$xfailed in                            \
-    0.XFAIL) col=$$red; res=XPASS;;                    \
-    0.*)     col=$$grn; res=PASS ;;                    \
-    77.*)    col=$$blu; res=SKIP ;;                    \
-    99.*)    col=$$red; res=FAIL ;;                    \
-    *.XFAIL) col=$$lgn; res=XFAIL;;                    \
-    *.*)     col=$$red; res=FAIL ;;                    \
-esac;                                                  \
-echo "$${col}$$res$${std}: $$f";                       \
-echo "$$res: $$f (exit: $$estatus)" |                  \
-  $(am__rst_section) >$@;                              \
-cat $@-t >>$@;                                         \
-rm -f $@-t
+    am__expect_failure=yes;;                           \
+  *)                                                   \
+    am__expect_failure=no;;                            \
+esac;                                                  \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
 RECHECK_LOGS = $(TEST_LOGS)
 AM_RECURSIVE_TARGETS = check check-html recheck recheck-html
+am__test_driver = $(SHELL) $(top_srcdir)/lib/test-driver
 TEST_SUITE_LOG = test-suite.log
 TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
 am__test_logs1 = $(TESTS:=.log)
@@ -479,7 +466,9 @@ recheck recheck-html:
        list=`echo "$$list" | sed 's/ *$$//'`;                          \
        $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"'
 .pl.log:
-       @p='$<'; $(am__check_pre) $(PL_LOG_COMPILE) "$$tst" $(am__check_post)
+       @p='$<'; $(am__check_pre) \
+       $(am__test_driver) $(am__test_driver_flags) -- \
+       $(PL_LOG_COMPILE) "$$tst"
 
 distdir: $(DISTFILES)
        @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
index 5bdc02e1390ef24c5751f4960231ff960a4e20df..a26d6633eeaf2033a6db57ab0b1aeb22b8525c6a 100644 (file)
@@ -29,7 +29,7 @@ dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
 scriptdir = $(pkgvdatadir)
 dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
   mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \
-  symlink-tree ar-lib
+  symlink-tree ar-lib test-driver
 
 EXTRA_DIST = gnupload
 
index 91e9baef9eaac53ef28bb89c2014baa24db5cde0..5f8aa913b202cad24afa92f43581e5dba4f13d80 100644 (file)
@@ -242,7 +242,7 @@ dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
 scriptdir = $(pkgvdatadir)
 dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
   mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \
-  symlink-tree ar-lib
+  symlink-tree ar-lib test-driver
 
 EXTRA_DIST = gnupload
 all: all-recursive
index 82ba7ce8c5ec94d0c36572d15515429e1b80c6e6..6ddf61f4c0c0cb5847940d1a4397452e1303dfa2 100644 (file)
@@ -20,11 +20,13 @@ if %?COLOR%
 # then this fails; a conservative approach.  Of course do not redirect
 # stdout here, just stderr.
 am__tty_colors = \
+am__color_tests=no; \
 red=; grn=; lgn=; blu=; std=; \
 test "X$(AM_COLOR_TESTS)" != Xno \
 && test "X$$TERM" != Xdumb \
 && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
 && { \
+  am__color_tests=yes; \
   red='\e[0;31m'; \
   grn='\e[0;32m'; \
   lgn='\e[1;32m'; \
@@ -32,8 +34,7 @@ test "X$(AM_COLOR_TESTS)" != Xno \
   std='\e[m'; \
 }
 else !%?COLOR%
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
+am__tty_colors = red= grn= lgn= blu= std= am__color_tests=no
 endif !%?COLOR%
 
 .PHONY: check-TESTS
@@ -70,9 +71,8 @@ include inst-vars.am
 ## test is XFAIL or not.  You can disable this feature by setting the
 ## variable DISABLE_HARD_ERRORS to a nonempty value.
 
-# Restructured Text title and section.
-am__rst_title   = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
-am__rst_section = sed 'p;s/./=/g;p;g'
+# Restructured Text title.
+am__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
 
 # Put stdin (possibly several lines separated by ".  ") in a box.
 # Prefix each line by 'col' and terminate each with 'std', for coloring.
@@ -97,59 +97,46 @@ am__text_box = $(AWK) '{                    \
 # by disabling -e (using the XSI extension "set +e") if it's set.
 am__sh_e_setup = case $$- in *e*) set +e;; esac
 
+# Default flags passed to all log compiler wrappers.
+am__test_driver_flags = \
+  --test-name "$$f" \
+  --log-file '$@' \
+  --color-tests "$$am__color_tests" \
+  --enable-hard-errors "$$am__enable_hard_errors" \
+  --expect-failure "$$am__expect_failure"
+
 # To be inserted before the command running the test.  Creates the
 # directory for the log if needed.  Stores in $dir the directory
 # containing $f, in $tst the test, in $log the log.  Executes the
 # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
-# passes TESTS_ENVIRONMENT.  Saves and restores TERM around uses of
-# TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT, in case any of them
-# unsets it.
+# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
 am__check_pre =                                                \
 $(am__sh_e_setup);                                     \
 $(am__vpath_adj_setup) $(am__vpath_adj)                        \
+$(am__tty_colors);                                     \
 srcdir=$(srcdir); export srcdir;                       \
-rm -f $@-t;                                            \
-am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \
-trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2;      \
-trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \
 am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;           \
 test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?;        \
 if test -f "./$$f"; then dir=./;                       \
 elif test -f "$$f"; then dir=;                         \
 else dir="$(srcdir)/"; fi;                             \
-tst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM;           \
-$(AM_TESTS_ENVIRONMENT)                                        \
-$(TESTS_ENVIRONMENT)
-
-# To be appended to the command running the test.  Handle the stdout
-# and stderr redirection, and catch the exit status.
-am__check_post =                                       \
->$@-t 2>&1;                                            \
-estatus=$$?;                                           \
-if test -n '$(DISABLE_HARD_ERRORS)'                    \
-   && test $$estatus -eq 99; then                      \
-  estatus=1;                                           \
-fi;                                                    \
-TERM=$$__SAVED_TERM; export TERM;                      \
-$(am__tty_colors);                                     \
-xfailed=PASS;                                          \
+tst=$$dir$$f; log='$@';                                \
+if test -n '$(DISABLE_HARD_ERRORS)'; then              \
+  am__enable_hard_errors=no;                           \
+else                                                   \
+  am__enable_hard_errors=yes;                          \
+fi;                                                    \
+## The use of $dir below is required to account for VPATH
+## rewriting done by Sun make.
 case " $(XFAIL_TESTS) " in                             \
   *[\ \        ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
-    xfailed=XFAIL;;                                    \
-esac;                                                  \
-case $$estatus.$$xfailed in                            \
-    0.XFAIL) col=$$red; res=XPASS;;                    \
-    0.*)     col=$$grn; res=PASS ;;                    \
-    77.*)    col=$$blu; res=SKIP ;;                    \
-    99.*)    col=$$red; res=FAIL ;;                    \
-    *.XFAIL) col=$$lgn; res=XFAIL;;                    \
-    *.*)     col=$$red; res=FAIL ;;                    \
-esac;                                                  \
-echo "$${col}$$res$${std}: $$f";                       \
-echo "$$res: $$f (exit: $$estatus)" |                  \
-  $(am__rst_section) >$@;                              \
-cat $@-t >>$@;                                         \
-rm -f $@-t
+    am__expect_failure=yes;;                           \
+  *)                                                   \
+    am__expect_failure=no;;                            \
+esac;                                                  \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
 
 $(TEST_SUITE_LOG): $(TEST_LOGS)
        @$(am__sh_e_setup);                                             \
index 054c62dd7345b8c96ee851a3f72a9b6caf94ef19..f3116c8d1e5585cbdf06857622aa90b717970cda 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -17,7 +17,9 @@
 ## From a test file to a log file.
 ?GENERIC?%EXT%.log:
 ?!GENERIC?%OBJ%: %SOURCE%
-       @p='%SOURCE%'; $(am__check_pre) %COMPILE% "$$tst" $(am__check_post)
+       @p='%SOURCE%'; $(am__check_pre) \
+       %DRIVER% $(am__test_driver_flags) -- \
+       %COMPILE% "$$tst"
 
 ## If no programs are built in this package, then this rule is removed
 ## at automake time.  Otherwise, %am__EXEEXT% expands to a configure time
@@ -25,5 +27,7 @@
 ## conflict with the previous one.
 if %am__EXEEXT%
 ?GENERIC?%EXT%$(EXEEXT).log:
-       @p='%SOURCE%'; $(am__check_pre) %COMPILE% "$$tst" $(am__check_post)
+       @p='%SOURCE%'; $(am__check_pre) \
+       %DRIVER% $(am__test_driver_flags) -- \
+       %COMPILE% "$$tst"
 endif %am__EXEEXT%
diff --git a/lib/test-driver b/lib/test-driver
new file mode 100755 (executable)
index 0000000..8753324
--- /dev/null
@@ -0,0 +1,129 @@
+#! /bin/sh
+# test-driver - basic driver script for the `parallel-tests' mode.
+
+scriptversion=2011-06-21.19; # UTC
+
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program 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 2, or (at your option)
+# any later version.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# Make unconditional expansion of undefined variables an error.  This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+fatal ()
+{
+  echo "$0: fatal: $*" >&2
+  exit 1
+}
+
+usage_error ()
+{
+  echo "$0: $*" >&2
+  print_usage >&2
+  exit 2
+}
+
+print_usage ()
+{
+  cat <<END
+Usage:
+  test-driver [--help|--version] --test-name=NAME --log-file=PATH
+              [--expect-failure={yes|no}] [--color-tests={yes|no}]
+              [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
+The \`--test-name' and \`--log-file' options are mandatory.
+END
+}
+
+# Restructured Text section.
+rst_section () { sed 'p;s/./=/g;p;g'; }
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $logfile and $test_name are defined).
+test_name= # Used for reporting.
+logfile=   # Where to save the result and output of the test script.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+  case $1 in
+  --help) print_usage; exit $?;;
+  --version) echo "test-driver $scriptversion"; exit $?;;
+  --test-name) test_name=$2; shift;;
+  --log-file) logfile=$2; shift;;
+  --color-tests) color_tests=$2; shift;;
+  --expect-failure) expect_failure=$2; shift;;
+  --enable-hard-errors) enable_hard_errors=$2; shift;;
+  --) shift; break;;
+  -*) usage_error "invalid option: '$1'";;
+  esac
+  shift
+done
+
+if test $color_tests = yes; then
+  red='\e[0;31m' # Red.
+  grn='\e[0;32m' # Green.
+  lgn='\e[1;32m' # Light green.
+  blu='\e[1;34m' # Blue.
+  std='\e[m'     # No color.
+else
+  red= grn= lgn= blu= std=
+fi
+
+tmpfile=$logfile-t
+do_exit='rm -f $tmpfile; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+rm -f $tmpfile
+
+# Test script is run here.
+"$@" >$tmpfile 2>&1
+estatus=$?
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+  estatus=1
+fi
+
+case $estatus:$expect_failure in
+  0:yes) col=$red; res=XPASS;;
+  0:*)   col=$grn; res=PASS ;;
+  77:*)  col=$blu; res=SKIP ;;
+  99:*)  col=$red; res=FAIL ;;
+  *:yes) col=$lgn; res=XFAIL;;
+  *:*)   col=$red; res=FAIL ;;
+esac
+echo "${col}${res}${std}: $test_name"
+echo "$res: $test_name (exit: $estatus)" | rst_section > $logfile
+cat $tmpfile >> $logfile
+rm -f $tmpfile
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
index 6060a6215341655c4c40ad503830f6610f5bd1cb..db43a41f946fd2cfd671f21b2c715df9a5aff8ff 100644 (file)
@@ -235,6 +235,7 @@ check12.test \
 check-exported-srcdir.test \
 check-tests-in-builddir.test \
 check-tests_environment.test \
+check-no-test-driver.test \
 checkall.test \
 clean.test \
 clean2.test \
@@ -722,6 +723,7 @@ parallel-tests-unreadable-log.test \
 parallel-tests-subdir.test \
 parallel-tests-interrupt.test \
 parallel-tests-reset-term.test \
+parallel-test-driver-install.test \
 parse.test \
 percent.test \
 percent2.test \
index 3b7a63e90489f829b07f52aa322bcbcd5267eb55..24c50856146201965845c219af67bfb54bf790f4 100644 (file)
@@ -80,11 +80,13 @@ DIST_SOURCES =
 # then this fails; a conservative approach.  Of course do not redirect
 # stdout here, just stderr.
 am__tty_colors = \
+am__color_tests=no; \
 red=; grn=; lgn=; blu=; std=; \
 test "X$(AM_COLOR_TESTS)" != Xno \
 && test "X$$TERM" != Xdumb \
 && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
 && { \
+  am__color_tests=yes; \
   red='\e[0;31m'; \
   grn='\e[0;32m'; \
   lgn='\e[1;32m'; \
@@ -112,9 +114,8 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-# Restructured Text title and section.
+# Restructured Text title.
 am__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
-am__rst_section = sed 'p;s/./=/g;p;g'
 # Put stdin (possibly several lines separated by ".  ") in a box.
 # Prefix each line by 'col' and terminate each with 'std', for coloring.
 # Multi line coloring is problematic with "less -R", so we really need
@@ -136,60 +137,46 @@ am__text_box = $(AWK) '{                  \
 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
 # by disabling -e (using the XSI extension "set +e") if it's set.
 am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to all log compiler wrappers.
+am__test_driver_flags = \
+  --test-name "$$f" \
+  --log-file '$@' \
+  --color-tests "$$am__color_tests" \
+  --enable-hard-errors "$$am__enable_hard_errors" \
+  --expect-failure "$$am__expect_failure"
 # To be inserted before the command running the test.  Creates the
 # directory for the log if needed.  Stores in $dir the directory
 # containing $f, in $tst the test, in $log the log.  Executes the
 # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
-# passes TESTS_ENVIRONMENT.  Saves and restores TERM around uses of
-# TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT, in case any of them
-# unsets it.
+# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
 am__check_pre = \
 $(am__sh_e_setup);                                     \
 $(am__vpath_adj_setup) $(am__vpath_adj)                        \
+$(am__tty_colors);                                     \
 srcdir=$(srcdir); export srcdir;                       \
-rm -f $@-t;                                            \
-am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \
-trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2;      \
-trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \
 am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;           \
 test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?;        \
 if test -f "./$$f"; then dir=./;                       \
 elif test -f "$$f"; then dir=;                         \
 else dir="$(srcdir)/"; fi;                             \
-tst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM;           \
-$(AM_TESTS_ENVIRONMENT)                                        \
-$(TESTS_ENVIRONMENT)
-# To be appended to the command running the test.  Handle the stdout
-# and stderr redirection, and catch the exit status.
-am__check_post = \
->$@-t 2>&1;                                            \
-estatus=$$?;                                           \
-if test -n '$(DISABLE_HARD_ERRORS)'                    \
-   && test $$estatus -eq 99; then                      \
-  estatus=1;                                           \
-fi;                                                    \
-TERM=$$__SAVED_TERM; export TERM;                      \
-$(am__tty_colors);                                     \
-xfailed=PASS;                                          \
+tst=$$dir$$f; log='$@';                                \
+if test -n '$(DISABLE_HARD_ERRORS)'; then              \
+  am__enable_hard_errors=no;                           \
+else                                                   \
+  am__enable_hard_errors=yes;                          \
+fi;                                                    \
 case " $(XFAIL_TESTS) " in                             \
   *[\ \        ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
-    xfailed=XFAIL;;                                    \
-esac;                                                  \
-case $$estatus.$$xfailed in                            \
-    0.XFAIL) col=$$red; res=XPASS;;                    \
-    0.*)     col=$$grn; res=PASS ;;                    \
-    77.*)    col=$$blu; res=SKIP ;;                    \
-    99.*)    col=$$red; res=FAIL ;;                    \
-    *.XFAIL) col=$$lgn; res=XFAIL;;                    \
-    *.*)     col=$$red; res=FAIL ;;                    \
-esac;                                                  \
-echo "$${col}$$res$${std}: $$f";                       \
-echo "$$res: $$f (exit: $$estatus)" |                  \
-  $(am__rst_section) >$@;                              \
-cat $@-t >>$@;                                         \
-rm -f $@-t
+    am__expect_failure=yes;;                           \
+  *)                                                   \
+    am__expect_failure=no;;                            \
+esac;                                                  \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
 RECHECK_LOGS = $(TEST_LOGS)
 AM_RECURSIVE_TARGETS = check check-html recheck recheck-html
+am__test_driver = $(SHELL) $(top_srcdir)/lib/test-driver
 TEST_SUITE_LOG = test-suite.log
 TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
 TEST_EXTENSIONS = .test
@@ -508,6 +495,7 @@ check12.test \
 check-exported-srcdir.test \
 check-tests-in-builddir.test \
 check-tests_environment.test \
+check-no-test-driver.test \
 checkall.test \
 clean.test \
 clean2.test \
@@ -995,6 +983,7 @@ parallel-tests-unreadable-log.test \
 parallel-tests-subdir.test \
 parallel-tests-interrupt.test \
 parallel-tests-reset-term.test \
+parallel-test-driver-install.test \
 parse.test \
 percent.test \
 percent2.test \
@@ -1508,7 +1497,9 @@ recheck recheck-html:
        list=`echo "$$list" | sed 's/ *$$//'`;                          \
        $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"'
 .test.log:
-       @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
+       @p='$<'; $(am__check_pre) \
+       $(am__test_driver) $(am__test_driver_flags) -- \
+       $(TEST_LOG_COMPILE) "$$tst"
 
 distdir: $(DISTFILES)
        @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
diff --git a/tests/check-no-test-driver.test b/tests/check-no-test-driver.test
new file mode 100755 (executable)
index 0000000..fc1e89b
--- /dev/null
@@ -0,0 +1,34 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program 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 2, or (at your option)
+# any later version.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that auxiliary script 'test-driver' doesn't get needlessly
+# installed or referenced when the 'parallel-tests' option is not
+# used.
+
+parallel_tests=no
+. ./defs || Exit 1
+
+echo 'TESTS = foo.test' > Makefile.am
+
+$ACLOCAL
+
+for opts in '' '-a' '--add-missing --copy'; do
+  $AUTOMAKE $opts
+  $FGREP 'test-driver' Makefile.in && Exit 1
+  find . | $FGREP 'test-driver' && Exit 1
+done
+
+:
index 54432eca9c590d3bf473fe3423a2b3566d38f430..caacf7845d6acc63755ecd97ce871b3b74b098e7 100755 (executable)
@@ -22,6 +22,8 @@ cat > Makefile.am << 'END'
 TESTS = frob.test
 END
 
+test x"$parallel_tests" != x"yes" || : > test-driver
+
 : > frob.test
 
 $ACLOCAL
index 7025b98633939caad97949933d725d5488bad3fd..ef799691d4ee018f0fc094957f3fe5531f8fc92d 100755 (executable)
@@ -50,7 +50,7 @@ cp skip skip2
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -a
 
 ./configure
 (
index 9b8bfb1b5ac2c29913942c2dc451c1343899ca10..56e2614b890e325afaf87f6bcad932fe3335f014 100755 (executable)
@@ -43,6 +43,10 @@ echo.sh:
 CLEANFILES = echo.sh
 END
 
+if test x"$parallel_tests" = x"yes"; then
+  cp "$top_testsrcdir"/lib/test-driver .
+fi
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
index be40e3faebc65a9baf8cadc507b2b81713ad4c44..ccfb9236da8fcffece3102fe98366fd1120dadfd 100755 (executable)
@@ -54,7 +54,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -a
 ./configure --prefix "`pwd`/inst"
 $MAKE check >stdout
 cat stdout
index 99adb23b7b4df0515566acdf87ad4b2b769f9f2f..7c40c0c0b65f6c8a1140e1635ee9bfe93adcb029 100755 (executable)
@@ -46,8 +46,10 @@ chmod +x ok.sh dir/fail.sh
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --add-missing
+
 ./configure --prefix "`pwd`/inst"
+
 $MAKE check >stdout && { cat stdout; Exit 1; }
 cat stdout
 grep 'FAIL: fail.sh' stdout
index 570b21d6674629bdc80487269c2b25a1952b6cc9..ecd4f94d04d4c87981cc2bf5ffbe92608d3caa74 100755 (executable)
@@ -67,8 +67,9 @@ cp pass xpass
 chmod +x pass fail skip xpass xfail
 
 $ACLOCAL
-$AUTOMAKE
 $AUTOCONF
+$AUTOMAKE --add-missing
+
 ./configure
 
 test_color ()
@@ -95,3 +96,5 @@ test_no_color ()
 AM_COLOR_TESTS=always $MAKE -e check >stdout && { cat stdout; Exit 1; }
 cat stdout
 test_color
+
+:
index eb9c52788b600ba9e532ce442005c064293083e2..4f8862e20bb400cccba35ae137a15ff563bf1063 100755 (executable)
@@ -80,7 +80,7 @@ cp pass xpass
 chmod +x pass fail skip xpass xfail
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -a
 $AUTOCONF
 ./configure
 
@@ -120,3 +120,5 @@ AM_COLOR_TESTS=no MAKE=$MAKE expect -f expect-make >stdout \
   || { cat stdout; Exit 1; }
 cat stdout
 test_no_color
+
+:
index e95d99be02460570a5c18ace22a9fbbc6e146e33..e20b59f9ed71e6b0638e9c7c9d59e985068a8e7e 100755 (executable)
@@ -30,6 +30,8 @@ TESTS = \
    7.test
 EOF
 
+: > test-driver
+
 $ACLOCAL
 $AUTOMAKE
 
index df385b0336b6d132fcb3118035742f7377e2373f..fe994b5d9c0190ec34136f861899e1dad86092ea 100755 (executable)
@@ -25,6 +25,8 @@ AUTOMAKE_OPTIONS = dejagnu
 TESTS = frob.test
 END
 
+test x"$parallel_tests" != x"yes" || : > test-driver
+
 $ACLOCAL
 $AUTOMAKE
 
index c3f968c420add1afa342c1f775b317220c2d4e56..2ec3bca61b4af5707b6f291de6640a7c6dee2ef3 100755 (executable)
@@ -50,7 +50,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --add-missing --copy
 ./configure
 $MAKE print-bin > output
 cat output
index 5a77f1a507b0d071fd556c6e947e6c1c68254116..eb54d35e2e73859e752443bcf8f0845530fd2d75 100755 (executable)
@@ -149,7 +149,7 @@ check_targets ()
   done
 }
 
-$AUTOMAKE -Wno-override
+$AUTOMAKE -a -Wno-override
 ./configure
 check_targets || Exit 1
 
index 5c21943714b0ae491faebcff6d8e9cbb75f95f87..4a11910940187825cd9174b834b0ea8d5d3e0c20 100755 (executable)
@@ -154,7 +154,7 @@ check_targets ()
   done
 }
 
-$AUTOMAKE -Wno-override
+$AUTOMAKE -a -Wno-override
 ./configure
 check_targets || Exit 1
 
diff --git a/tests/parallel-test-driver-install.test b/tests/parallel-test-driver-install.test
new file mode 100755 (executable)
index 0000000..10455fb
--- /dev/null
@@ -0,0 +1,93 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program 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 2, or (at your option)
+# any later version.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that auxiliary script 'test-driver' gets automatically installed
+# in the correct directory by 'parallel-tests' option.
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+: Try first with parallel-tests defined in AM_INIT_AUTOMAKE.
+
+mkdir am-init-automake
+cd am-init-automake
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([my_aux_dir])
+AM_INIT_AUTOMAKE([parallel-tests])
+AC_CONFIG_FILES([Makefile sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub my_aux_dir
+
+cat > Makefile.am <<END
+SUBDIRS = sub
+TESTS = foo.test
+END
+
+cat > sub/Makefile.am <<END
+TESTS = bar.test
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+ls -l . sub my_aux_dir # For debugging.
+test -f my_aux_dir/test-driver
+test ! -r test-driver
+test ! -r sub/test-driver
+
+grep '^configure\.in:3:.*installing.*my_aux_dir/test-driver' stderr
+
+cd ..
+
+: Now try with parallel-tests defined in AUTOMAKE_OPTIONS.
+
+mkdir automake-options
+cd automake-options
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([dir/GNUmakefile])
+AC_OUTPUT
+END
+
+mkdir build-aux dir
+
+cat > dir/GNUmakefile.am <<END
+TESTS = foo.test
+AUTOMAKE_OPTIONS = parallel-tests
+TESTS += bar.test
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing --copy dir/GNUmakefile 2>stderr \
+  || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+ls -l . dir build-aux # For debugging.
+test -f build-aux/test-driver
+test ! -r test-driver
+test ! -r dir/test-driver
+
+grep '^dir/GNUmakefile\.am:2:.*installing.*build-aux/test-driver' stderr
+
+:
index 45e55d4ae021a3b264f6cafa9376bc91af156ab5..1c5d9ce0557d42a1ec53da502fb8842d07460a45 100755 (executable)
@@ -28,12 +28,20 @@ END
 
 cat > Makefile.am << 'END'
 TESTS = foo.test
-## Ugly, but required by foo.test.  See below.
-TEST_LOG_COMPILER = echo $$$$ > pid && exec 9>&2 && $(SHELL) -x
+## Provide more debugging info.
+TEST_LOG_COMPILER = $(SHELL) -x
+## Rut required by foo.test; see below.
+AM_TESTS_ENVIRONMENT = 9>&2
 END
 
 # This is hacky and ugly, but has the great advantage of avoiding us a lot
 # of pain with background processes and related synchronization issues.
+
+cat - "$top_testsrcdir"/lib/test-driver > test-driver <<'END'
+#!/bin/sh
+echo $$ > pid
+END
+
 cat > foo.test << 'END'
 #!/bin/sh
 exec 2>&9
@@ -48,7 +56,7 @@ chmod a+x foo.test
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE
 
 ./configure
 
@@ -60,6 +68,8 @@ for signum in $trapped_signals; do
   rm -f pid fail *.log *.log-t
   env signum=$signum $MAKE check && { ls -l; Exit 1; }
   ls -l
+  # These files shouldn't exist, but in case they do, their content might
+  # provide helpful information about the causes of the failure(s).
   cat foo.log-t || :
   cat foo.log || :
   cat test-suite.log || :
index 26ae69fa51290dfc232b117b0206f10898351680..3f45c72ce75af1ce8aef3b9ad4c23237cc1d7a3b 100755 (executable)
@@ -50,7 +50,7 @@ chmod +x foo1.test bary
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -a
 
 ./configure
 $MAKE check >out 2>&1 && { cat out; Exit 1; }
index c3c2e29a931d26a9eba355fa0cb65cafaf3a6ae8..13999d9aafaf94188cb99f44332f9b9f1699c3a2 100755 (executable)
@@ -58,7 +58,7 @@ int main (void)
 }
 END
 
-cp $testsrcdir/../lib/compile .
+cp "$top_testsrcdir"/lib/compile "$top_testsrcdir"/lib/test-driver .
 
 $ACLOCAL
 $AUTOMAKE --foreign --foreign -Wall 2>stderr || { cat stderr >&2; Exit 1; }