+2011-06-01 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ testsuite: avoid generating `*-p.test' tests, use a wrapper script
+ The generated `*-p.test' tests had already become just thin layers
+ around the corresponding test scripts. This change makes the final
+ step, converting to the use of a generic wrapper script and thus
+ avoiding the extra test generation (similarly to what is done for
+ the `*.instspc' and `*.depmod' tests).
+ * tests/parallel-tests.sh: New file, driver script to run checks
+ the on the `parallel-tests' semantics by wrapping tests that use
+ the generic "Simple Tests" driver.
+ * tests/gen-parallel-tests: Update, mostly to reflect the new
+ `.ptest' extensions used for tests in $(parallel_tests).
+ * Makefile.am (TESTS_EXTENSIONS): Add `.ptest'.
+ (PTEST_LOG_COMPILER): Define, it calls `parallel-tests.sh'.
+ ($(parallel_tests)): Do not really generate `*-p.test' tests
+ anymore; this is now just a dummy dependency declaration required
+ in order to have make actually produce expected log files from
+ the `.ptest.log' suffix rule.
+ (EXTRA_DIST): Distribute `parallel-tests.sh'.
+ (MAINTAINERCLEANFILES): Don't remove the `$(parallel_tests)', it
+ is not necessary anymore.
+ (generated_tests): Variable definition removed.
+ (TESTS): Update, by listing `$(parallel_tests)' directly instead
+ of `$(generated_tests)'
+ (expected_list_of_tests): Remove `$(generated_tests)'.
+ (maintainer-check-list-of-tests): No need to explicitly depend on
+ `$(expected_list_of_tests)' anymore.
+
2011-05-29 Stefano Lattarini <stefano.lattarini@gmail.com>
automake, aclocal: honour configure-time AUTOCONF and AUTOM4TE
$(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
$(AM_V_GEN)($(am__cd) $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@
+EXTRA_DIST += gen-parallel-tests
-$(parallel_tests): Makefile.am
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
- { echo '#!/bin/sh'; \
- echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
- echo; \
- echo '# Ensure proper definition of $$testsrcdir.'; \
- echo '. ./defs-static || exit 99'; \
- echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \
- echo; \
- echo "# Run the test with Automake's parallel-tests driver enabled."; \
- echo 'parallel_tests=yes'; \
- echo "# In the spirit of VPATH, we prefer a test in the build tree"; \
- echo "# over one in the source tree."; \
- echo "if test -f \"./$$input\"; then"; \
- echo " . \"./$$input\""; \
- echo 'else'; \
- echo " . \"\$$testsrcdir/$$input\""; \
- echo 'fi'; \
- } > $@-t
- $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@
+TEST_EXTENSIONS += .ptest
+PTEST_LOG_COMPILER = $(SHELL) $(srcdir)/parallel-tests.sh
+EXTRA_DIST += parallel-tests.sh
-MAINTAINERCLEANFILES += $(parallel_tests)
-EXTRA_DIST += gen-parallel-tests
+# All `*-p.ptest' tests work by sourcing the script `parallel-tests.sh'.
+$(parallel_tests:.ptest=.log): parallel-tests.sh
+# This dummy declaration is required to have make actually produce
+# expected log files from the `.ptest.log' suffix rule.
+$(parallel_tests):
include $(srcdir)/instspc-tests.am
TESTS = \
$(handwritten_tests) \
- $(generated_tests) \
+ $(parallel_tests) \
$(depmod_tests) \
$(instspc_tests)
-EXTRA_DIST += $(handwritten_tests) $(generated_tests)
-
-generated_tests = $(parallel_tests)
+EXTRA_DIST += $(handwritten_tests)
handwritten_tests = \
aclocal.test \
## Checking the test of tests.
checked_test_extensions = .test
-expected_list_of_tests = $(handwritten_tests) $(generated_tests)
+expected_list_of_tests = $(handwritten_tests)
include $(top_srcdir)/CheckListOfTests.am
-maintainer-check-list-of-tests: $(expected_list_of_tests)
# Dependencies valid for each test case.
$(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
am__test_logs2 = $(am__test_logs1:.test.log=.log)
TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
$(TEST_LOG_FLAGS)
-am__test_logs3 = $(am__test_logs2:.instspc.log=.log)
+am__test_logs3 = $(am__test_logs2:.ptest.log=.log)
+PTEST_LOG_COMPILE = $(PTEST_LOG_COMPILER) $(AM_PTEST_LOG_FLAGS) \
+ $(PTEST_LOG_FLAGS)
+am__test_logs4 = $(am__test_logs3:.instspc.log=.log)
INSTSPC_LOG_COMPILE = $(INSTSPC_LOG_COMPILER) $(AM_INSTSPC_LOG_FLAGS) \
$(INSTSPC_LOG_FLAGS)
-TEST_LOGS = $(am__test_logs3:.depmod.log=.log)
+TEST_LOGS = $(am__test_logs4:.depmod.log=.log)
DEPMOD_LOG_COMPILE = $(DEPMOD_LOG_COMPILER) $(AM_DEPMOD_LOG_FLAGS) \
$(DEPMOD_LOG_FLAGS)
TEST_LOGS_TMP = $(TEST_LOGS:.log=.log-t)
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-MAINTAINERCLEANFILES = $(parallel_tests)
-EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.sh \
- depmod-tests.sh $(handwritten_tests) $(generated_tests)
-TEST_EXTENSIONS = .test .instspc .depmod
+MAINTAINERCLEANFILES =
+EXTRA_DIST = ChangeLog-old gen-parallel-tests parallel-tests.sh \
+ instspc-tests.sh depmod-tests.sh $(handwritten_tests)
+TEST_EXTENSIONS = .test .ptest .instspc .depmod
# Run the tests with the shell detected at configure time.
TEST_LOG_COMPILER = $(SHELL)
XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
override-conditional-2.test pr8365-remake-timing.test \
yacc-dist-nobuild-subdir.test txinfo5.test \
$(instspc_xfail_tests)
-parallel_tests = backcompat5-p.test check-exported-srcdir-p.test \
- check-subst-prog-p.test check-subst-p.test \
- check-tests-in-builddir-p.test check-tests_environment-p.test \
- check-p.test check10-p.test check11-p.test check12-p.test \
- check2-p.test check3-p.test check4-p.test check5-p.test \
- check6-p.test check7-p.test check8-p.test color-p.test \
- color2-p.test comment9-p.test dejagnu-p.test exeext4-p.test \
- maken3-p.test maken4-p.test posixsubst-tests-p.test
+parallel_tests = backcompat5-p.ptest check-exported-srcdir-p.ptest \
+ check-subst-prog-p.ptest check-subst-p.ptest \
+ check-tests-in-builddir-p.ptest \
+ check-tests_environment-p.ptest check-p.ptest check10-p.ptest \
+ check11-p.ptest check12-p.ptest check2-p.ptest check3-p.ptest \
+ check4-p.ptest check5-p.ptest check6-p.ptest check7-p.ptest \
+ check8-p.ptest color-p.ptest color2-p.ptest comment9-p.ptest \
+ dejagnu-p.ptest exeext4-p.ptest maken3-p.ptest maken4-p.ptest \
+ posixsubst-tests-p.ptest
+PTEST_LOG_COMPILER = $(SHELL) $(srcdir)/parallel-tests.sh
instspc_tests = build-squote.instspc install-squote.instspc \
build-dquote.instspc install-dquote.instspc \
build-bquote.instspc install-bquote.instspc \
TESTS = \
$(handwritten_tests) \
- $(generated_tests) \
+ $(parallel_tests) \
$(depmod_tests) \
$(instspc_tests)
-generated_tests = $(parallel_tests)
handwritten_tests = \
aclocal.test \
aclocal3.test \
yflags-var-expand.test
checked_test_extensions = .test
-expected_list_of_tests = $(handwritten_tests) $(generated_tests)
+expected_list_of_tests = $(handwritten_tests)
am__tmk = tests-in-makefile-list.tmp
am__tfs = tests-on-filesystem-list.tmp
am__tdf = diff-in-tests-lists.tmp
all: all-am
.SUFFIXES:
-.SUFFIXES: .depmod .html .instspc .log .test
+.SUFFIXES: .depmod .html .instspc .log .ptest .test
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am $(srcdir)/instspc-tests.am $(srcdir)/depmod-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
$(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) TEST_LOGS="'"$$list"'"'
.test.log:
@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
+.ptest.log:
+ @p='$<'; $(am__check_pre) $(PTEST_LOG_COMPILE) "$$tst" $(am__check_post)
.instspc.log:
@p='$<'; $(am__check_pre) $(INSTSPC_LOG_COMPILE) "$$tst" $(am__check_post)
.depmod.log:
$(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
$(AM_V_GEN)($(am__cd) $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@
-$(parallel_tests): Makefile.am
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
- { echo '#!/bin/sh'; \
- echo '# DO NOT EDIT! GENERATED AUTOMATICALLY!'; \
- echo; \
- echo '# Ensure proper definition of $$testsrcdir.'; \
- echo '. ./defs-static || exit 99'; \
- echo 'test -n "$$testsrcdir" || exit 99 # sanity check'; \
- echo; \
- echo "# Run the test with Automake's parallel-tests driver enabled."; \
- echo 'parallel_tests=yes'; \
- echo "# In the spirit of VPATH, we prefer a test in the build tree"; \
- echo "# over one in the source tree."; \
- echo "if test -f \"./$$input\"; then"; \
- echo " . \"./$$input\""; \
- echo 'else'; \
- echo " . \"\$$testsrcdir/$$input\""; \
- echo 'fi'; \
- } > $@-t
- $(AM_V_at)chmod a+rx $@-t && mv -f $@-t $@
+# All `*-p.ptest' tests work by sourcing the script `parallel-tests.sh'.
+$(parallel_tests:.ptest=.log): parallel-tests.sh
+# This dummy declaration is required to have make actually produce
+# expected log files from the `.ptest.log' suffix rule.
+$(parallel_tests):
$(srcdir)/instspc-tests.am: instspc-tests.sh Makefile.am
$(AM_V_GEN)($(am__cd) $(srcdir) \
clean-local: clean-maintcheck-testslist-tmp
clean-maintcheck-testslist-tmp:
rm -f $(am__tmk) $(am__tfs) $(am__tdf)
-maintainer-check-list-of-tests: $(expected_list_of_tests)
# Dependencies valid for each test case.
$(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# For each test in the TESTS list in this Makefile.am file, that itself
-# tests features of the TESTS automake interface, generate a sibling
+# tests features of the TESTS automake interface, define a sibling
# test that does likewise, but with the option `parallel-tests' enabled.
# Individual tests can prevent the creation of such a sibling by
# explicitly setting the `$parallel_tests' variable to either "yes" or
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 \
{
echo "## Generated by gen-parallel-tests. Edit Makefile.am instead of this."
echo "parallel_tests ="
- # Since `foo-p.test' sources `foo.test', `foo-p.log' also depends on
+ # Since `foo-p.ptest' sources `foo.test', `foo-p.log' also depends on
# `foo.test'.
sed -e '
h
s/^/parallel_tests += /
- s/$/-p.test/
+ s/$/-p.ptest/
p
x
s/.*/&-p.log: &.test/
--- /dev/null
+#! /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/>.
+
+# Driver script to run checks the on the `parallel-tests' semantics
+# by wrapping tests that use the generic "Simple Tests" driver.
+
+set -e
+
+fatal_ () { echo "$0: $*" >&2; exit 99; }
+
+# Ensure proper definition of $testsrcdir.
+. ./defs-static || exit 99
+test -n "$testsrcdir" || fatal_ "\$testsrcdir is empty or undefined"
+
+case $#,$1 in
+ 0,) fatal_ "missing argument";;
+ 1,*-p.ptest) test_name=`expr /"$1" : '.*/\(.*\)-p\.ptest'`;;
+ 1,*) fatal_ "invalid argument \`$1'";;
+ *) fatal_ "too many arguments";;
+esac
+
+# Run the test with Automake's parallel-tests driver enabled.
+parallel_tests=yes
+# This is required to have the wrapped test use a proper temporary
+# directory to run into.
+me=$test_name-p
+# In the spirit of VPATH, we prefer a test in the build tree
+# over one in the source tree.
+if test -f "./$test_name.test"; then
+ . "./$test_name.test"
+ exit $?
+elif test -f "$testsrcdir/$test_name.test"; then
+ . "$testsrcdir/$test_name.test"
+ exit $?
+else
+ fatal_ "cannot find wrapped test \`$test_name.test'"
+fi
+
+exit 255 # Not reached.