summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-07-26 18:16:47 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-07-26 18:16:47 +0200
commit106428fe4e73d5f9f5e7cc2e44a1e9b3b85606c1 (patch)
treeeafba44304c8d832d6107730d183eb1b6c4e400f
parent06143bdbbf8c3d358d51b646165634473c193afe (diff)
parent7d6b27434de032d8b6f852eb49e788b87a5e7695 (diff)
downloadautomake-106428fe4e73d5f9f5e7cc2e44a1e9b3b85606c1.tar.gz
Merge branch 'maint'
* maint: (38 commits) maintcheck: fixup list of files in $(xdefs) tests: never source test-defs.sh directly, source test-lib.sh instead runtest: sanitize test environment tests: remove an obsolescent self test tests: "am_using_tap=yes" -> "am_test_protocol=tap" tests: protect test libs against multiple inclusion configure: testsuite shell can return early from "dot-sourced" files tests: move sanitization and "Bournification" in the generic test lib tests: source test defs in the generic test lib test defs: no need to re-add $srcdir/t/ax to $PATH tests: split test libs into "generic" and "automake-specific" test setup: move actual calling of testsuite setup in ./defs test setup: merge definitions of function for simple tests test init: refactor: new function 'am_test_setup' test init: refactor: move displaying of debugging info later test init: refactor: new function 'am_setup_testdir' test init: refactor: new function 'am_set_exit_traps' configure: testsuite shell set exit traps in shell functions test init: refactor: new function 'am_exit_trap' test init: refactor: new function 'process_requirements' ... Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am58
-rw-r--r--configure.ac13
-rw-r--r--defs12
-rwxr-xr-xgen-testsuite-part35
-rw-r--r--runtest.in85
-rw-r--r--syntax-checks.mk7
-rw-r--r--t/README2
-rw-r--r--t/ax/am-test-lib.sh (renamed from t/ax/test-init.sh)312
-rw-r--r--t/ax/plain-functions.sh40
-rw-r--r--t/ax/tap-setup.sh2
-rw-r--r--t/ax/test-defs.in (renamed from defs-static.in)76
-rw-r--r--t/ax/test-lib.sh296
-rw-r--r--t/list-of-tests.mk3
-rwxr-xr-xt/primary-prefix-couples-force-valid.sh7
-rwxr-xr-xt/self-check-env-sanitize.tap56
-rwxr-xr-xt/self-check-tap.sh45
-rwxr-xr-xt/tap-ambiguous-directive.sh2
-rwxr-xr-xt/tap-autonumber.sh2
-rwxr-xr-xt/tap-bailout-and-logging.sh2
-rwxr-xr-xt/tap-bailout-leading-space.sh2
-rwxr-xr-xt/tap-bailout-suppress-badexit.sh2
-rwxr-xr-xt/tap-bailout-suppress-later-diagnostic.sh2
-rwxr-xr-xt/tap-bailout-suppress-later-errors.sh2
-rwxr-xr-xt/tap-bailout.sh2
-rwxr-xr-xt/tap-color.sh2
-rwxr-xr-xt/tap-deps.sh2
-rwxr-xr-xt/tap-diagnostic.sh2
-rwxr-xr-xt/tap-empty-diagnostic.sh2
-rwxr-xr-xt/tap-empty.sh2
-rwxr-xr-xt/tap-escape-directive-2.sh2
-rwxr-xr-xt/tap-escape-directive.sh2
-rwxr-xr-xt/tap-exit.sh2
-rwxr-xr-xt/tap-fancy.sh2
-rwxr-xr-xt/tap-fancy2.sh2
-rwxr-xr-xt/tap-global-log.sh2
-rwxr-xr-xt/tap-global-result.sh2
-rwxr-xr-xt/tap-log.sh2
-rwxr-xr-xt/tap-merge-stdout-stderr.sh2
-rwxr-xr-xt/tap-missing-plan-and-bad-exit.sh2
-rwxr-xr-xt/tap-msg0-bailout.sh2
-rwxr-xr-xt/tap-msg0-directive.sh2
-rwxr-xr-xt/tap-msg0-misc.sh2
-rwxr-xr-xt/tap-msg0-planskip.sh2
-rwxr-xr-xt/tap-msg0-result.sh2
-rwxr-xr-xt/tap-negative-numbers.sh2
-rwxr-xr-xt/tap-no-disable-hard-error.sh2
-rwxr-xr-xt/tap-no-merge-stdout-stderr.sh2
-rwxr-xr-xt/tap-no-spurious-numbers.sh2
-rwxr-xr-xt/tap-no-spurious-summary.sh2
-rwxr-xr-xt/tap-no-spurious.sh2
-rwxr-xr-xt/tap-not-ok-skip.sh2
-rwxr-xr-xt/tap-number-wordboundary.sh2
-rwxr-xr-xt/tap-numbers-leading-zero.sh2
-rwxr-xr-xt/tap-numeric-description.sh2
-rwxr-xr-xt/tap-out-of-order.sh2
-rwxr-xr-xt/tap-passthrough-exit.sh2
-rwxr-xr-xt/tap-passthrough.sh2
-rwxr-xr-xt/tap-plan-corner.sh2
-rwxr-xr-xt/tap-plan-errors.sh2
-rwxr-xr-xt/tap-plan-leading-zero.sh2
-rwxr-xr-xt/tap-plan-malformed.sh2
-rwxr-xr-xt/tap-plan-middle.sh2
-rwxr-xr-xt/tap-plan-whitespace.sh2
-rwxr-xr-xt/tap-plan.sh2
-rwxr-xr-xt/tap-planskip-and-logging.sh2
-rwxr-xr-xt/tap-planskip-badexit.sh2
-rwxr-xr-xt/tap-planskip-bailout.sh2
-rwxr-xr-xt/tap-planskip-case-insensitive.sh2
-rwxr-xr-xt/tap-planskip-late.sh2
-rwxr-xr-xt/tap-planskip-later-errors.sh2
-rwxr-xr-xt/tap-planskip-unplanned-corner.sh2
-rwxr-xr-xt/tap-planskip-unplanned.sh2
-rwxr-xr-xt/tap-planskip-whitespace.sh2
-rwxr-xr-xt/tap-planskip.sh2
-rwxr-xr-xt/tap-realtime.sh2
-rwxr-xr-xt/tap-recheck-logs.sh2
-rwxr-xr-xt/tap-result-comment.sh2
-rwxr-xr-xt/tap-summary-color.sh4
-rwxr-xr-xt/tap-summary.sh4
-rwxr-xr-xt/tap-test-number-0.sh2
-rwxr-xr-xt/tap-todo-skip-together.sh2
-rwxr-xr-xt/tap-todo-skip-whitespace.sh2
-rwxr-xr-xt/tap-todo-skip.sh2
-rwxr-xr-xt/tap-unplanned.sh2
-rwxr-xr-xt/tap-whitespace-normalization.sh2
-rwxr-xr-xt/tap-with-and-without-number.sh2
-rwxr-xr-xt/tap-xfail-tests.sh2
-rwxr-xr-xt/testsuite-summary-color.sh8
-rwxr-xr-xt/testsuite-summary-count.sh8
90 files changed, 595 insertions, 618 deletions
diff --git a/.gitignore b/.gitignore
index b09a0a65d..c42aef3c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,7 +38,7 @@
/test-suite.log
/t/wrap/aclocal-1.*
/t/wrap/automake-1.*
-/defs-static
+/t/ax/test-defs.sh
/t/testsuite-part.am
/t/*-w.tap
/t/*-w.sh
diff --git a/Makefile.am b/Makefile.am
index a5332d373..028b07014 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -329,14 +329,17 @@ TESTS = ## Will be updated later.
# Some testsuite-influential variables should be overridable from the
# test scripts, but not from the environment.
+# Keep this in sync with the similar list in 'runtest.in'.
AM_TESTS_ENVIRONMENT = \
for v in \
required \
- am_using_tap \
+ am_test_protocol \
am_serial_tests \
am_test_prefer_config_shell \
am_original_AUTOMAKE \
am_original_ACLOCAL \
+ am_test_lib_sourced \
+ test_lib_sourced \
; do \
eval test x"\$${$$v}" = x || unset $$v; \
done;
@@ -345,6 +348,16 @@ AM_TESTS_ENVIRONMENT = \
AM_TESTS_FD_REDIRECT = 9>&2
AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
+# For sourcing of extra "shell libraries" by our test scripts. As per
+# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
+# in case it is given with a relative name containing no slashes.
+AM_TESTS_ENVIRONMENT += \
+ if test $(srcdir) != .; then \
+ PATH='$(abs_srcdir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
+ fi; \
+ PATH='$(abs_builddir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
+ export PATH;
+
# Hand-written tests.
include $(srcdir)/t/list-of-tests.mk
@@ -379,26 +392,34 @@ include $(srcdir)/contrib/t/local.am
TESTS += $(contrib_TESTS)
EXTRA_DIST += $(contrib_TESTS)
-# Static dependencies valid for each test case.
-check_SCRIPTS = t/wrap/aclocal-$(APIVERSION) t/wrap/automake-$(APIVERSION)
-dist_check_DATA = \
- t/ax/test-init.sh \
- t/ax/plain-functions.sh \
+# Static dependencies valid for each test case (also further
+# extended later). Note that use 'noinst_' rather than 'check_'
+# as the prefix, because we really want them to be built by
+# "make all". This makes it easier to run the test cases by
+# hand after having simply configured and built the package.
+
+nodist_noinst_SCRIPTS = \
+ t/wrap/aclocal-$(APIVERSION) \
+ t/wrap/automake-$(APIVERSION)
+
+dist_noinst_DATA = \
+ t/ax/test-lib.sh \
+ t/ax/am-test-lib.sh \
t/ax/tap-functions.sh
-nodist_check_DATA = defs-static
# Few more static dependencies.
t/distcheck-missing-m4.log: t/ax/distcheck-hook-m4.am
t/distcheck-outdated-m4.log: t/ax/distcheck-hook-m4.am
EXTRA_DIST += t/ax/distcheck-hook-m4.am
-defs-static: defs-static.in Makefile
+t/ax/test-defs.sh: t/ax/test-defs.in Makefile
$(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=defs-static.in\
- && $(do_subst) <$(srcdir)/defs-static.in >$@-t
+ $(AM_V_GEN)in=t/ax/test-defs.in \
+ && $(do_subst) <$(srcdir)/$$in >$@-t
$(generated_file_finalize)
-EXTRA_DIST += defs-static.in
-CLEANFILES += defs-static
+EXTRA_DIST += t/ax/test-defs.in
+CLEANFILES += t/ax/test-defs.sh
+nodist_noinst_DATA = t/ax/test-defs.sh
runtest: runtest.in Makefile
$(AM_V_at)rm -f $@ $@-t
@@ -462,7 +483,7 @@ check-local: check-tests-syntax
.PHONY: check-tests-syntax
## Checking the list of tests.
-test_subdirs = t t/pm t/perf contrib/t
+test_subdirs = t t/pm contrib/t
include $(srcdir)/t/CheckListOfTests.am
# Run the testsuite with the installed aclocal and automake.
@@ -470,6 +491,15 @@ installcheck-local: installcheck-testsuite
installcheck-testsuite:
am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+# Performance tests.
+.PHONY: perf
+perf: all
+ $(MAKE) $(AM_MAKEFLAGS) TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' \
+ TESTS='$(perf_TESTS)' check
+PERF_TEST_SUITE_LOG = t/perf/test-suite.log
+CLEANFILES += $(PERF_TEST_SUITE_LOG)
+EXTRA_DIST += $(perf_TESTS)
+
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
@@ -545,7 +575,7 @@ amhello_configury = \
missing \
src/Makefile.in
-dist_noinst_DATA = $(amhello_sources)
+dist_noinst_DATA += $(amhello_sources)
dist_doc_DATA = $(srcdir)/doc/amhello-1.0.tar.gz
# We depend on configure.ac so that we regenerate the tarball
diff --git a/configure.ac b/configure.ac
index 69edd9a45..b3dfe1f79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,10 +325,23 @@ AC_DEFUN([_AM_CHECK_CANDIDATE_SHELL],
[], [am_score=1; break])
_AM_CHECK_SHELL_FEATURE([$1],
+ [can define exit traps in a shell function],
+ [fail=0 && foo() { trap 'fail=1' 0; } && foo && test $fail = 0],
+ [], [am_score=1; break])
+
+ _AM_CHECK_SHELL_FEATURE([$1],
[corrupts stderr with "set -x"],
[(set -x; P=1 true 2>&3) 3>&1 2>/dev/null | grep P=1],
[am_score=9], [])
+ echo 'return 34' > conftest-return.sh
+ echo 'ok=no' >> conftest-return.sh
+ _AM_CHECK_SHELL_FEATURE([$1],
+ [can return early from "dot-sourced" files],
+ [ok=yes; . ./conftest-return.sh; test $? -eq 34 && test $ok = yes],
+ [rm -f conftest-return.sh],
+ [rm -f conftest-return.sh; am_score=1; break])
+
echo 'alias false=echo' > conftest-alias.sh
echo 'false && test "$(false 97)" = 97' >> conftest-alias.sh
_AM_CHECK_SHELL_FEATURE([$1],
diff --git a/defs b/defs
index df85746b0..1ee111632 100644
--- a/defs
+++ b/defs
@@ -15,9 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Source the shell static setup and variable definitions.
-. ./defs-static; test $? -eq 0 || exit 99
+set -e
-# Source the actual test initialization and setup code, and return
-# control to the test script that is sourcing us.
-. "$am_testauxdir/test-init.sh"
+# Source the actual code for test initialization and setup.
+. test-lib.sh
+. am-test-lib.sh
+
+# Run that setup, and return control to the test script sourcing us.
+am_test_setup
diff --git a/gen-testsuite-part b/gen-testsuite-part
index 25da45c82..21c26c46d 100755
--- a/gen-testsuite-part
+++ b/gen-testsuite-part
@@ -31,6 +31,13 @@ my $me = File::Basename::basename $0;
# For use in VPATH builds.
my $srcdir = ".";
+# The testsuite subdirectory, relative to the top-lever source directory.
+my $testdir = "t";
+
+# Where testsuite-related helper scripts, data files and shell libraries
+# are placed. Relative to the top-lever source directory.
+my $testauxdir = "$testdir/ax";
+
#--------------------------------------------------------------------------
sub unindent ($)
@@ -89,7 +96,7 @@ sub write_wrapper_script ($$$)
print $file_handle unindent <<EOF;
#! /bin/sh
# This file has been automatically generated. DO NOT EDIT BY HAND!
- . ./defs-static || exit 1
+ . test-lib.sh
$shell_setup_code
# In the spirit of VPATH, we prefer a test in the build tree
# over one in the source tree.
@@ -109,7 +116,7 @@ sub get_list_of_tests ()
my $make = defined $ENV{MAKE} ? $ENV{MAKE} : "make";
# Unset MAKEFLAGS, for when we are called from make itself.
my $cmd = "MAKEFLAGS= && unset MAKEFLAGS && cd '$srcdir' && "
- . "$make -s -f t/list-of-tests.mk print-list-of-tests";
+ . "$make -s -f $testdir/list-of-tests.mk print-list-of-tests";
my @tests_list = split /\s+/, `$cmd`;
die "$me: cannot get list of tests\n" unless $? == 0 && @tests_list;
my $ok = 1;
@@ -135,52 +142,48 @@ sub parse_options (@)
#--------------------------------------------------------------------------
-# Where testsuite-related helper scripts, data files and shell libraries
-# are placed. Relative to the 't/' subdirectory.
-my $auxdir = "ax";
-
my %deps_extractor =
(
libtool_macros =>
{
line_matcher => qr/^\s*required=.*\blibtool/,
- nodist_prereqs => "t/libtool-macros.log",
+ nodist_prereqs => "$testdir/libtool-macros.log",
},
gettext_macros =>
{
line_matcher => qr/^\s*required=.*\bgettext/,
- nodist_prereqs => "t/gettext-macros.log",
+ nodist_prereqs => "$testdir/gettext-macros.log",
},
use_trivial_test_driver =>
{
line_matcher => qr/\btrivial-test-driver\b/,
- dist_prereqs => "t/$auxdir/trivial-test-driver",
+ dist_prereqs => "$testauxdir/trivial-test-driver",
},
check_testsuite_summary =>
{
line_matcher => qr/\btestsuite-summary-checks\.sh\b/,
- dist_prereqs => "t/$auxdir/testsuite-summary-checks.sh",
+ dist_prereqs => "$testauxdir/testsuite-summary-checks.sh",
},
extract_testsuite_summary =>
{
line_matcher => qr/\bextract-testsuite-summary\.pl\b/,
- dist_prereqs => "t/$auxdir/extract-testsuite-summary.pl",
+ dist_prereqs => "$testauxdir/extract-testsuite-summary.pl",
},
check_tap_testsuite_summary =>
{
line_matcher => qr/\btap-summary-aux\.sh\b/,
- dist_prereqs => "t/$auxdir/tap-summary-aux.sh",
+ dist_prereqs => "$testauxdir/tap-summary-aux.sh",
},
on_tap_with_common_setup =>
{
line_matcher => qr/\btap-setup\.sh\b/,
- dist_prereqs => "t/$auxdir/tap-setup.sh",
- nodist_prereqs => "t/tap-common-setup.log",
+ dist_prereqs => "$testauxdir/tap-setup.sh",
+ nodist_prereqs => "$testdir/tap-common-setup.log",
},
depcomp =>
{
line_matcher => qr/\bdepcomp\.sh\b/,
- dist_prereqs => "t/$auxdir/depcomp.sh",
+ dist_prereqs => "$testauxdir/depcomp.sh",
},
);
@@ -344,7 +347,7 @@ foreach my $lt (TRUE, FALSE)
"depmode=$m",
"depcomp_with_libtool=" . ($lt ? "yes" : "no"),
);
- my $test = "t/depcomp" . ($lt ? "-lt-" : "-") . $m . ".tap";
+ my $test = "$testdir/depcomp" . ($lt ? "-lt-" : "-") . "$m.tap";
# Register wrapper test as "autogenerated" ...
push @generated_tests, $test;
# ... and create it.
diff --git a/runtest.in b/runtest.in
index 31f8e012c..c2c5d1f9d 100644
--- a/runtest.in
+++ b/runtest.in
@@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Run an Automake test from the command line.
-# Usage:
set -e; set -u
@@ -24,28 +23,77 @@ set -e; set -u
: ${AM_PROVE_CMD='prove'}
: ${AM_PROVEFLAGS='--merge --verbose'}
: ${srcdir='@srcdir@'}
+: ${abs_srcdir='@abs_srcdir@'}
+: ${abs_builddir='@abs_builddir@'}
+: ${PATH_SEPARATOR='@PATH_SEPARATOR@'}
+
+# For sourcing of extra "shell libraries" by our test scripts. As per
+# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
+# in case it is given with a relative name containing no slashes.
+if test "$srcdir" != .; then
+ PATH=$abs_srcdir/t/ax$PATH_SEPARATOR$PATH
+fi
+PATH=$abs_builddir/t/ax$PATH_SEPARATOR$PATH
+export PATH
+
+# For use by the testsuite framework. The Automake test harness
+# define this, so we better do the same.
+export srcdir
+
+# Some testsuite-influential variables should be overridable from the
+# test scripts, but not from the environment.
+# Keep this in sync with the 'Makefile.am:AM_TESTS_ENVIRONMENT'.
+for v in \
+ required \
+ am_test_protocol \
+ am_serial_tests \
+ am_test_prefer_config_shell \
+ am_original_AUTOMAKE \
+ am_original_ACLOCAL \
+ am_test_lib_sourced \
+ test_lib_sourced \
+; do
+ eval "$v= && unset $v" || exit 1
+done
+unset v
error () { echo "$0: $*" >&2; exit 255; }
# Some shell flags should be passed over to the test scripts.
-#while test $# -gt 0; do
-# case $1 in
-# --help) echo "Usage: $0 [SHELL-OPTIONS] TEST [TEST-OPTIONS]"; exit $?;;
-# -*)
-# esac
-#done
+shell_opts=
+while test $# -gt 0; do
+ case $1 in
+ --help)
+ echo "Usage: $0 [--shell=PATH] [SHELL-OPTIONS] TEST [TEST-OPTIONS]"
+ exit $?
+ ;;
+ --shell)
+ test $# -gt 1 || error "missing argument for option '$1'"
+ AM_TEST_RUNNER_SHELL=$2
+ shift
+ ;;
+ --shell=*)
+ AM_TEST_RUNNER_SHELL=${1#--shell=}
+ ;;
+ -o)
+ test $# -gt 1 || error "missing argument for option '$1'"
+ shell_opts="$shell_opts -o $2"
+ shift
+ ;;
+ -*)
+ # Assume it is an option to pass through to the shell.
+ shell_opts="$shell_opts $1";;
+ *)
+ break;;
+ esac
+ shift
+done
test $# -gt 0 || error "missing argument"
tst=$1; shift
case $tst in
- *.sh) wrapper () { exec "$@"; };;
- *.tap) wrapper () { exec "$AM_PROVE_CMD" $AM_PROVEFLAGS -e "$@"; };;
- *) error "test '$tst' has an unrecognized extension";;
-esac
-
-case $tst in
/*) ;;
*) if test -f ./$tst; then
tst=./$tst
@@ -58,5 +106,14 @@ case $tst in
;;
esac
-wrapper "$AM_TEST_RUNNER_SHELL" "$tst" "$@"
+case $tst in
+ *.sh)
+ exec $AM_TEST_RUNNER_SHELL $shell_opts "$tst" "$@" ;;
+ *.tap)
+ exec "$AM_PROVE_CMD" $AM_PROVEFLAGS -e \
+ "$AM_TEST_RUNNER_SHELL $shell_opts" "$tst" "$@" ;;
+ *)
+ error "test '$tst' has an unrecognized extension" ;;
+esac
+
error "dead code reached"
diff --git a/syntax-checks.mk b/syntax-checks.mk
index 6ebaf6974..032e7be77 100644
--- a/syntax-checks.mk
+++ b/syntax-checks.mk
@@ -31,7 +31,11 @@ xtests := $(shell \
done; \
done | sort)
-xdefs = $(srcdir)/t/ax/test-init.sh $(srcdir)/defs $(srcdir)/defs-static.in
+xdefs = \
+ $(srcdir)/t/ax/am-test-lib.sh \
+ $(srcdir)/t/ax/test-lib.sh \
+ $(srcdir)/t/ax/test-defs.in \
+ $(srcdir)/defs
ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
@@ -217,6 +221,7 @@ sc_tests_make_without_am_makeflags:
sc_tests_obsolete_variables:
@vars=" \
using_tap \
+ am_using_tap \
test_prefer_config_shell \
original_AUTOMAKE \
original_ACLOCAL \
diff --git a/t/README b/t/README
index 60b425279..06f087f77 100644
--- a/t/README
+++ b/t/README
@@ -234,7 +234,7 @@ Writing test cases
example, if you need to copy or grep an automake-provided script,
do not assume that they can be found in the '$top_srcdir/lib'
directory, but use '$am_scriptdir' instead. The complete list of
- such "$am_...dir" variables can be found in the 'defs-static.in'
+ such "$am_...dir" variables can be found in the 't/ax/test-defs.in'
file.
* When writing input for lex, include the following in the definitions
diff --git a/t/ax/test-init.sh b/t/ax/am-test-lib.sh
index c2c8d4d1f..e2723f39a 100644
--- a/t/ax/test-init.sh
+++ b/t/ax/am-test-lib.sh
@@ -19,56 +19,16 @@
### IMPORTANT NOTE: keep this file 'set -e' clean. ###
########################################################
-# Enable the errexit shell flag early.
-set -e
-
-
-## --------------------- ##
-## Early sanity checks. ##
-## --------------------- ##
-
-# Ensure $am_top_srcdir is set correctly.
-test -f "$am_top_srcdir/defs-static.in" || {
- echo "$me: $am_top_srcdir/defs-static.in not found," \
- "check \$am_top_srcdir" >&2
- exit 99
-}
-
-# Ensure $am_top_builddir is set correctly.
-test -f "$am_top_builddir/defs-static" || {
- echo "$me: $am_top_builddir/defs-static not found," \
- "check \$am_top_builddir" >&2
- exit 99
-}
-
-
-## ------------------ ##
-## Early variables. ##
-## ------------------ ##
+# Do not source several times.
+test ${am_test_lib_sourced-no} = yes && return 0
+am_test_lib_sourced=yes
-# A single whitespace character.
-sp=' '
-# A tabulation character.
-tab=' '
-# A newline character.
-nl='
-'
# A literal escape character. Used by test checking colored output.
esc=''
-# As autoconf-generated configure scripts do, ensure that IFS
-# is defined initially, so that saving and restoring $IFS works.
-IFS=$sp$tab$nl
-
-
-## ----------------------- ##
-## Early debugging info. ##
-## ----------------------- ##
-
-echo "Running from installcheck: $am_running_installcheck"
-echo "Using TAP: $am_using_tap"
-echo "PATH = $PATH"
-
+# This might be used in testcases checking distribution-related features.
+# Test scripts are free to override this if they need to.
+distdir=$me-1.0
## ---------------------- ##
## Environment cleanup. ##
@@ -128,56 +88,6 @@ unset pfx
# Re-enable, it had been temporarily disabled above.
set -e
-## ---------------------------- ##
-## Auxiliary shell functions. ##
-## ---------------------------- ##
-
-# Tell whether we should keep the test directories around, even in
-# case of success. By default, we don't.
-am_keeping_testdirs ()
-{
- case $keep_testdirs in
- ""|n|no|NO) return 1;;
- *) return 0;;
- esac
-}
-
-# This is used in '_am_exit' and in the exit trap. See comments in
-# the latter for more information.
-am__test_skipped=no
-
-# We use a trap below for cleanup. This requires us to go through
-# hoops to get the right exit status transported through the signal.
-# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
-# sh inside this function (FIXME: is this still relevant now that we
-# require a POSIX shell?).
-_am_exit ()
-{
- set +e
- # See comments in the exit trap for the reason we do this.
- test 77 = $1 && am__test_skipped=yes
- # Spurious escaping to ensure we do not call our 'exit' alias.
- (\exit $1); \exit $1
-}
-alias exit=_am_exit
-
-if test $am_using_tap = yes; then
- am_funcs_file=tap-functions.sh
-else
- am_funcs_file=plain-functions.sh
-fi
-
-if test -f "$am_testauxdir/$am_funcs_file"; then
- . "$am_testauxdir/$am_funcs_file" || {
- echo "$me: error sourcing $am_testauxdir/$am_funcs_file" >&2
- exit 99
- }
-else
- echo "$me: $am_testauxdir/$am_funcs_file not found" >&2
- exit 99
-fi
-unset am_funcs_file
-
# cross_compiling
# ---------------
# Tell whether we are cross-compiling. This is especially useful to skip
@@ -245,7 +155,7 @@ AUTOMAKE_run ()
$AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
cat stderr >&2
cat stdout
- if test $am_using_tap != yes; then
+ if test $am_test_protocol = none; then
test $am__got_rc -eq $am__exp_rc || exit 1
return
fi
@@ -428,41 +338,6 @@ am__useless_vpath_rebuild=""
yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
-# seq_ - print a sequence of numbers
-# ----------------------------------
-# This function simulates GNU seq(1) portably. Valid usages:
-# - seq LAST
-# - seq FIRST LAST
-# - seq FIRST INCREMENT LAST
-seq_ ()
-{
- case $# in
- 0) fatal_ "seq_: missing argument";;
- 1) seq_first=1 seq_incr=1 seq_last=$1;;
- 2) seq_first=$1 seq_incr=1 seq_last=$2;;
- 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
- *) fatal_ "seq_: too many arguments";;
- esac
- i=$seq_first
- while test $i -le $seq_last; do
- echo $i
- i=$(($i + $seq_incr))
- done
-}
-
-# rm_rf_ [FILES OR DIRECTORIES ...]
-# ---------------------------------
-# Recursively remove the given files or directory, also handling the case
-# of non-writable subdirectories.
-rm_rf_ ()
-{
- test $# -gt 0 || return 0
- # Ignore failures in find, we are only interested in failures of the
- # final rm.
- find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
- rm -rf "$@"
-}
-
# count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
# -----------------------------------------------------------------------
# Check that a testsuite run driven by the parallel-tests harness has
@@ -500,37 +375,6 @@ count_test_results ()
)
}
-commented_sed_unindent_prog='
- /^$/b # Nothing to do for empty lines.
- x # Get x<indent> into pattern space.
- /^$/{ # No prior x<indent>, go prepare it.
- g # Copy this 1st non-blank line into pattern space.
- s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x<indent> in pattern space.
- } # Now: x<indent> in pattern and <line> in hold.
- G # Build x<indent>\n<line> in pattern space, and
- h # duplicate it into hold space.
- s/\n.*$// # Restore x<indent> in pattern space, and
- x # exchange with the above duplicate in hold space.
- s/^x\(.*\)\n\1// # Remove leading <indent> from <line>.
- s/^x.*\n// # Restore <line> when there is no leading <indent>.
-'
-
-# unindent [input files...]
-# -------------------------
-# Remove the "proper" amount of leading whitespace from the given files,
-# and output the result on stdout. That amount is determined by looking
-# at the leading whitespace of the first non-blank line in the input
-# files. If no input file is specified, standard input is implied.
-unindent ()
-{
- if test x"$sed_unindent_prog" = x; then
- sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \
- | sed -e "s/ *# .*//")
- fi
- sed "$sed_unindent_prog" ${1+"$@"}
-}
-sed_unindent_prog="" # Avoid interferences from the environment.
-
# get_shell_script SCRIPT-NAME
# -----------------------------
# Fetch an Automake-provided shell script from the 'lib/' directory into
@@ -654,25 +498,12 @@ require_compiler_ ()
## required by them. ##
## ----------------------------------------------------------- ##
-# Performance tests must be enabled explicitly.
-case $argv0 in
- */perf/*)
- case $AM_TESTSUITE_PERF in
- [yY]|[yY]es|1) ;;
- *) skip_ "performance tests not explicitly enabled" ;;
- esac
- ;;
-esac
-
-# Look for (and maybe set up) required tools and/or system features; skip
-# the current test if they are not found.
-for tool in : $required
-do
- # Check that each required tool is present.
- case $tool in
- :) ;;
+require_tool ()
+{
+ am_tool=$1
+ case $1 in
cc|c++|fortran|fortran77)
- require_compiler_ $tool;;
+ require_compiler_ $1;;
xsi-lib-shell)
if test x"$am_test_prefer_config_shell" = x"yes"; then
require_xsi "$SHELL"
@@ -878,94 +709,40 @@ do
;;
*)
# Generic case: the tool must support --version.
- echo "$me: running $tool --version"
- # It is not likely but possible that $tool is a special builtin,
- # in which case the shell is allowed to exit after an error. So
- # we need the subshell here. Also, some tools, like Sun cscope,
+ echo "$me: running $1 --version"
+ # It is not likely but possible that the required tool is a special
+ # builtin, in which case the shell is allowed to exit after an error.
+ # So we need the subshell here. Also, some tools, like Sun cscope,
# can be interactive without redirection.
- ($tool --version) </dev/null \
- || skip_all_ "required program '$tool' not available"
+ ($1 --version) </dev/null \
+ || skip_all_ "required program '$1' not available"
;;
esac
-done
-
-# We might need extra macros, e.g., from Libtool or Gettext.
-case " $required " in *\ libtool*) . ./t/libtool-macros.dir/get.sh;; esac
-case " $required " in *\ gettext*) . ./t/gettext-macros.dir/get.sh;; esac
+}
+process_requirements ()
+{
+ # Look for (and maybe set up) required tools and/or system features;
+ # skip the current test if they are not found.
+ for am_tool in $*; do
+ require_tool $am_tool
+ done
+ unset am_tool
+ # We might need extra macros, e.g., from Libtool or Gettext.
+ case " $required " in
+ *\ libtool*) . ./t/libtool-macros.dir/get.sh;;
+ esac
+ case " $required " in
+ *\ gettext*) . ./t/gettext-macros.dir/get.sh;;
+ esac
+}
## ---------------------------------------------------------------- ##
## Create and set up of the temporary directory used by the test. ##
-## Set up of the exit trap for cleanup of said directory. ##
## ---------------------------------------------------------------- ##
-# This might be used in testcases checking distribution-related features.
-# Test scripts are free to override this if they need to.
-distdir=$me-1.0
-
-# Set up the exit trap.
-trap 'exit_status=$?
- set +e
- cd "$am_top_builddir"
- if test $am_using_tap = yes; then
- if test "$planned_" = later && test $exit_status -eq 0; then
- plan_ "now"
- fi
- test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
- || keep_testdirs=yes
- else
- # This is to ensure that a test script does give a SKIP outcome just
- # because a command in it happens to exit with status 77. This
- # behaviour, while from time to time useful to developers, is not
- # meant to be enabled by default, as it could cause spurious failures
- # in the wild. Thus it will be enabled only when the variable
- # "am_explicit_skips" is set to a "true" value.
- case $am_explicit_skips in
- [yY]|[yY]es|1)
- if test $exit_status -eq 77 && test $am__test_skipped != yes; then
- echo "$me: implicit skip turned into failure"
- exit_status=78
- fi;;
- esac
- test $exit_status -eq 0 || keep_testdirs=yes
- fi
- am_keeping_testdirs || rm_rf_ $am_test_subdir
- set +x
- echo "$me: exit $exit_status"
- # Spurious escaping to ensure we do not call our "exit" alias.
- \exit $exit_status
-' 0
-trap "fatal_ 'caught signal SIGHUP'" 1
-trap "fatal_ 'caught signal SIGINT'" 2
-trap "fatal_ 'caught signal SIGTERM'" 15
-# Various shells seems to just ignore SIGQUIT under some circumstances,
-# even if the signal is not blocked; however, if the signal it trapped,
-# the trap gets correctly executed. So we also trap SIGQUIT.
-# Here is a list of some shells that have been verified to exhibit the
-# problematic behavior with SIGQUIT:
-# - zsh 4.3.12 on Debian GNU/Linux
-# - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
-# - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
-# - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
-# OTOH, at least these shells that do *not* exhibit that behaviour:
-# - modern version of the Almquist Shell (at least 0.5.5.1), on
-# both Solaris and GNU/Linux
-# - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
-trap "fatal_ 'caught signal SIGQUIT'" 3
-# Ignore further SIGPIPE in the trap code. This is required to avoid
-# a very weird issue with some shells, at least when the execution of
-# the automake testsuite is driven by the 'prove' utility: if prove
-# (or the make process that has spawned it) gets interrupted with
-# Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
-# sometimes finally dumping core, other times hanging indefinitely.
-# See also Test::Harness bug [rt.cpan.org #70855], archived at
-# <https://rt.cpan.org/Ticket/Display.html?id=70855>
-trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
-
-# Create and populate the temporary directory, if and as required.
-if test x"$am_create_testdir" = x"no"; then
- am_test_subdir=
-else
+am_setup_testdir ()
+{
# The subdirectory where the current test script will run and write its
# temporary/data files. This will be created shortly, and will be removed
# by the cleanup trap below if the test passes. If the test doesn't pass,
@@ -1000,12 +777,11 @@ else
echo "AC_CONFIG_FILES([Makefile])"
} >configure.ac || framework_failure_ "creating configure.ac skeleton"
fi
-fi
-
-
-## ---------------- ##
-## Ready to go... ##
-## ---------------- ##
+}
-set -x
-pwd
+am_extra_info ()
+{
+ echo "Running from installcheck: $am_running_installcheck"
+ echo "Test Protocol: $am_test_protocol"
+ echo "PATH = $PATH"
+}
diff --git a/t/ax/plain-functions.sh b/t/ax/plain-functions.sh
deleted file mode 100644
index 6c5fef82a..000000000
--- a/t/ax/plain-functions.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- shell-script -*-
-#
-# Copyright (C) 2011-2012 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/>.
-
-# Helper functions used by "plain" tests of the Automake testsuite
-# (i.e., tests that don't use any test protocol).
-
-# Print warnings (e.g., about skipped and failed tests) to this file
-# number. Override by putting, say:
-# AM_TESTS_ENVIRONMENT = stderr_fileno_=9; export stderr_fileno_;
-# AM_TESTS_FD_REDIRECT = 9>&2
-# in your Makefile.am.
-# This is useful when using automake's parallel tests mode, to print the
-# reason for skip/failure to console, rather than to the *.log files.
-: ${stderr_fileno_=2}
-
-# Copied from Gnulib's 'tests/init.sh'.
-warn_ () { echo "$@" 1>&$stderr_fileno_; }
-fail_ () { warn_ "$me: failed test: $@"; exit 1; }
-skip_ () { warn_ "$me: skipped test: $@"; exit 77; }
-fatal_ () { warn_ "$me: hard error: $@"; exit 99; }
-framework_failure_ () { warn_ "$me: set-up failure: $@"; exit 99; }
-
-# For compatibility with TAP functions.
-skip_all_ () { skip_ "$@"; }
-
-:
diff --git a/t/ax/tap-setup.sh b/t/ax/tap-setup.sh
index 70487c3e5..952a49dfa 100644
--- a/t/ax/tap-setup.sh
+++ b/t/ax/tap-setup.sh
@@ -22,7 +22,7 @@
# Check that we are running from a proper directory: last thing we want
# is to overwrite some random user files.
-test -f ../../defs-static && test -f ../../defs && test -d ../../t \
+test -f ../../automake && test -f ../../defs && test -d ../../t \
|| fatal_ "running from a wrong directory"
test ! -f Makefile.am || mv Makefile.am Makefile.am~ \
diff --git a/defs-static.in b/t/ax/test-defs.in
index 69012128a..56b45e1ca 100644
--- a/defs-static.in
+++ b/t/ax/test-defs.in
@@ -21,74 +21,15 @@
# IMPORTANT NOTES AND REQUIREMENTS
# - Multiple inclusions of this file should be idempotent.
# - This code has to be 'set -e' clean.
-# - This file should execute correctly with any system's /bin/sh
-# shell, not only with configure-time detected $SHELL and/or
-# $AM_TEST_RUNNER_SHELL.
-
-# CDPATH is evil if exported in the environment.
-CDPATH=; unset CDPATH
-
-# Be more Bourne compatible.
-# (Snippet inspired to configure's initialization in Autoconf 2.64)
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- setopt NO_GLOB_SUBST
- # If Zsh is not started directly in POSIX-compatibility mode, it has some
- # incompatibilities in the handling of $0 that conflict with our usage;
- # i.e., $0 inside a file sourced with the '.' builtin is temporarily set
- # to the name of the sourced file. Work around that.
- # Note that a bug in some versions of Zsh prevents us from resetting $0
- # in a sourced script, so the use of $argv0. For more info see:
- # <http://www.zsh.org/mla/workers/2009/msg01140.html>
- # The apparently useless 'eval' here is needed by at least dash 0.5.2,
- # to prevent it from bailing out with an error like:
- # "Syntax error: Bad substitution".
- eval 'argv0=${functrace[-1]%:*}' && test -f "$argv0" || {
- echo "Cannot determine the path of running test script." >&2
- echo "Your Zsh (version $ZSH_VERSION) is probably too old." >&2
- exit 99
- }
-else
- argv0=$0
- # Avoid command substitution failure, for Tru64 sh -e and instspc*.test.
- case `(set -o) 2>/dev/null || :` in *posix*) set -o posix;; esac
-fi
-
-# The name of the current test (without the '.sh' or '.tap' suffix).
-me=${argv0##*/} # Strip all directory components.
-case $me in # Strip test suffix.
- *.tap) me=${me%.tap};;
- *.sh) me=${me%.sh} ;;
- esac
-
-# Check that the environment is properly sanitized.
-# Having variables exported to the empty string is OK, since our code
-# treats such variables as if they were unset.
-for var in \
- required \
- am_using_tap \
- am_serial_tests \
- am_create_testdir \
- am_tap_implementation \
- am_test_prefer_config_shell \
- am_original_AUTOMAKE \
- am_original_ACLOCAL \
-; do
- if eval "test x\"\$$var\" != x" && env | grep "^$var=" >/dev/null; then
- echo "$me: variable '$var' is set in the environment:" \
- "this is unsafe" >&2
- exit 99
- fi
-done
-unset var
# See whether the current test script is expected to use TAP or not.
# Use a sensible default, while allowing the scripts to override this
# check.
-if test -z "$am_using_tap"; then
- case $argv0 in *.tap) am_using_tap=yes;; *) am_using_tap=no;; esac
+if test -z "$am_test_protocol"; then
+ case $argv0 in
+ *.tap) am_test_protocol=tap;;
+ *) am_test_protocol=none;;
+ esac
fi
am_rel_srcdir='@srcdir@'
@@ -162,8 +103,8 @@ AUTOUPDATE=${AM_TESTSUITE_AUTOUPDATE-${AUTOUPDATE-'@am_AUTOUPDATE@'}}
# Tests who want complete control over aclocal or automake command-line
# options should use $am_original_ACLOCAL or $am_original_AUTOMAKE. The
-# "test -z" tests take care not to re-initialize them if defs-static
-# is re-sourced, as we want defs-static to remain really idempotent.
+# "test -z" tests take care not to re-initialize them if 'test-defs.sh'
+# is re-sourced, as we want that file to remain really idempotent.
if test -z "$am_original_AUTOMAKE"; then
am_original_AUTOMAKE=${AM_TESTSUITE_AUTOMAKE-${AUTOMAKE-"automake-$APIVERSION"}}
fi
@@ -240,7 +181,4 @@ case $PATH in
*) PATH=$am_bindir$PATH_SEPARATOR$PATH;;
esac
-# Make our helper script accessible by default.
-PATH=$am_testauxdir$PATH_SEPARATOR$PATH
-
export PATH
diff --git a/t/ax/test-lib.sh b/t/ax/test-lib.sh
new file mode 100644
index 000000000..6048f8112
--- /dev/null
+++ b/t/ax/test-lib.sh
@@ -0,0 +1,296 @@
+# -*- shell-script -*-
+#
+# Copyright (C) 1996-2012 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/>.
+
+########################################################
+### IMPORTANT NOTE: keep this file 'set -e' clean. ###
+########################################################
+
+# Do not source several times.
+test ${test_lib_sourced-no} = yes && return 0
+test_lib_sourced=yes
+
+# CDPATH is evil if used in non-interactive scripts (and even more
+# evil if exported in the environment).
+CDPATH=; unset CDPATH
+
+# Be more Bourne compatible.
+# (Snippet inspired to configure's initialization in Autoconf 2.64)
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ setopt NO_GLOB_SUBST
+ # If Zsh is not started directly in POSIX-compatibility mode, it has some
+ # incompatibilities in the handling of $0 that conflict with our usage;
+ # i.e., $0 inside a file sourced with the '.' builtin is temporarily set
+ # to the name of the sourced file. Work around that.
+ # Note that a bug in some versions of Zsh prevents us from resetting $0
+ # in a sourced script, so the use of $argv0. For more info see:
+ # <http://www.zsh.org/mla/workers/2009/msg01140.html>
+ # The apparently useless 'eval' here is needed by at least dash 0.5.2,
+ # to prevent it from bailing out with an error like:
+ # "Syntax error: Bad substitution".
+ eval 'argv0=${functrace[-1]%:*}' && test -f "$argv0" || {
+ echo "Cannot determine the path of running test script." >&2
+ echo "Your Zsh (version $ZSH_VERSION) is probably too old." >&2
+ exit 99
+ }
+else
+ argv0=$0
+ # Avoid command substitution failure, for it might cause problems with
+ # "set -e" on some shells.
+ case `(set -o) 2>/dev/null || :` in *posix*) set -o posix;; esac
+fi
+
+# A single whitespace character.
+sp=' '
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+
+# As autoconf-generated configure scripts do, ensure that IFS
+# is defined initially, so that saving and restoring $IFS works.
+IFS=$sp$tab$nl
+
+# The name of the current test (without the '.sh' or '.tap' suffix).
+me=${argv0##*/} # Strip all directory components.
+case $me in # Strip test suffix.
+ *.tap) me=${me%.tap};;
+ *.sh) me=${me%.sh} ;;
+ esac
+
+# Source extra package-specific configuration.
+. test-defs.sh
+# And fail hard if something went wrong.
+test $? -eq 0 || exit 99
+
+# We use a trap below for cleanup. This requires us to go through
+# hoops to get the right exit status transported through the signal.
+# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
+# sh inside this function (FIXME: is this still relevant now that we
+# require a POSIX shell?).
+_am_exit ()
+{
+ set +e
+ # See comments in the exit trap for the reason we do this.
+ test 77 = $1 && am__test_skipped=yes
+ # Spurious escaping to ensure we do not call our 'exit' alias.
+ (\exit $1); \exit $1
+}
+# Avoid interferences from the environment
+am__test_skipped=no
+# This alias must actually be placed before any use if 'exit' -- even
+# just inside a function definition. Weird, but real.
+alias exit=_am_exit
+
+## ------------------------------------ ##
+## General testsuite shell functions. ##
+## ------------------------------------ ##
+
+# Print warnings (e.g., about skipped and failed tests) to this file
+# number. Override by putting, say:
+# AM_TESTS_ENVIRONMENT = stderr_fileno_=9; export stderr_fileno_;
+# AM_TESTS_FD_REDIRECT = 9>&2
+# in your Makefile.am.
+# This is useful when using automake's parallel tests mode, to print the
+# reason for skip/failure to console, rather than to the *.log files.
+: ${stderr_fileno_=2}
+
+# Helper functions used by "plain" tests of the Automake testsuite
+# (i.e., tests that don't use any test protocol).
+# TAP tests will override these functions with their TAP-enhanced
+# equivalents later (see sourcing of 'tap-functions.sh' below).
+# These are copied from Gnulib's 'tests/init.sh'.
+warn_ () { echo "$@" 1>&$stderr_fileno_; }
+fail_ () { warn_ "$me: failed test: $@"; exit 1; }
+skip_ () { warn_ "$me: skipped test: $@"; exit 77; }
+fatal_ () { warn_ "$me: hard error: $@"; exit 99; }
+framework_failure_ () { warn_ "$me: set-up failure: $@"; exit 99; }
+# For compatibility with TAP functions.
+skip_all_ () { skip_ "$@"; }
+
+if test $am_test_protocol = tap; then
+ . tap-functions.sh
+fi
+
+## ---------------------------- ##
+## Auxiliary shell functions. ##
+## ---------------------------- ##
+
+# Tell whether we should keep the test directories around, even in
+# case of success. By default, we don't.
+am_keeping_testdirs ()
+{
+ case $keep_testdirs in
+ ""|n|no|NO) return 1;;
+ *) return 0;;
+ esac
+}
+
+# seq_ - print a sequence of numbers
+# ----------------------------------
+# This function simulates GNU seq(1) portably. Valid usages:
+# - seq LAST
+# - seq FIRST LAST
+# - seq FIRST INCREMENT LAST
+seq_ ()
+{
+ case $# in
+ 0) fatal_ "seq_: missing argument";;
+ 1) seq_first=1 seq_incr=1 seq_last=$1;;
+ 2) seq_first=$1 seq_incr=1 seq_last=$2;;
+ 3) seq_first=$1 seq_incr=$2 seq_last=$3;;
+ *) fatal_ "seq_: too many arguments";;
+ esac
+ i=$seq_first
+ while test $i -le $seq_last; do
+ echo $i
+ i=$(($i + $seq_incr))
+ done
+}
+
+# rm_rf_ [FILES OR DIRECTORIES ...]
+# ---------------------------------
+# Recursively remove the given files or directory, also handling the case
+# of non-writable subdirectories.
+rm_rf_ ()
+{
+ test $# -gt 0 || return 0
+ # Ignore failures in find, we are only interested in failures of the
+ # final rm.
+ find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
+ rm -rf "$@"
+}
+
+commented_sed_unindent_prog='
+ /^$/b # Nothing to do for empty lines.
+ x # Get x<indent> into pattern space.
+ /^$/{ # No prior x<indent>, go prepare it.
+ g # Copy this 1st non-blank line into pattern space.
+ s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x<indent> in pattern space.
+ } # Now: x<indent> in pattern and <line> in hold.
+ G # Build x<indent>\n<line> in pattern space, and
+ h # duplicate it into hold space.
+ s/\n.*$// # Restore x<indent> in pattern space, and
+ x # exchange with the above duplicate in hold space.
+ s/^x\(.*\)\n\1// # Remove leading <indent> from <line>.
+ s/^x.*\n// # Restore <line> when there is no leading <indent>.
+'
+
+# unindent [input files...]
+# -------------------------
+# Remove the "proper" amount of leading whitespace from the given files,
+# and output the result on stdout. That amount is determined by looking
+# at the leading whitespace of the first non-blank line in the input
+# files. If no input file is specified, standard input is implied.
+unindent ()
+{
+ if test x"$sed_unindent_prog" = x; then
+ sed_unindent_prog=$(printf '%s\n' "$commented_sed_unindent_prog" \
+ | sed -e "s/ *# .*//")
+ fi
+ sed "$sed_unindent_prog" ${1+"$@"}
+}
+sed_unindent_prog="" # Avoid interferences from the environment.
+
+## ---------------------------------------------------------------- ##
+## Create and set up of the temporary directory used by the test. ##
+## Set up of the exit trap for cleanup of said directory. ##
+## ---------------------------------------------------------------- ##
+
+# Set up the exit trap.
+am_exit_trap ()
+{
+ exit_status=$1
+ set +e
+ cd "$am_top_builddir"
+ if test $am_test_protocol = tap; then
+ if test "$planned_" = later && test $exit_status -eq 0; then
+ plan_ "now"
+ fi
+ test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
+ || keep_testdirs=yes
+ else
+ # This is to ensure that a test script does give a SKIP outcome just
+ # because a command in it happens to exit with status 77. This
+ # behaviour, while from time to time useful to developers, is not
+ # meant to be enabled by default, as it could cause spurious failures
+ # in the wild. Thus it will be enabled only when the variable
+ # "am_explicit_skips" is set to a "true" value.
+ case $am_explicit_skips in
+ [yY]|[yY]es|1)
+ if test $exit_status -eq 77 && test $am__test_skipped != yes; then
+ echo "$me: implicit skip turned into failure"
+ exit_status=78
+ fi;;
+ esac
+ test $exit_status -eq 0 || keep_testdirs=yes
+ fi
+ am_keeping_testdirs || rm_rf_ $am_test_subdir
+ set +x
+ echo "$me: exit $exit_status"
+ # Spurious escaping to ensure we do not call our "exit" alias.
+ \exit $exit_status
+}
+
+am_set_exit_traps ()
+{
+ trap 'am_exit_trap $?' 0
+ trap "fatal_ 'caught signal SIGHUP'" 1
+ trap "fatal_ 'caught signal SIGINT'" 2
+ trap "fatal_ 'caught signal SIGTERM'" 15
+ # Various shells seems to just ignore SIGQUIT under some circumstances,
+ # even if the signal is not blocked; however, if the signal it trapped,
+ # the trap gets correctly executed. So we also trap SIGQUIT.
+ # Here is a list of some shells that have been verified to exhibit the
+ # problematic behavior with SIGQUIT:
+ # - zsh 4.3.12 on Debian GNU/Linux
+ # - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
+ # - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
+ # - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
+ # OTOH, at least these shells that do *not* exhibit that behaviour:
+ # - modern version of the Almquist Shell (at least 0.5.5.1), on
+ # both Solaris and GNU/Linux
+ # - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
+ trap "fatal_ 'caught signal SIGQUIT'" 3
+ # Ignore further SIGPIPE in the trap code. This is required to avoid
+ # a very weird issue with some shells, at least when the execution of
+ # the automake testsuite is driven by the 'prove' utility: if prove
+ # (or the make process that has spawned it) gets interrupted with
+ # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
+ # sometimes finally dumping core, other times hanging indefinitely.
+ # See also Test::Harness bug [rt.cpan.org #70855], archived at
+ # <https://rt.cpan.org/Ticket/Display.html?id=70855>
+ trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
+}
+
+am_test_setup ()
+{
+ process_requirements $required
+ am_set_exit_traps
+ # Create and populate the temporary directory, if required.
+ if test x"$am_create_testdir" = x"no"; then
+ am_test_subdir=
+ else
+ am_setup_testdir
+ fi
+ am_extra_info
+ set -x
+ pwd
+}
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index c31a658d7..6f1eeab5e 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -70,7 +70,6 @@ t/perf/testsuite-summary.sh
handwritten_TESTS = \
t/get-sysconf.sh \
$(perl_TESTS) \
-$(perf_TESTS) \
t/instspc.tap \
t/aclocal.sh \
t/aclocal3.sh \
@@ -949,7 +948,6 @@ t/repeated-options.sh \
t/rulepat.sh \
t/self-check-configure-help.sh \
t/self-check-dir.tap \
-t/self-check-env-sanitize.tap \
t/self-check-exit.tap \
t/self-check-explicit-skips.sh \
t/self-check-is_newest.tap \
@@ -957,7 +955,6 @@ t/self-check-me.tap \
t/self-check-report.sh \
t/self-check-seq.tap \
t/self-check-is-blocked-signal.tap \
-t/self-check-tap.sh \
t/self-check-unindent.tap \
t/sanity.sh \
t/scripts.sh \
diff --git a/t/primary-prefix-couples-force-valid.sh b/t/primary-prefix-couples-force-valid.sh
index 23b56c349..ac539a1e7 100755
--- a/t/primary-prefix-couples-force-valid.sh
+++ b/t/primary-prefix-couples-force-valid.sh
@@ -54,7 +54,12 @@ test:
test -f '$(bindir)/libquux.a'
ls -l '$(libexecdir)/bar.h'
test -f '$(libexecdir)/bar.h'
- test ! -x '$(libexecdir)/bar.h'
+## If this test is run as root, "test -x" could suceed also for
+## non-executable files, so we need to protect the next check.
+## See automake bug#12041.
+ if test -x Makefile; then echo SKIP THIS; else \
+ test ! -x '$(libexecdir)/bar.h'; \
+ fi;
END
cat > foo.c <<'END'
diff --git a/t/self-check-env-sanitize.tap b/t/self-check-env-sanitize.tap
deleted file mode 100755
index 3e48d895f..000000000
--- a/t/self-check-env-sanitize.tap
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011-2012 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/>.
-
-# Sanity check for the automake testsuite.
-# Make sure that the testsuite initialization code complains when
-# some testsuite-influential variables are set in the environment.
-
-am_create_testdir=no
-. ./defs || exit 1
-
-set -x
-exec 5>&1
-
-plan_ 16 # Two times the number of variable names in $vars.
-
-vars='
- required
- am_serial_tests
- am_using_tap
- am_create_testdir
- am_tap_implementation
- am_test_prefer_config_shell
- am_original_AUTOMAKE
- am_original_ACLOCAL
-'
-
-do_run ()
-{
- env "$1=foo" $AM_TEST_RUNNER_SHELL -c '. ./defs' foo.test
-}
-
-do_grep ()
-{
- env "$1=foo" $AM_TEST_RUNNER_SHELL -c '. ./defs' foo.test 2>&1 1>&5 \
- | grep "foo\.test:.* variable '$1'.* in the environment.*unsafe"
-}
-
-for var in $vars; do
- command_ok_ "$var [err status]" not do_run $var
- command_ok_ "$var [err message]" do_grep $var
-done
-
-:
diff --git a/t/self-check-tap.sh b/t/self-check-tap.sh
deleted file mode 100755
index d7f788c6b..000000000
--- a/t/self-check-tap.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2011-2012 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/>.
-
-# Sanity check for the automake testsuite.
-# Make sure that $am_using_tap gets automatically defined by
-# './defs-static', but can be overridden by the individual tests.
-
-. ./defs-static || exit 1
-
-set -ex
-
-$AM_TEST_RUNNER_SHELL -c \
- '. ./defs-static && test $am_using_tap = yes' foo.tap
-
-for name in foo.test tap tap.test foo-tap; do
- $AM_TEST_RUNNER_SHELL -c \
- '. ./defs-static && test $am_using_tap = no' $name
-done
-
-$AM_TEST_RUNNER_SHELL -c '
- am_using_tap=no
- . ./defs-static
- test $am_using_tap = no
-' foo.tap
-
-$AM_TEST_RUNNER_SHELL -c '
- am_using_tap=yes
- . ./defs-static
- test $am_using_tap = yes
-' foo.test
-
-:
diff --git a/t/tap-ambiguous-directive.sh b/t/tap-ambiguous-directive.sh
index 74f258fb7..aaf2cd06d 100755
--- a/t/tap-ambiguous-directive.sh
+++ b/t/tap-ambiguous-directive.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
1..6
diff --git a/t/tap-autonumber.sh b/t/tap-autonumber.sh
index abc4ec8c0..876245ee8 100755
--- a/t/tap-autonumber.sh
+++ b/t/tap-autonumber.sh
@@ -22,7 +22,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
1..14
diff --git a/t/tap-bailout-and-logging.sh b/t/tap-bailout-and-logging.sh
index 5b49c33cf..f87ccb361 100755
--- a/t/tap-bailout-and-logging.sh
+++ b/t/tap-bailout-and-logging.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
First line
diff --git a/t/tap-bailout-leading-space.sh b/t/tap-bailout-leading-space.sh
index d0d3096a4..dfbadba10 100755
--- a/t/tap-bailout-leading-space.sh
+++ b/t/tap-bailout-leading-space.sh
@@ -23,7 +23,7 @@
am_tap_implementation=shell
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > a.test <<END
1..1
diff --git a/t/tap-bailout-suppress-badexit.sh b/t/tap-bailout-suppress-badexit.sh
index c83ba8a81..7cd5458b7 100755
--- a/t/tap-bailout-suppress-badexit.sh
+++ b/t/tap-bailout-suppress-badexit.sh
@@ -26,7 +26,7 @@ cat > Makefile.am <<END
TESTS = $tests
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > exit.test << 'END'
#!/bin/sh
diff --git a/t/tap-bailout-suppress-later-diagnostic.sh b/t/tap-bailout-suppress-later-diagnostic.sh
index 69ac88f59..54e21fdc4 100755
--- a/t/tap-bailout-suppress-later-diagnostic.sh
+++ b/t/tap-bailout-suppress-later-diagnostic.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
echo AM_TEST_LOG_DRIVER_FLAGS = --comments >> Makefile
diff --git a/t/tap-bailout-suppress-later-errors.sh b/t/tap-bailout-suppress-later-errors.sh
index cd9aa146b..bd90f8dbd 100755
--- a/t/tap-bailout-suppress-later-errors.sh
+++ b/t/tap-bailout-suppress-later-errors.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
# Various errors that can all be squashed into a single test script.
cat > foo.test << 'END'
diff --git a/t/tap-bailout.sh b/t/tap-bailout.sh
index 91dfd2442..08f12fdf0 100755
--- a/t/tap-bailout.sh
+++ b/t/tap-bailout.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
: > exp
diff --git a/t/tap-color.sh b/t/tap-color.sh
index 2fa45d184..a3fab2f94 100755
--- a/t/tap-color.sh
+++ b/t/tap-color.sh
@@ -36,7 +36,7 @@ TESTS = all.test skip.test bail.test badplan.test noplan.test \
few.test many.test order.test afterlate.test
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test << 'END'
1..5
diff --git a/t/tap-deps.sh b/t/tap-deps.sh
index ee76e938f..8e84a63bc 100755
--- a/t/tap-deps.sh
+++ b/t/tap-deps.sh
@@ -26,7 +26,7 @@ b.log: a.log
c.log: b.log
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > a.test << 'END'
#!/bin/sh
diff --git a/t/tap-diagnostic.sh b/t/tap-diagnostic.sh
index 10b4f5b01..fc00af969 100755
--- a/t/tap-diagnostic.sh
+++ b/t/tap-diagnostic.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
metacharacters=\''"\$!&()[]<>#;^?*'
diff --git a/t/tap-empty-diagnostic.sh b/t/tap-empty-diagnostic.sh
index c92a152aa..ae0deef3c 100755
--- a/t/tap-empty-diagnostic.sh
+++ b/t/tap-empty-diagnostic.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
sed 's/\$$//' > all.test <<END
1..1$
diff --git a/t/tap-empty.sh b/t/tap-empty.sh
index 976656d25..e3d400c57 100755
--- a/t/tap-empty.sh
+++ b/t/tap-empty.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
# Empty TAP input.
: > empty.test
diff --git a/t/tap-escape-directive-2.sh b/t/tap-escape-directive-2.sh
index 30806635d..49c63981c 100755
--- a/t/tap-escape-directive-2.sh
+++ b/t/tap-escape-directive-2.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
1..8
diff --git a/t/tap-escape-directive.sh b/t/tap-escape-directive.sh
index 2fb1ad9fb..9b59c3d8b 100755
--- a/t/tap-escape-directive.sh
+++ b/t/tap-escape-directive.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
1..2
diff --git a/t/tap-exit.sh b/t/tap-exit.sh
index 09493841f..c9a9823b9 100755
--- a/t/tap-exit.sh
+++ b/t/tap-exit.sh
@@ -34,7 +34,7 @@ done
chmod a+x *.test
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
$MAKE check >stdout && { cat stdout; exit 1; }
cat stdout
diff --git a/t/tap-fancy.sh b/t/tap-fancy.sh
index f879cceab..9ca50217a 100755
--- a/t/tap-fancy.sh
+++ b/t/tap-fancy.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
#
# From manpage Test::Harness::TAP(3):
diff --git a/t/tap-fancy2.sh b/t/tap-fancy2.sh
index 88ef41209..d69cf5035 100755
--- a/t/tap-fancy2.sh
+++ b/t/tap-fancy2.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
#
# From manpage Test::Harness::TAP(3):
diff --git a/t/tap-global-log.sh b/t/tap-global-log.sh
index 85db2cb34..31e1ccb4f 100755
--- a/t/tap-global-log.sh
+++ b/t/tap-global-log.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > ok.test << 'END'
1..5
diff --git a/t/tap-global-result.sh b/t/tap-global-result.sh
index ba232c3b3..528c7bb5e 100755
--- a/t/tap-global-result.sh
+++ b/t/tap-global-result.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > ok.test <<END
1..3
diff --git a/t/tap-log.sh b/t/tap-log.sh
index 32cb475e9..2e92f2153 100755
--- a/t/tap-log.sh
+++ b/t/tap-log.sh
@@ -29,7 +29,7 @@ TESTS = pass.test skip.test xfail.test fail.test xpass.test error.test
TEST_SUITE_LOG = global.log
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
# Custom markers, for use in grepping checks.
cmarker=::: # comment marker
diff --git a/t/tap-merge-stdout-stderr.sh b/t/tap-merge-stdout-stderr.sh
index 1fe4b8563..b13d41d7f 100755
--- a/t/tap-merge-stdout-stderr.sh
+++ b/t/tap-merge-stdout-stderr.sh
@@ -27,7 +27,7 @@ AM_TEST_LOG_DRIVER_FLAGS = --comments --merge
TESTS = all.test
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
#!/bin/sh
diff --git a/t/tap-missing-plan-and-bad-exit.sh b/t/tap-missing-plan-and-bad-exit.sh
index ddd74c8a7..06a6f8880 100755
--- a/t/tap-missing-plan-and-bad-exit.sh
+++ b/t/tap-missing-plan-and-bad-exit.sh
@@ -30,7 +30,7 @@ echo TESTS = foo.test > Makefile.am
chmod a+x foo.test
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
$MAKE check >stdout && { cat stdout; exit 1; }
cat stdout
diff --git a/t/tap-msg0-bailout.sh b/t/tap-msg0-bailout.sh
index cf8918c74..bdda865a0 100755
--- a/t/tap-msg0-bailout.sh
+++ b/t/tap-msg0-bailout.sh
@@ -21,7 +21,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
echo 'Bail out! 0' > a.test
echo 'Bail out! 0.0' > b.test
diff --git a/t/tap-msg0-directive.sh b/t/tap-msg0-directive.sh
index 9859e7290..9be3816d0 100755
--- a/t/tap-msg0-directive.sh
+++ b/t/tap-msg0-directive.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test << 'END'
1..3
diff --git a/t/tap-msg0-misc.sh b/t/tap-msg0-misc.sh
index 166b78534..d7751d7d2 100755
--- a/t/tap-msg0-misc.sh
+++ b/t/tap-msg0-misc.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test << 'END'
1..14
diff --git a/t/tap-msg0-planskip.sh b/t/tap-msg0-planskip.sh
index 7602affb1..24e569c1f 100755
--- a/t/tap-msg0-planskip.sh
+++ b/t/tap-msg0-planskip.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
echo '1..0 # SKIP 0' > a.test
echo '1..0 # SKIP 0.0' > b.test
diff --git a/t/tap-msg0-result.sh b/t/tap-msg0-result.sh
index a1174bcde..f55b0559e 100755
--- a/t/tap-msg0-result.sh
+++ b/t/tap-msg0-result.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test << 'END'
1..10
diff --git a/t/tap-negative-numbers.sh b/t/tap-negative-numbers.sh
index 765442a5e..fbf54be53 100755
--- a/t/tap-negative-numbers.sh
+++ b/t/tap-negative-numbers.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
1..7
diff --git a/t/tap-no-disable-hard-error.sh b/t/tap-no-disable-hard-error.sh
index e9a109151..dc4cad34a 100755
--- a/t/tap-no-disable-hard-error.sh
+++ b/t/tap-no-disable-hard-error.sh
@@ -26,7 +26,7 @@ TEST_LOG_COMPILER = cat
TESTS = bail.test few.test noplan.test
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > bail.test <<END
1..1
diff --git a/t/tap-no-merge-stdout-stderr.sh b/t/tap-no-merge-stdout-stderr.sh
index e82b26b99..f1013156b 100755
--- a/t/tap-no-merge-stdout-stderr.sh
+++ b/t/tap-no-merge-stdout-stderr.sh
@@ -25,7 +25,7 @@ TEST_LOG_DRIVER_FLAGS = --comments
TESTS = all.test
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
#!/bin/sh
diff --git a/t/tap-no-spurious-numbers.sh b/t/tap-no-spurious-numbers.sh
index 3f994980f..81104afbc 100755
--- a/t/tap-no-spurious-numbers.sh
+++ b/t/tap-no-spurious-numbers.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > prefixes <<'END'
A
diff --git a/t/tap-no-spurious-summary.sh b/t/tap-no-spurious-summary.sh
index 85e1bbaa2..13c577c7a 100755
--- a/t/tap-no-spurious-summary.sh
+++ b/t/tap-no-spurious-summary.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
1..1
diff --git a/t/tap-no-spurious.sh b/t/tap-no-spurious.sh
index ebb58cf87..bc98a0900 100755
--- a/t/tap-no-spurious.sh
+++ b/t/tap-no-spurious.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
echo 1..5 > all.test
diff --git a/t/tap-not-ok-skip.sh b/t/tap-not-ok-skip.sh
index f73bb0395..bbb9a032a 100755
--- a/t/tap-not-ok-skip.sh
+++ b/t/tap-not-ok-skip.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
1..4
diff --git a/t/tap-number-wordboundary.sh b/t/tap-number-wordboundary.sh
index 219a15918..2d15121c3 100755
--- a/t/tap-number-wordboundary.sh
+++ b/t/tap-number-wordboundary.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
1..5
diff --git a/t/tap-numbers-leading-zero.sh b/t/tap-numbers-leading-zero.sh
index fd1c3b62d..620addfb5 100755
--- a/t/tap-numbers-leading-zero.sh
+++ b/t/tap-numbers-leading-zero.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
do_checks ()
{
diff --git a/t/tap-numeric-description.sh b/t/tap-numeric-description.sh
index 60292a76c..61bc25241 100755
--- a/t/tap-numeric-description.sh
+++ b/t/tap-numeric-description.sh
@@ -18,7 +18,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
# Some random numbers to be used as test names. The definitions below are
# selected so that $x<n> != <n> for every n >= 1. We can't use positional
diff --git a/t/tap-out-of-order.sh b/t/tap-out-of-order.sh
index e884a1e07..ff0e80614 100755
--- a/t/tap-out-of-order.sh
+++ b/t/tap-out-of-order.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > a.test <<END
1..3
diff --git a/t/tap-passthrough-exit.sh b/t/tap-passthrough-exit.sh
index 7b800d5bc..f6507e0f4 100755
--- a/t/tap-passthrough-exit.sh
+++ b/t/tap-passthrough-exit.sh
@@ -38,7 +38,7 @@ END
echo TESTS += exit-$e.test >> Makefile.am
done
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
st=0
$MAKE check || st=$?
diff --git a/t/tap-passthrough.sh b/t/tap-passthrough.sh
index 993e750e8..e2eae177f 100755
--- a/t/tap-passthrough.sh
+++ b/t/tap-passthrough.sh
@@ -24,7 +24,7 @@
weirdchars=\''"\$@!&()[]<>#;,:.^?*/'
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
#
# Only successful tests.
diff --git a/t/tap-plan-corner.sh b/t/tap-plan-corner.sh
index 86ba401e8..8fc0c7e0f 100755
--- a/t/tap-plan-corner.sh
+++ b/t/tap-plan-corner.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
# -------------------------------------------------------------------------
diff --git a/t/tap-plan-errors.sh b/t/tap-plan-errors.sh
index 21fd01312..4b6a4105f 100755
--- a/t/tap-plan-errors.sh
+++ b/t/tap-plan-errors.sh
@@ -25,7 +25,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
my_check ()
{
diff --git a/t/tap-plan-leading-zero.sh b/t/tap-plan-leading-zero.sh
index 84047a664..dc1923c9f 100755
--- a/t/tap-plan-leading-zero.sh
+++ b/t/tap-plan-leading-zero.sh
@@ -21,7 +21,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > a.test <<END
1..01
diff --git a/t/tap-plan-malformed.sh b/t/tap-plan-malformed.sh
index 68a0f474f..cf43d4728 100755
--- a/t/tap-plan-malformed.sh
+++ b/t/tap-plan-malformed.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > a.test <<END
1..1 foo
diff --git a/t/tap-plan-middle.sh b/t/tap-plan-middle.sh
index 77f16a74a..971869bf1 100755
--- a/t/tap-plan-middle.sh
+++ b/t/tap-plan-middle.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > top1.test <<END
non-TAP line, ignored
diff --git a/t/tap-plan-whitespace.sh b/t/tap-plan-whitespace.sh
index 106cad078..5cc198fea 100755
--- a/t/tap-plan-whitespace.sh
+++ b/t/tap-plan-whitespace.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
sed 's/\$$//' > foo.test <<END
1..2 $
diff --git a/t/tap-plan.sh b/t/tap-plan.sh
index 40fc8c30d..d22287033 100755
--- a/t/tap-plan.sh
+++ b/t/tap-plan.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > top.test <<END
1..3
diff --git a/t/tap-planskip-and-logging.sh b/t/tap-planskip-and-logging.sh
index 7c1e017b9..33e5f7f5d 100755
--- a/t/tap-planskip-and-logging.sh
+++ b/t/tap-planskip-and-logging.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
echo TEST_LOG_DRIVER_FLAGS = --comments >> Makefile
diff --git a/t/tap-planskip-badexit.sh b/t/tap-planskip-badexit.sh
index 1b208648f..0bcc7e315 100755
--- a/t/tap-planskip-badexit.sh
+++ b/t/tap-planskip-badexit.sh
@@ -22,7 +22,7 @@
echo TESTS = one.test two.test > Makefile.am
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > one.test <<'END'
#!/bin/sh
diff --git a/t/tap-planskip-bailout.sh b/t/tap-planskip-bailout.sh
index 255443d7b..6558a6970 100755
--- a/t/tap-planskip-bailout.sh
+++ b/t/tap-planskip-bailout.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
1..0 # SKIP
diff --git a/t/tap-planskip-case-insensitive.sh b/t/tap-planskip-case-insensitive.sh
index a67712b8d..ece3b2555 100755
--- a/t/tap-planskip-case-insensitive.sh
+++ b/t/tap-planskip-case-insensitive.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
# These nested loops below are clearer without indentation.
i=0
diff --git a/t/tap-planskip-late.sh b/t/tap-planskip-late.sh
index af337336a..678bd1949 100755
--- a/t/tap-planskip-late.sh
+++ b/t/tap-planskip-late.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > foo.test <<END
some non-TAP text, will be copied in the global log
diff --git a/t/tap-planskip-later-errors.sh b/t/tap-planskip-later-errors.sh
index 3a403c729..c8400446e 100755
--- a/t/tap-planskip-later-errors.sh
+++ b/t/tap-planskip-later-errors.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
1..0
diff --git a/t/tap-planskip-unplanned-corner.sh b/t/tap-planskip-unplanned-corner.sh
index 2ce46863c..ef9ab3c55 100755
--- a/t/tap-planskip-unplanned-corner.sh
+++ b/t/tap-planskip-unplanned-corner.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > foo.test <<END
1..0 # SKIP
diff --git a/t/tap-planskip-unplanned.sh b/t/tap-planskip-unplanned.sh
index 01e5895fb..5fa8ca52d 100755
--- a/t/tap-planskip-unplanned.sh
+++ b/t/tap-planskip-unplanned.sh
@@ -21,7 +21,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
ok 1
diff --git a/t/tap-planskip-whitespace.sh b/t/tap-planskip-whitespace.sh
index d9c54963e..5ae9d3af5 100755
--- a/t/tap-planskip-whitespace.sh
+++ b/t/tap-planskip-whitespace.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > foo.test <<END
1..0${tab}${tab} #${tab}SKIP ${tab}Strip leading & trailing ${tab}${tab}
diff --git a/t/tap-planskip.sh b/t/tap-planskip.sh
index 9e6704b28..76a72446c 100755
--- a/t/tap-planskip.sh
+++ b/t/tap-planskip.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
weirdchars=\''"$!&()[]<>#;^?*/@%=,.:'
diff --git a/t/tap-realtime.sh b/t/tap-realtime.sh
index 97b035c37..fcac95fe5 100755
--- a/t/tap-realtime.sh
+++ b/t/tap-realtime.sh
@@ -56,7 +56,7 @@ TESTS = all.test
AM_COLOR_TESTS= no
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
#! /bin/sh
diff --git a/t/tap-recheck-logs.sh b/t/tap-recheck-logs.sh
index e774f7310..1b7597e33 100755
--- a/t/tap-recheck-logs.sh
+++ b/t/tap-recheck-logs.sh
@@ -25,7 +25,7 @@ TESTS = foo.test bar.test baz.test
baz.log: zardoz
END
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
: > zardoz
diff --git a/t/tap-result-comment.sh b/t/tap-result-comment.sh
index 42907518e..714f328fd 100755
--- a/t/tap-result-comment.sh
+++ b/t/tap-result-comment.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
1..5
diff --git a/t/tap-summary-color.sh b/t/tap-summary-color.sh
index a28512b69..e9b516bbc 100755
--- a/t/tap-summary-color.sh
+++ b/t/tap-summary-color.sh
@@ -17,7 +17,7 @@
# TAP support:
# - colorized testsuite summary
-. ./defs-static
+. test-lib.sh
use_colors=yes
-. "$am_testauxdir"/tap-summary-aux.sh
+. tap-summary-aux.sh
diff --git a/t/tap-summary.sh b/t/tap-summary.sh
index deee09984..c4bd73937 100755
--- a/t/tap-summary.sh
+++ b/t/tap-summary.sh
@@ -17,7 +17,7 @@
# TAP support:
# - colorized testsuite summary
-. ./defs-static
+. test-lib.sh
use_colors=no
-. "$am_testauxdir"/tap-summary-aux.sh
+. tap-summary-aux.sh
diff --git a/t/tap-test-number-0.sh b/t/tap-test-number-0.sh
index c085da0c9..f36034930 100755
--- a/t/tap-test-number-0.sh
+++ b/t/tap-test-number-0.sh
@@ -43,7 +43,7 @@ if test $am_tap_implementation = perl; then
fi
fi
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > a.test <<END
1..1
diff --git a/t/tap-todo-skip-together.sh b/t/tap-todo-skip-together.sh
index b54013a32..dc9e160b3 100755
--- a/t/tap-todo-skip-together.sh
+++ b/t/tap-todo-skip-together.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
1..2
diff --git a/t/tap-todo-skip-whitespace.sh b/t/tap-todo-skip-whitespace.sh
index b9c882589..b979c8be5 100755
--- a/t/tap-todo-skip-whitespace.sh
+++ b/t/tap-todo-skip-whitespace.sh
@@ -20,7 +20,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > stub.tap <<END
1 # TODO
diff --git a/t/tap-todo-skip.sh b/t/tap-todo-skip.sh
index 81a8128ef..c4e47cfa3 100755
--- a/t/tap-todo-skip.sh
+++ b/t/tap-todo-skip.sh
@@ -25,7 +25,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
# ----------------------------------------------------- #
# Check all possible combinations of: #
diff --git a/t/tap-unplanned.sh b/t/tap-unplanned.sh
index e00e4b89a..75ad7bf7a 100755
--- a/t/tap-unplanned.sh
+++ b/t/tap-unplanned.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<END
1..1
diff --git a/t/tap-whitespace-normalization.sh b/t/tap-whitespace-normalization.sh
index 2b1f627b8..0cbf90bc4 100755
--- a/t/tap-whitespace-normalization.sh
+++ b/t/tap-whitespace-normalization.sh
@@ -144,7 +144,7 @@ END
chmod a+x *.test
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
# Don't care about exit status or number of test results, they should be
# checked for in many other tests.
diff --git a/t/tap-with-and-without-number.sh b/t/tap-with-and-without-number.sh
index c69a40ad6..6d69eb6f3 100755
--- a/t/tap-with-and-without-number.sh
+++ b/t/tap-with-and-without-number.sh
@@ -21,7 +21,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
cat > all.test <<'END'
1..7
diff --git a/t/tap-xfail-tests.sh b/t/tap-xfail-tests.sh
index aa86dca5d..94ae1c906 100755
--- a/t/tap-xfail-tests.sh
+++ b/t/tap-xfail-tests.sh
@@ -19,7 +19,7 @@
. ./defs || exit 1
-. "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+. tap-setup.sh
echo 'XFAIL_TESTS = $(TESTS)' >> Makefile
diff --git a/t/testsuite-summary-color.sh b/t/testsuite-summary-color.sh
index c73ca45f8..7278a2f8c 100755
--- a/t/testsuite-summary-color.sh
+++ b/t/testsuite-summary-color.sh
@@ -16,12 +16,10 @@
# Check coloring of the testsuite summary.
-. ./defs-static || exit 1
+. test-lib.sh
-use_colors=yes
-use_vpath=no
-
-. "$am_testauxdir"/testsuite-summary-checks.sh || exit 99
+use_colors=yes; use_vpath=no
+. testsuite-summary-checks.sh
./configure
diff --git a/t/testsuite-summary-count.sh b/t/testsuite-summary-count.sh
index 265eebfa4..25ecf2750 100755
--- a/t/testsuite-summary-count.sh
+++ b/t/testsuite-summary-count.sh
@@ -16,12 +16,10 @@
# Check test counts in the testsuite summary.
-. ./defs-static || exit 1
+. test-lib.sh
-use_colors=no
-use_vpath=no
-
-. "$am_testauxdir"/testsuite-summary-checks.sh || exit 99
+use_colors=no; use_vpath=no
+. testsuite-summary-checks.sh
./configure