]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
parallel-tests: Ensure backward-compatible semantics.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 8 Mar 2009 13:04:38 +0000 (14:04 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 14 Mar 2009 09:48:45 +0000 (10:48 +0100)
For each test in Automake's test suite that uses TESTS, generate
an identical one that uses the `parallel-tests' option, for
coverage of backward-compatible functionality.

* tests/gen-parallel-tests: New file, generates distributed
Makefile.am snippet tests/parallel-tests.am to list all tests
that use the TESTS interface but not yet the `parallel-tests'
option, with names mangled to use suffix `-p.test', in ...
(parallel_tests): ... this new make macro.
* tests/Makefile.am ($(srcdir)/parallel-tests.am)
($(parallel_tests), defs-p): New rules.
(TESTS): Add check11.test and $(parallel_tests).
(check_SCRIPTS): Add defs-p, $(parallel_tests).
(check-clean-local): Remove `defs-p'.
(EXTRA_DIST): Distribute gen-parallel-tests.
(MAINTAINERCLEANFILES): New variable, remove $(parallel_tests).
* bootstrap: Generate parallel-tests.am.
* tests/check8.test: Check for circular dependencies in rules.
* tests/check11.test: New test, check that SKIPs are not counted
as passed tests.
* tests/defs.in: Unset DISABLE_HARD_ERRORS, LAZY_TEST_SUITE,
VERBOSE, so the tests are not influenced by the way our test
suite is invoked.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
bootstrap
tests/.gitignore
tests/Makefile.am
tests/Makefile.in
tests/check11.test [new file with mode: 0755]
tests/check8.test
tests/defs.in
tests/gen-parallel-tests [new file with mode: 0755]

index edbaaa6f821bd4ec53b3e95a6f2df88dd88e2842..265a26140bd0346ee22b9d630a969d201380fd00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2009-03-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       parallel-tests: Ensure backward-compatible semantics.
+       For each test in Automake's test suite that uses TESTS, generate
+       an identical one that uses the `parallel-tests' option, for
+       coverage of backward-compatible functionality.
+       * tests/gen-parallel-tests: New file, generates distributed
+       Makefile.am snippet tests/parallel-tests.am to list all tests
+       that use the TESTS interface but not yet the `parallel-tests'
+       option, with names mangled to use suffix `-p.test', in ...
+       (parallel_tests): ... this new make macro.
+       * tests/Makefile.am ($(srcdir)/parallel-tests.am)
+       ($(parallel_tests), defs-p): New rules.
+       (TESTS): Add check11.test and $(parallel_tests).
+       (check_SCRIPTS): Add defs-p, $(parallel_tests).
+       (check-clean-local): Remove `defs-p'.
+       (EXTRA_DIST): Distribute gen-parallel-tests.
+       (MAINTAINERCLEANFILES): New variable, remove $(parallel_tests).
+       * bootstrap: Generate parallel-tests.am.
+       * tests/check8.test: Check for circular dependencies in rules.
+       * tests/check11.test: New test, check that SKIPs are not counted
+       as passed tests.
+       * tests/defs.in: Unset DISABLE_HARD_ERRORS, LAZY_TEST_SUITE,
+       VERBOSE, so the tests are not influenced by the way our test
+       suite is invoked.
+
 2009-03-08  Akim Demaille  <akim@lrde.epita.fr>
            Jim Meyering  <jim@meyering.net>
            Benoit Sigoure  <tsuna@lrde.epita.fr>
index 8437d116d441172f422c94da8212c30d4d8b63b4..cb563ca45e2217d2f33d11f33985af0e59c6a58c 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -124,6 +124,11 @@ dosubst m4/amversion.in m4/amversion.m4
 # Create temporary replacement for automake
 dosubst automake.in automake.tmp
 
+# Create tests/parallel-tests.am.
+cd tests
+$BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
+cd ..
+
 # Run the autotools.
 $PERL ./aclocal.tmp -I m4
 autoconf
index a6827fdeec43b81d96925f30afcb3423d2a1126d..cfd45650c33a09892540de8101fe14c153fc32a8 100644 (file)
@@ -1,6 +1,9 @@
 aclocal-*
 automake-*
 defs
+defs-p
+parallel-tests.am
 *.dir
 *.log
 *.log-t
+*-p.test
index 2a21be523183c676d9ab67d5fe543bd5b9d8d85b..fbb61187115a5f4ff7e430350834d9479c2bb503 100644 (file)
@@ -1,12 +1,27 @@
 ## Process this file with automake to create Makefile.in
 AUTOMAKE_OPTIONS = parallel-tests
 
-XFAIL_TESTS =                                  \
+XFAIL_TESTS =                                  \
 all.test                                       \
 auxdir2.test                                   \
 cond17.test                                    \
 txinfo5.test
 
+include $(srcdir)/parallel-tests.am
+
+$(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
+       (cd $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@
+
+$(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
+       input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
+       sed 's,^\. \./defs,. ./defs-p,' < $(srcdir)/$$input > $@
+       chmod a+rx $@
+
+MAINTAINERCLEANFILES = $(parallel_tests)
+
+defs-p: defs Makefile.am
+       sed 's,^AM_INIT_AUTOMAKE$$,&([parallel-tests]),' < defs >$@
+
 TESTS =        \
 aclibobj.test \
 aclocal.test \
@@ -98,6 +113,7 @@ check7.test \
 check8.test \
 check9.test \
 check10.test \
+check11.test \
 checkall.test \
 clean.test \
 clean2.test \
@@ -676,15 +692,16 @@ yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccpp.test \
-yaccvpath.test
+yaccvpath.test \
+$(parallel_tests)
 
-EXTRA_DIST = ChangeLog-old $(TESTS)
+EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
 # Each test case depends on defs, aclocal, and automake.
-check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
+check_SCRIPTS = defs defs-p aclocal-$(APIVERSION) automake-$(APIVERSION) $(parallel_tests)
 
 clean-local: check-clean-local
 
 check-clean-local:
        -chmod -R u+rwx *.dir
-       -rm -rf *.dir
+       -rm -rf defs-p *.dir
index 8a197c480ca30a1c328d93f58c6d45440e79c5a7..d6427a2a7562cc7b78376707e937b913fb4c5d08 100644 (file)
@@ -32,9 +32,10 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
-subdir = tests
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-       $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs.in
+       $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs.in \
+       $(srcdir)/parallel-tests.am
+subdir = tests
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
        $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
@@ -223,6 +224,29 @@ auxdir2.test                                       \
 cond17.test                                    \
 txinfo5.test
 
+parallel_tests = \
+check-p.test \
+check10-p.test \
+check11-p.test \
+check2-p.test \
+check3-p.test \
+check4-p.test \
+check5-p.test \
+check6-p.test \
+check7-p.test \
+check8-p.test \
+check9-p.test \
+color-p.test \
+comment9-p.test \
+dejagnu-p.test \
+exeext4-p.test \
+maken3-p.test \
+maken4-p.test \
+pr401-p.test \
+pr401b-p.test \
+pr401c-p.test
+
+MAINTAINERCLEANFILES = $(parallel_tests)
 TESTS = \
 aclibobj.test \
 aclocal.test \
@@ -314,6 +338,7 @@ check7.test \
 check8.test \
 check9.test \
 check10.test \
+check11.test \
 checkall.test \
 clean.test \
 clean2.test \
@@ -892,17 +917,18 @@ yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccpp.test \
-yaccvpath.test
+yaccvpath.test \
+$(parallel_tests)
 
-EXTRA_DIST = ChangeLog-old $(TESTS)
+EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
 # Each test case depends on defs, aclocal, and automake.
-check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
+check_SCRIPTS = defs defs-p aclocal-$(APIVERSION) automake-$(APIVERSION) $(parallel_tests)
 all: all-am
 
 .SUFFIXES:
 .SUFFIXES: .html .log .test
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -1148,6 +1174,7 @@ distclean-generic:
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-am
 
 clean-am: clean-generic clean-local mostlyclean-am
@@ -1228,11 +1255,22 @@ uninstall-am:
        pdf-am ps ps-am uninstall uninstall-am
 
 
+$(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
+       (cd $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@
+
+$(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
+       input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
+       sed 's,^\. \./defs,. ./defs-p,' < $(srcdir)/$$input > $@
+       chmod a+rx $@
+
+defs-p: defs Makefile.am
+       sed 's,^AM_INIT_AUTOMAKE$$,&([parallel-tests]),' < defs >$@
+
 clean-local: check-clean-local
 
 check-clean-local:
        -chmod -R u+rwx *.dir
-       -rm -rf *.dir
+       -rm -rf defs-p *.dir
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/tests/check11.test b/tests/check11.test
new file mode 100755 (executable)
index 0000000..2ee1145
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 2009  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 3, 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 skip summary.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = skip skip2
+END
+
+cat >>skip <<'END'
+#! /bin/sh
+exit 77
+END
+chmod a+x skip
+cp skip skip2
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+unset TESTS || :
+
+./configure
+env TESTS=skip $MAKE -e check >stdout
+cat stdout
+grep '1.*passed' stdout && Exit 1
+
+env TESTS="skip skip2" $MAKE -e check >stdout
+cat stdout
+grep '2.*passed' stdout && Exit 1
+
+:
index 242be5627bcb1682f0a60fd1a796e6e7dd70a4c6..3e38ccf914dad65502898c07146ca5cc7c71670a 100755 (executable)
@@ -67,14 +67,20 @@ $AUTOMAKE -a
 unset TESTS || :
 
 ./configure
-AM_COLOR_TESTS=always $MAKE -e check >stdout && { cat stdout; Exit 1; }
+AM_COLOR_TESTS=always $MAKE -e check >stdout 2>stderr &&
+  { cat stdout; cat stderr >&2; Exit 1; }
 cat stdout
+cat stderr >&2
 grep 'XPASS.* foo$' stdout
 grep '^[^X]*PASS.* sub/foo$' stdout
 grep '^[^X]*PASS.* bar$' stdout
 grep '^[^X]*PASS.* sub/bar$' stdout
 grep '^[^X]*FAIL.* baz$' stdout
 grep 'XFAIL.* sub/baz$' stdout
+# parallel-tests should not add circular dependencies.
+# Look for known warnings from a couple of `make' implementations.
+grep -i 'circular.*dependency' stderr && Exit 1
+grep -i 'graph cycles' stderr && Exit 1
 
 $MAKE distclean
 
index d50d345107d606b6d756276cfeb26950ece1fbdd..8a089981d5b1a13f2dce21b8b44ebddea5e31856 100644 (file)
@@ -284,6 +284,13 @@ unset MFLAGS
 unset MAKEFLAGS
 unset MAKELEVEL
 unset DESTDIR
+# Also unset variables that control our test driver.  While not
+# conceptually independent, they cause some changed semantics we
+# need to control (and test for) in some of the tests to ensure
+# backward-compatible behavior.
+unset DISABLE_HARD_ERRORS
+unset LAZY_TEST_SUITE
+unset VERBOSE
 
 echo "=== Running test $0"
 
diff --git a/tests/gen-parallel-tests b/tests/gen-parallel-tests
new file mode 100755 (executable)
index 0000000..4a71a73
--- /dev/null
@@ -0,0 +1,26 @@
+#! /bin/sh
+# Generate parallel-tests.am.
+#
+# For each test in the TESTS list in this Makefile.am file, that itself
+# tests features of the TESTS automake interface, generate a sibling
+# test that does likewise, but with the option `parallel-tests' enabled.
+
+set -e
+
+tests=`sed -n '/^TESTS =/,/^$/s/\(.*\.test\).*/\1/p' Makefile.am`
+{
+  grep -l '^TESTS ' $tests
+  grep -l ' TESTS ' $tests
+} |
+grep -v '.-p\.test' |
+LC_ALL=C sort -u |
+while read tst; do
+  if grep '^[^#]*parallel-tests' $tst >/dev/null \
+     || grep '^\. \./defs-p' $tst >/dev/null
+  then :; else echo $tst; fi;
+done |
+{
+  echo "## Generated by gen-parallel-tests.  Edit Makefile.am instead of this."
+  echo "parallel_tests = \\"
+  sed 's,\.test$,-p.test,; $!s,$, \\,'
+}