From: Ralf Wildenhues Date: Sun, 8 Mar 2009 13:04:38 +0000 (+0100) Subject: parallel-tests: Ensure backward-compatible semantics. X-Git-Tag: v1.10b~6^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c33683f0f738bb418d1d8548075065fe943ffb71;p=thirdparty%2Fautomake.git 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. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index edbaaa6f8..265a26140 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2009-03-08 Ralf Wildenhues + + 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 Jim Meyering Benoit Sigoure diff --git a/bootstrap b/bootstrap index 8437d116d..cb563ca45 100755 --- 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 diff --git a/tests/.gitignore b/tests/.gitignore index a6827fdee..cfd45650c 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,6 +1,9 @@ aclocal-* automake-* defs +defs-p +parallel-tests.am *.dir *.log *.log-t +*-p.test diff --git a/tests/Makefile.am b/tests/Makefile.am index 2a21be523..fbb611871 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/Makefile.in b/tests/Makefile.in index 8a197c480..d6427a2a7 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..2ee1145b1 --- /dev/null +++ b/tests/check11.test @@ -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 . + +# 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 + +: diff --git a/tests/check8.test b/tests/check8.test index 242be5627..3e38ccf91 100755 --- a/tests/check8.test +++ b/tests/check8.test @@ -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 diff --git a/tests/defs.in b/tests/defs.in index d50d34510..8a089981d 100644 --- a/tests/defs.in +++ b/tests/defs.in @@ -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 index 000000000..4a71a738d --- /dev/null +++ b/tests/gen-parallel-tests @@ -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,$, \\,' +}