[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] {testsuite-work} tests: two single auxiliary scripts to run/
From: |
Stefano Lattarini |
Subject: |
[PATCH 2/4] {testsuite-work} tests: two single auxiliary scripts to run/generate wrapped tests |
Date: |
Mon, 29 Aug 2011 17:26:01 +0200 |
* tests/config-shell-tests.sh, tests/parallel-tests.sh,
tests/gen-config-shell-tests, tests/gen-parallel-tests: Deleted,
their roles taken over by ...
* tests/wrap-tests.sh, tests/gen-wrap-tests: ... these new more
general scripts.
* tests/Makefile.am (EXTRA_DIST): Distribute the new scripts, and
do not distribute the obsolete ones anymore.
($(srcdir)/parallel-tests.am, $(srcdir)/config-shell-tests.am): Do
not include nor generate anymore, they have been superseded by ...
($(srcdir)/wrap-tests.am): ... this new fragment, automatically
generated by `gen-wrap-tests'.
(PTEST_LOG_COMPILER, SHTST_LOG_COMPILER): Delete, they are now
defined in the new `wrap-tests.am' makefile fragment.
(TEST_EXTENSIONS): Do not append to it anymore, that is now done
by the new `wrap-tests.am' makefile fragment above.
($(parallel_tests:.ptest=.log), $(config_shell_tests:.shtst=.log),
$(parallel_tests), $(config_shell_tests): Remove this dependencies,
superseded by ...
($(wrap_TESTS), $(wrap_LOGS)): ... these ones.
(MAINTAINERCLEANFILES): Delete, it's not used anymore.
(TESTS): Do not contain anymore `$(config_shell_tests)' nor
`$(parallel_tests)', contain `$(wrap_TESTS)' instead, as defined
by `$(srcdir)/wrap-tests.am'.
Other related minor edits and reorderings.
* bootstrap, tests/.gitignore, tests/README: Update.
---
ChangeLog | 29 +++++++
bootstrap | 11 +--
tests/.gitignore | 3 +-
tests/Makefile.am | 70 ++++++------------
tests/Makefile.in | 168 +++++++++++++++++++++---------------------
tests/README | 19 +++--
tests/config-shell-tests.sh | 53 -------------
tests/gen-config-shell-tests | 70 -----------------
tests/gen-parallel-tests | 64 ----------------
tests/gen-wrap-tests | 123 ++++++++++++++++++++++++++++++
tests/parallel-tests.sh | 52 -------------
tests/wrap-tests.sh | 92 +++++++++++++++++++++++
12 files changed, 370 insertions(+), 384 deletions(-)
delete mode 100755 tests/config-shell-tests.sh
delete mode 100755 tests/gen-config-shell-tests
delete mode 100755 tests/gen-parallel-tests
create mode 100755 tests/gen-wrap-tests
delete mode 100755 tests/parallel-tests.sh
create mode 100755 tests/wrap-tests.sh
diff --git a/ChangeLog b/ChangeLog
index 54ea993..0b11bbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,34 @@
2011-08-29 Stefano Lattarini <address@hidden>
+ tests: two single auxiliary scripts to run/generate wrapped tests
+ * tests/config-shell-tests.sh, tests/parallel-tests.sh,
+ tests/gen-config-shell-tests, tests/gen-parallel-tests: Deleted,
+ their roles taken over by ...
+ * tests/wrap-tests.sh, tests/gen-wrap-tests: ... these new more
+ general scripts.
+ * tests/Makefile.am (EXTRA_DIST): Distribute the new scripts, and
+ do not distribute the obsolete ones anymore.
+ ($(srcdir)/parallel-tests.am, $(srcdir)/config-shell-tests.am): Do
+ not include nor generate anymore, they have been superseded by ...
+ ($(srcdir)/wrap-tests.am): ... this new fragment, automatically
+ generated by `gen-wrap-tests'.
+ (PTEST_LOG_COMPILER, SHTST_LOG_COMPILER): Delete, they are now
+ defined in the new `wrap-tests.am' makefile fragment.
+ (TEST_EXTENSIONS): Do not append to it anymore, that is now done
+ by the new `wrap-tests.am' makefile fragment above.
+ ($(parallel_tests:.ptest=.log), $(config_shell_tests:.shtst=.log),
+ $(parallel_tests), $(config_shell_tests): Remove this dependencies,
+ superseded by ...
+ ($(wrap_TESTS), $(wrap_LOGS)): ... these ones.
+ (MAINTAINERCLEANFILES): Delete, it's not used anymore.
+ (TESTS): Do not contain anymore `$(config_shell_tests)' nor
+ `$(parallel_tests)', contain `$(wrap_TESTS)' instead, as defined
+ by `$(srcdir)/wrap-tests.am'.
+ Other related minor edits and reorderings.
+ * bootstrap, tests/.gitignore, tests/README: Update.
+
+2011-08-29 Stefano Lattarini <address@hidden>
+
tests: list of tests placed in a separate Makefile fragment
This change allows us to easily use make instead of by-hand (and
more fragile) grepping to extract the list of hand-written tests
diff --git a/bootstrap b/bootstrap
index 656fef7..9fab5f8 100755
--- a/bootstrap
+++ b/bootstrap
@@ -32,8 +32,6 @@ export AUTOCONF # might be used by aclocal and/or automake
export AUTOM4TE # ditto
: ${PERL=perl}
-BOOTSTRAP_MAKE=${BOOTSTRAP_MAKE-${MAKE-make}}
-
# Variables to substitute.
VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
PACKAGE=automake
@@ -105,12 +103,11 @@ dosubst m4/amversion.in m4/amversion.m4
# Create temporary replacement for automake.
dosubst automake.in automake.tmp
-# Create required makefile snippets.
+# Create required makefile snippet.
cd tests
-$BOOTSTRAP_MAKE -s -f list-of-tests.mk print-list-of-tests \
- | $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
-$BOOTSTRAP_MAKE -s -f list-of-tests.mk print-list-of-tests \
- | $BOOTSTRAP_SHELL ./gen-config-shell-tests > config-shell-tests.am
+$BOOTSTRAP_SHELL ./gen-wrap-tests > wrap-tests.tmp
+chmod a-w wrap-tests.tmp
+mv -f wrap-tests.tmp wrap-tests.am
cd ..
# Run the autotools.
diff --git a/tests/.gitignore b/tests/.gitignore
index 4ec56b1..528a0f5 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,8 +1,7 @@
/aclocal-*
/automake-*
/defs-static
-/parallel-tests.am
-/config-shell-tests.am
+/wrap-tests.am
/*.dir
/*.log
/*.trs
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e828c59..d166f25 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -36,9 +36,11 @@ AM_TAP_LOG_DRIVER_FLAGS = --merge --comments
## Keep this in sync with the definition of $diag_string_ in tests/defs.
AM_TAP_LOG_DRIVER_FLAGS += --diagnostic-string `printf '\043%%\043\n'`
-MAINTAINERCLEANFILES =
EXTRA_DIST = ChangeLog-old
+## Will be updated later.
+TESTS =
+
XFAIL_TESTS = \
all.test \
cond17.test \
@@ -48,45 +50,6 @@ pr8365-remake-timing.test \
yacc-dist-nobuild-subdir.test \
txinfo5.test
-
-include $(srcdir)/parallel-tests.am
-
-$(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
- $(AM_V_GEN)($(am__cd) $(srcdir) \
- && $(MAKE) $(AM_MAKEFLAGS) -s print-list-of-test \
- | $(SHELL) ./gen-parallel-tests) >$@
-EXTRA_DIST += gen-parallel-tests
-
-TEST_EXTENSIONS += .ptest
-PTEST_LOG_COMPILER = $(LOG_COMPILER) $(srcdir)/parallel-tests.sh
-EXTRA_DIST += parallel-tests.sh
-
-# 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)/config-shell-tests.am
-
-$(srcdir)/config-shell-tests.am: gen-config-shell-tests Makefile.am
- $(AM_V_GEN)($(am__cd) $(srcdir) \
- && $(MAKE) $(AM_MAKEFLAGS) print-list-of-test \
- | $(SHELL) ./gen-config-shell-tests) >$@
-EXTRA_DIST += gen-config-shell-tests
-
-TEST_EXTENSIONS += .shtst
-SHTST_LOG_COMPILER = $(LOG_COMPILER) $(srcdir)/config-shell-tests.sh
-EXTRA_DIST += config-shell-tests.sh
-
-# All `*-w.shtst' tests work by sourcing the script `config-shell-tests.sh'.
-$(config_shell_tests:.shtst=.log): config-shell-tests.sh
-# This dummy declaration is required to have make actually produce
-# expected log files from the `.shtst.log' suffix rule.
-$(config_shell_tests):
-
-
# Some testsuite-influential variables should be overridable from the
# test scripts, but not from the environment.
AM_TESTS_ENVIRONMENT = \
@@ -107,16 +70,31 @@ AM_TESTS_ENVIRONMENT += AM_TESTS_REEXEC=no; export
AM_TESTS_REEXEC;
AM_TESTS_FD_REDIRECT = 9>&2
AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
-# Include definition of list of hand-written tests. We keep that in a
-# separate file to simplify bootstrapping of Automake from a VCS checkout.
+# Hand-written tests.
+
include $(srcdir)/list-of-tests.mk
+TESTS += $(handwritten_TESTS)
EXTRA_DIST += $(handwritten_TESTS)
-TESTS = \
- $(handwritten_TESTS) \
- $(config_shell_tests) \
- $(parallel_tests)
+# "Auto-generated" tests wrapping hand-written ones.
+
+include $(srcdir)/wrap-tests.am
+
+TESTS += $(wrap_TESTS)
+
+$(srcdir)/wrap-tests.am: gen-wrap-tests list-of-tests.mk Makefile.am
+ $(AM_V_GEN)($(am__cd) $(srcdir) \
+ && $(SHELL) ./gen-wrap-tests) > wrap-tests.tmp
+ $(AM_V_at)chmod a-w wrap-tests.tmp && mv -f wrap-tests.tmp $@
+EXTRA_DIST += gen-wrap-tests
+
+# These tests are not expected to exist on filesystem, so we need this
+# declaration to avoid spurious failures.
+$(wrap_TESTS):
+# All the "wrapper" tests work by sourcing the script `wrap-tests.sh'.
+$(wrap_LOGS): wrap-tests.sh
+EXTRA_DIST += wrap-tests.sh
# Extra dependencies for hand-written tests.
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3513de2..9e28466 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -50,10 +50,9 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/aclocal.in $(srcdir)/automake.in \
- $(srcdir)/config-shell-tests.am $(srcdir)/defs \
+ $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs \
$(srcdir)/defs-static.in $(srcdir)/list-of-tests.mk \
- $(srcdir)/parallel-tests.am $(top_srcdir)/CheckListOfTests.am
+ $(srcdir)/wrap-tests.am $(top_srcdir)/CheckListOfTests.am
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
@@ -301,16 +300,15 @@ TAP_LOG_COMPILER = $(LOG_COMPILER)
TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/lib/tap-driver.sh
AM_TAP_LOG_DRIVER_FLAGS = --merge --comments --diagnostic-string \
`printf '\043%%\043\n'`
-MAINTAINERCLEANFILES =
-
-# Include definition of list of hand-written tests. We keep that in a
-# separate file to simplify bootstrapping of Automake from a VCS checkout.
-EXTRA_DIST = ChangeLog-old gen-parallel-tests parallel-tests.sh \
- gen-config-shell-tests config-shell-tests.sh \
- $(handwritten_TESTS) trivial-test-driver \
- testsuite-summary-checks.sh extract-testsuite-summary \
- tap-setup.sh tap-summary-aux.sh tap-functions.sh \
- plain-functions.sh
+EXTRA_DIST = ChangeLog-old $(handwritten_TESTS) gen-wrap-tests \
+ wrap-tests.sh trivial-test-driver testsuite-summary-checks.sh \
+ extract-testsuite-summary tap-setup.sh tap-summary-aux.sh \
+ tap-functions.sh plain-functions.sh
+
+# Hand-written tests.
+
+# "Auto-generated" tests wrapping hand-written ones.
+TESTS = $(handwritten_TESTS) $(wrap_TESTS)
XFAIL_TESTS = \
all.test \
cond17.test \
@@ -320,22 +318,6 @@ pr8365-remake-timing.test \
yacc-dist-nobuild-subdir.test \
txinfo5.test
-parallel_tests = check-concurrency-bug9245-p.ptest \
- check-exported-srcdir-p.ptest check-fd-redirect-p.ptest \
- check-subst-prog-p.ptest check-subst-p.ptest \
- check-tests-in-builddir-p.ptest check-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 tests-environment-p.ptest
-PTEST_LOG_COMPILER = $(LOG_COMPILER) $(srcdir)/parallel-tests.sh
-config_shell_tests = ar-lib-w.shtst compile-w.shtst compile2-w.shtst \
- compile3-w.shtst compile4-w.shtst compile5-w.shtst \
- compile6-w.shtst instsh2-w.shtst instsh3-w.shtst \
- mdate5-w.shtst mdate6-w.shtst missing-w.shtst missing2-w.shtst \
- missing3-w.shtst missing5-w.shtst mkinst3-w.shtst
-SHTST_LOG_COMPILER = $(LOG_COMPILER) $(srcdir)/config-shell-tests.sh
# Some testsuite-influential variables should be overridable from the
# test scripts, but not from the environment.
@@ -1471,10 +1453,40 @@ tap-recheck.test \
tap-summary.test \
tap-summary-color.test
-TESTS = \
- $(handwritten_TESTS) \
- $(config_shell_tests) \
- $(parallel_tests)
+wrap_TESTS = check-concurrency-bug9245-w.ptest \
+ check-exported-srcdir-w.ptest check-fd-redirect-w.ptest \
+ check-subst-prog-w.ptest check-subst-w.ptest \
+ check-tests-in-builddir-w.ptest check-w.ptest check11-w.ptest \
+ check12-w.ptest check2-w.ptest check3-w.ptest check4-w.ptest \
+ check5-w.ptest check6-w.ptest check7-w.ptest check8-w.ptest \
+ color-w.ptest color2-w.ptest comment9-w.ptest dejagnu-w.ptest \
+ exeext4-w.ptest maken3-w.ptest maken4-w.ptest \
+ posixsubst-tests-w.ptest tests-environment-w.ptest \
+ ar-lib-w.shtst compile-w.shtst compile2-w.shtst \
+ compile3-w.shtst compile4-w.shtst compile5-w.shtst \
+ compile6-w.shtst instsh2-w.shtst instsh3-w.shtst \
+ mdate5-w.shtst mdate6-w.shtst missing-w.shtst missing2-w.shtst \
+ missing3-w.shtst missing5-w.shtst mkinst3-w.shtst
+wrap_LOGS = check-concurrency-bug9245-w.log \
+ check-exported-srcdir-w.log check-fd-redirect-w.log \
+ check-subst-prog-w.log check-subst-w.log \
+ check-tests-in-builddir-w.log check-w.log check11-w.log \
+ check12-w.log check2-w.log check3-w.log check4-w.log \
+ check5-w.log check6-w.log check7-w.log check8-w.log \
+ color-w.log color2-w.log comment9-w.log dejagnu-w.log \
+ exeext4-w.log maken3-w.log maken4-w.log posixsubst-tests-w.log \
+ tests-environment-w.log ar-lib-w.log compile-w.log \
+ compile2-w.log compile3-w.log compile4-w.log compile5-w.log \
+ compile6-w.log instsh2-w.log instsh3-w.log mdate5-w.log \
+ mdate6-w.log missing-w.log missing2-w.log missing3-w.log \
+ missing5-w.log mkinst3-w.log
+PTEST_LOG_COMPILER = \
+ $(LOG_COMPILER) $(srcdir)/wrap-tests.sh \
+ --type ptest --define parallel_tests "yes"
+
+SHTST_LOG_COMPILER = \
+ $(LOG_COMPILER) $(srcdir)/wrap-tests.sh \
+ --type shtst --define test_prefer_config_shell "yes"
checked_test_extensions = .test .tap
expected_list_of_tests = $(handwritten_TESTS)
@@ -1485,7 +1497,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .html .log .ptest .shtst .tap .test .trs
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/parallel-tests.am
$(srcdir)/config-shell-tests.am $(srcdir)/list-of-tests.mk
$(top_srcdir)/CheckListOfTests.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/list-of-tests.mk
$(srcdir)/wrap-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -1800,7 +1812,6 @@ 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
@@ -1882,42 +1893,35 @@ uninstall-am:
mostlyclean-generic pdf pdf-am ps ps-am recheck recheck-html \
uninstall uninstall-am
-check-concurrency-bug9245-p.log: check-concurrency-bug9245.test
-check-exported-srcdir-p.log: check-exported-srcdir.test
-check-fd-redirect-p.log: check-fd-redirect.test
-check-subst-prog-p.log: check-subst-prog.test
-check-subst-p.log: check-subst.test
-check-tests-in-builddir-p.log: check-tests-in-builddir.test
-check-p.log: check.test
-check11-p.log: check11.test
-check12-p.log: check12.test
-check2-p.log: check2.test
-check3-p.log: check3.test
-check4-p.log: check4.test
-check5-p.log: check5.test
-check6-p.log: check6.test
-check7-p.log: check7.test
-check8-p.log: check8.test
-color-p.log: color.test
-color2-p.log: color2.test
-comment9-p.log: comment9.test
-dejagnu-p.log: dejagnu.test
-exeext4-p.log: exeext4.test
-maken3-p.log: maken3.test
-maken4-p.log: maken4.test
-posixsubst-tests-p.log: posixsubst-tests.test
-tests-environment-p.log: tests-environment.test
-
-$(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
- $(AM_V_GEN)($(am__cd) $(srcdir) \
- && $(MAKE) $(AM_MAKEFLAGS) -s print-list-of-test \
- | $(SHELL) ./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):
+
+print-list-of-tests:
+ @echo $(handwritten_TESTS)
+.PHONY: print-list-of-tests
+check-concurrency-bug9245-w.log: check-concurrency-bug9245.test
+check-exported-srcdir-w.log: check-exported-srcdir.test
+check-fd-redirect-w.log: check-fd-redirect.test
+check-subst-prog-w.log: check-subst-prog.test
+check-subst-w.log: check-subst.test
+check-tests-in-builddir-w.log: check-tests-in-builddir.test
+check-w.log: check.test
+check11-w.log: check11.test
+check12-w.log: check12.test
+check2-w.log: check2.test
+check3-w.log: check3.test
+check4-w.log: check4.test
+check5-w.log: check5.test
+check6-w.log: check6.test
+check7-w.log: check7.test
+check8-w.log: check8.test
+color-w.log: color.test
+color2-w.log: color2.test
+comment9-w.log: comment9.test
+dejagnu-w.log: dejagnu.test
+exeext4-w.log: exeext4.test
+maken3-w.log: maken3.test
+maken4-w.log: maken4.test
+posixsubst-tests-w.log: posixsubst-tests.test
+tests-environment-w.log: tests-environment.test
ar-lib-w.log: ar-lib.test
compile-w.log: compile.test
compile2-w.log: compile2.test
@@ -1935,20 +1939,16 @@ missing3-w.log: missing3.test
missing5-w.log: missing5.test
mkinst3-w.log: mkinst3.test
-$(srcdir)/config-shell-tests.am: gen-config-shell-tests Makefile.am
+$(srcdir)/wrap-tests.am: gen-wrap-tests list-of-tests.mk Makefile.am
$(AM_V_GEN)($(am__cd) $(srcdir) \
- && $(MAKE) $(AM_MAKEFLAGS) print-list-of-test \
- | $(SHELL) ./gen-config-shell-tests) >$@
-
-# All `*-w.shtst' tests work by sourcing the script `config-shell-tests.sh'.
-$(config_shell_tests:.shtst=.log): config-shell-tests.sh
-# This dummy declaration is required to have make actually produce
-# expected log files from the `.shtst.log' suffix rule.
-$(config_shell_tests):
-
-print-list-of-tests:
- @echo $(handwritten_TESTS)
-.PHONY: print-list-of-tests
+ && $(SHELL) ./gen-wrap-tests) > wrap-tests.tmp
+ $(AM_V_at)chmod a-w wrap-tests.tmp && mv -f wrap-tests.tmp $@
+
+# These tests are not expected to exist on filesystem, so we need this
+# declaration to avoid spurious failures.
+$(wrap_TESTS):
+# All the "wrapper" tests work by sourcing the script `wrap-tests.sh'.
+$(wrap_LOGS): wrap-tests.sh
# Extra dependencies for hand-written tests.
diff --git a/tests/README b/tests/README
index 54ec670..fb12380 100644
--- a/tests/README
+++ b/tests/README
@@ -184,12 +184,19 @@ Do
instead.
For tests that use the `parallel-tests' Automake option, set the shell
- variable `parallel_tests' to "yes" before including ./defs. Also,
- do not use for them a name that ends in `-p.test', since that would
- risk to clash with automatically-generated tests. For tests that are
- *not* meant to work with the `parallel-tests' Automake option (these
- should be very very few), set the shell variable `parallel_tests' to
- "no" before including ./defs.
+ variable `parallel_tests' to "yes" before including ./defs. For tests
+ that are *not* meant to work with the `parallel-tests' Automake option
+ (these should be very very few), set the shell variable `parallel_tests'
+ to "no" before including ./defs.
+
+ Some tests in the Automake testsuite are auto-generated; those tests
+ might have custom extensions, but their basename (that is, with such
+ extension stripped) is expected to end with the "-w" string. For
+ example, the name of an auto-generated test can be `color-w.ptest'
+ or `ar-lib-w.shtst'. Please don't name hand-written tests in a way
+ that could cause them to be confused with auto-generated tests; for
+ example, `u-v-w.test' or `option-w.tap' are *not* valid name for
+ hand-written tests.
./defs brings in some commonly required files, and sets a skeleton
configure.in. If possible, append to this file. In some cases
diff --git a/tests/config-shell-tests.sh b/tests/config-shell-tests.sh
deleted file mode 100755
index 150287e..0000000
--- a/tests/config-shell-tests.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /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 on Automake-provided shell scripts using
-# configure-time $SHELL instead of the system shell /bin/sh.
-
-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,*-w.shtst) test_name=`expr /"$1" : '.*/\(.*\)-w\.shtst'`;;
- 1,*) fatal_ "invalid argument \`$1'";;
- *) fatal_ "too many arguments";;
-esac
-
-# Run the test using configure-time $SHELL, not /bin/sh, to run the
-# checked shell scripts.
-test_prefer_config_shell=yes
-# This is required to have the wrapped test use a proper temporary
-# directory to run into.
-me=$test_name-w
-# 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.
diff --git a/tests/gen-config-shell-tests b/tests/gen-config-shell-tests
deleted file mode 100755
index 4234d6c..0000000
--- a/tests/gen-config-shell-tests
+++ /dev/null
@@ -1,70 +0,0 @@
-#! /bin/sh
-# Generate config-shell-tests.am.
-#
-# 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/>.
-
-#
-# For each test in the $(handwritten_tests) list in this Makefile.am file,
-# that directly tests features of an automake-provided shell script from
-# the `lib/' subdirectory, define a sibling test that does likewise, but
-# using, to run said script, the configure-time $SHELL instead of the
-# default system shell /bin/sh.
-#
-# A test is considered a candidate for sibling-generation if it calls the
-# `get_shell_script' function anywhere.
-#
-# Individual tests can prevent the creation of such a sibling by explicitly
-# setting the `$test_prefer_config_shell' variable to either "yes" or "no".
-# The rationale for this is that if the variable is set to "yes", the test
-# already uses $SHELL, so that a sibling would be just a duplicate; while
-# if the variable is set to "no", the test doesn't support, or is not meant
-# to use, $SHELL to run the script under testing, and forcing it to do so
-# in the sibling would likely cause a spurious failure.
-#
-
-set -e
-
-tests=`cat`
-
-if test -z "$tests"; then
- echo "$0: list of tests must be passed on stdin" >&2
- exit 1
-fi
-
-{
- grep -l '^get_shell_script ' $tests
- grep -l ' get_shell_script ' $tests
-} |
-LC_ALL=C sort -u |
-while read tst; do
- grep "test_prefer_config_shell=" $tst >/dev/null || echo $tst
-done |
-sed -e 's/\.test$//' |
-{
- echo "## Generated by gen-config-shell-tests."
- echo "## Edit Makefile.am instead of this."
- echo "config_shell_tests ="
- # Since `foo-w.shtst' sources `foo.test', `foo-p.log' also depends on
- # `foo.test'.
- sed -e '
- h
- s/^/config_shell_tests += /
- s/$/-w.shtst/
- p
- x
- s/.*/&-w.log: &.test/
- '
-}
diff --git a/tests/gen-parallel-tests b/tests/gen-parallel-tests
deleted file mode 100755
index 90842a8..0000000
--- a/tests/gen-parallel-tests
+++ /dev/null
@@ -1,64 +0,0 @@
-#! /bin/sh
-# Generate parallel-tests.am.
-#
-# Copyright (C) 2009, 2010, 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/>.
-
-# For each test in the $(handwritten_tests) list in this Makefile.am file,
-# that itself 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
-# "no". The rationale for this is that if the variable is set to "yes",
-# the test already uses the `parallel-tests' option, so that a sibling
-# would be just a duplicate; while if the variable is set to "no", the
-# test doesn't support, or is not meant to run with, the `parallel-tests'
-# option, and forcing it to do so in the sibling would likely cause a
-# spurious failure.
-
-set -e
-
-tests=`cat`
-
-if test -z "$tests"; then
- echo "$0: list of tests must be passed on stdin" >&2
- exit 1
-fi
-
-{
- grep -l '^TESTS ' $tests
- grep -l ' TESTS ' $tests
-} |
-LC_ALL=C sort -u |
-while read tst; do
- if grep '^[^#]*parallel-tests' $tst >/dev/null \
- || grep "parallel_tests=" $tst >/dev/null
- then :; else echo $tst; fi;
-done |
-sed -e 's/\.test$//' |
-{
- echo "## Generated by gen-parallel-tests. Edit Makefile.am instead of this."
- echo "parallel_tests ="
- # Since `foo-p.ptest' sources `foo.test', `foo-p.log' also depends on
- # `foo.test'.
- sed -e '
- h
- s/^/parallel_tests += /
- s/$/-p.ptest/
- p
- x
- s/.*/&-p.log: &.test/
- '
-}
diff --git a/tests/gen-wrap-tests b/tests/gen-wrap-tests
new file mode 100755
index 0000000..23a1a5f
--- /dev/null
+++ b/tests/gen-wrap-tests
@@ -0,0 +1,123 @@
+#! /bin/sh
+# Generate wrap-tests.am.
+#
+# Copyright (C) 2009, 2010, 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/>.
+
+set -e
+set -u
+
+tests=`${MAKE-make} -s -f list-of-tests.mk print-list-of-tests` \
+ && tests=`echo $tests` && test -n "$tests" \
+ || { echo "$0: cannot get list of tests" >&2; exit 1; }
+
+st=0
+for tst in $tests; do
+ test -f $tst || { echo "$0: test \`$tst' not found" >&2; st=1; }
+done
+test $st -eq 0 || exit 1
+
+add_wrapper_type () { wrapper_type_list="$wrapper_type_list $*"; }
+wrapper_type_list="" # Avoid interferences from the environment.
+
+#
+# For each test script in the Automake testsuite that itself tests features
+# of the TESTS automake interface, define a sibling test that does likewise,
+# but with the option `parallel-tests' enabled.
+#
+# A test is considered a candidate for sibling-generation if any
+# Makefile.am generated by it define the TESTS variable.
+#
+# Individual tests can prevent the creation of such a sibling by explicitly
+# setting the `$parallel_tests' variable to either "yes" or "no". The
+# rationale for this is that if the variable is set to "yes", the test
+# already uses the `parallel-tests' option, so that a sibling would be just
+# a duplicate; while if the variable is set to "no", the test doesn't
+# support, or is not meant to run with, the `parallel-tests' option, and
+# forcing it to do so in the sibling would likely cause a spurious failure.
+#
+get_list_for_ptest ()
+{
+ { grep -l '^TESTS *=' $*; grep -l ' TESTS *=' $*; } \
+ | LC_ALL=C sort -u \
+ | while read tst; do
+ grep '^[^#]*parallel-tests' $tst >/dev/null && continue
+ grep "parallel_tests=" $tst >/dev/null && continue
+ echo $tst
+ done
+}
+defines_for_ptest='--define parallel_tests "yes"'
+add_wrapper_type "ptest"
+
+#
+# For each test script in the Automake testsuite that tests features of
+# one or more automake-provided shell script from the `lib/' subdirectory
+# by running those scripts directly (i.e., not thought make calls and
+# automake-generated makefiles), define a sibling test that does likewise,
+# but running the said script with the configure-time $SHELL instead of
+# the default system shell /bin/sh.
+#
+# A test is considered a candidate for sibling-generation if it calls the
+# `get_shell_script' function anywhere.
+#
+# Individual tests can prevent the creation of such a sibling by explicitly
+# setting the `$test_prefer_config_shell' variable to either "yes" or "no".
+# The rationale for this is that if the variable is set to "yes", the test
+# already uses $SHELL, so that a sibling would be just a duplicate; while
+# if the variable is set to "no", the test doesn't support, or is not meant
+# to use, $SHELL to run the script under testing, and forcing it to do so
+# in the sibling would likely cause a spurious failure.
+#
+get_list_for_shtst ()
+{
+ { grep -l '^get_shell_script ' $*; grep -l ' get_shell_script ' $*; } \
+ | LC_ALL=C sort -u \
+ | while read tst; do
+ grep "test_prefer_config_shell=" $tst >/dev/null || echo $tst
+ done
+}
+defines_for_shtst='--define test_prefer_config_shell "yes"'
+add_wrapper_type "shtst"
+
+echo '## Generated by gen-wrapped-tests. DO NOT EDIT.'
+echo 'wrap_TESTS ='
+echo 'wrap_LOGS ='
+
+# NOTE: the following is not really right, since cannot compose wrapping
+# of tests matching more than one condition. Still, there should be no
+# such test at the moment, so the limitation is acceptable. Also, if
+# this invariant stops holding, the check `check-no-repeated-test-name'
+# in Makefile.am will start failing.
+
+for wtype in $wrapper_type_list; do
+ WTYPE=`echo $wtype | LC_ALL=C tr '[a-z]' '[A-Z]'`
+ eval defines=\${defines_for_$wtype}
+ echo "TEST_EXTENSIONS += .$wtype"
+ echo "${WTYPE}_LOG_COMPILER = \\"
+ echo " \$(LOG_COMPILER) \$(srcdir)/wrap-tests.sh \\"
+ echo " --type $wtype $defines"
+ get_list_for_$wtype $tests \
+ | sed -e '
+ h
+ s/\(.*\)\.\([^.]\)*$/wrap_TESTS += \1-w.'$wtype'/
+ p
+ x
+ h
+ s/\(.*\)\.\([^.]*\)$/\1-w.log: \1.\2/
+ p
+ x
+ s/\(.*\)\.[^.]*$/wrap_LOGS += \1-w.log/
+ '
+done
diff --git a/tests/parallel-tests.sh b/tests/parallel-tests.sh
deleted file mode 100755
index b6bbff3..0000000
--- a/tests/parallel-tests.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#! /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.
diff --git a/tests/wrap-tests.sh b/tests/wrap-tests.sh
new file mode 100755
index 0000000..1a17db3
--- /dev/null
+++ b/tests/wrap-tests.sh
@@ -0,0 +1,92 @@
+#! /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/>.
+
+# Wrap en existing test script of the automake testsuite by pre-defining
+# some influential variables and then sourcing it.
+
+set -e
+
+# Will be properly overridden once the wrapped test script is sourced.
+fatal_ () { echo "$0: $*" >&2; exit 99; }
+
+# Ensure proper definition of $testsrcdir.
+. ./defs-static || fatal_ "couldn't source ./defs-static"
+test x"$testsrcdir" != x || fatal_ "\$testsrcdir is empty or undefined"
+
+echo "args: $*" # For debugging.
+
+typ=
+while test $# -gt 0; do
+ case $1 in
+ --define)
+ test $# -ge 3 || fatal_ "option \`$1': two arguments required"
+ echo "define: $2='$3'" # For debugging.
+ eval "$2=\$3"
+ shift; shift;;
+ --type)
+ test $# -ge 2 || fatal_ "option \`$1': argument required"
+ typ=$2
+ shift;;
+ --)
+ shift; break;;
+ *)
+ break;;
+ -*)
+ fatal_ "invalid option: \`$1'";;
+ esac
+ shift
+done
+test -n "$typ" || fatal_ "suffix not specified"
+
+case $#,$1 in
+ 0,) fatal_ "missing argument";;
+ 1,*-w.$typ) test_name=`expr x/"$1" : ".*/\\\\(.*\\\\)-w\\\\.$typ$"`;;
+ 1,*) fatal_ "invalid argument \`$1'";;
+ *) fatal_ "too many arguments";;
+esac
+
+set -x
+# This is required to have the wrapped test use a proper temporary
+# directory to run into.
+me=${test_name}-w
+# In the spirit of VPATH, we prefer a test in the build tree
+# over one in the source tree.
+for dir in . "$testsrcdir"; do
+ # The testsuite shouldn't have a TAP and plain test with the same
+ # basename (they would end up sharing the same basename and thus the
+ # same `.log' and `.trs' files, wreaking havoc). So just test for
+ # the two flavors in random order.
+ for suf in tap test; do
+ if test -f "$dir/$test_name.$suf"; then
+ # We must let the code in ./defs which kind of test script it is
+ # dealing with -- TAP or "plain". It won't be able to guess
+ # automatically, since it uses `$0' for such a guess, and with
+ # the present usage `$0' is always `wrap-tests.sh'.
+ if test $suf = tap; then
+ using_tap=yes
+ else
+ using_tap=no
+ fi
+ # Shell traces will be properly re-enabled later by the sourced
+ # test script.
+ set +x
+ . "$dir/$test_name.$suf"
+ exit $?
+ fi
+ done
+done
+
+fatal_ "cannot find wrapped test \`$test_name'"
--
1.7.2.3