[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {GSoC} testsuite: optimize tests on TAP for speed and against dupl
From: |
Stefano Lattarini |
Subject: |
[FYI] {GSoC} testsuite: optimize tests on TAP for speed and against duplication |
Date: |
Tue, 2 Aug 2011 00:14:07 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
The creation and configuration of common files and data used by
many tests on TAP is, with this change, factored out into a new
dedicated auxiliary test, from which those tests will depend upon.
This reduces code duplication in tests and, more importantly,
offers a noticeable speedup in the involved tests (30-40%).
* tests/tap-common-setup.test: New test, setting up the common
files and data used by various tests on TAP support.
* tests/tap-setup.sh: New file, to be sourced by tests wanting to
bring in data generated by `tap-common-setup.test'.
* tests/tap-autonumber.test: Update to use the pre-computed data
files.
* tests/tap-bailout.test: Likewise.
* tests/tap-color.test: Likewise.
* tests/tap-deps.test: Likewise.
* tests/tap-diagnostic.test: Likewise.
* tests/tap-empty-diagnostic.test: Likewise.
* tests/tap-empty.test: Likewise.
* tests/tap-escape-directive.test: Likewise.
* tests/tap-exit.test: Likewise.
* tests/tap-signal.test: Likewise.
* tests/tap-fancy.test: Likewise.
* tests/tap-fancy2.test: Likewise.
* tests/tap-global-log.test: Likewise.
* tests/tap-global-result.test: Likewise.
* tests/tap-html.test: Likewise.
* tests/tap-log.test: Likewise.
* tests/tap-merge-stdout-stderr.test: Likewise.
* tests/tap-no-merge-stdout-stderr.test: Likewise.
* tests/tap-message-0.test: Likewise.
* tests/tap-no-disable-hard-error.test: Likewise.
* tests/tap-no-spurious-summary.test: Likewise.
* tests/tap-no-spurious.test: Likewise.
* tests/tap-not-ok-skip.test: Likewise.
* tests/tap-numeric-description.test: Likewise.
* tests/tap-out-of-order.test: Likewise.
* tests/tap-passthrough.test: Likewise.
* tests/tap-passthrough-exit.test: Likewise.
* tests/tap-plan.test: Likewise.
* tests/tap-plan-corner.test: Likewise.
* tests/tap-plan-corner2.test: Likewise.
* tests/tap-plan-errors.test: Likewise.
* tests/tap-realtime.test: Likewise.
* tests/tap-recheck-logs.test: Likewise.
* tests/tap-skip-whole.test: Likewise.
* tests/tap-todo-skip-together.test: Likewise.
* tests/tap-todo-skip-whitespace.test: Likewise.
* tests/tap-todo-skip.test: Likewise.
* tests/tap-unplanned.test: Likewise.
* tests/tap-with-and-without-number.test: Likewise.
* tests/tap-xfail-tests.test: Likewise.
* tests/tap-skip-whole-whitespace.test: Likewise, and remove
redundant definitions of `$sp' and `$tab' (they are already
defined in `tests/defs').
* tests/tap-whitespace-normalization.test: Likewise.
* tests/Makefile.am (TESTS): Update.
(EXTRA_DIST): Distribute `tap-setup.sh'.
(tap_with_common_setup_tests, tap_with_common_setup_logs)): New
variables, holding respectively the list of tests using the files
pre-computed by `tap-common-setup.test', and the list of their
corresponding log files.
(tap_other_tests): New variable, holding the list of other tests
on TAP support.
($(tap_with_common_setup_logs)): Depend on `tap-common-setup.log'
and `tap-setup.sh'.
---
ChangeLog | 68 +++++++++++++++++
tests/Makefile.am | 117 +++++++++++++++++-------------
tests/Makefile.in | 120 ++++++++++++++++++-------------
tests/tap-autonumber.test | 23 +------
tests/tap-bailout.test | 23 +-----
tests/tap-color.test | 17 +----
tests/tap-common-setup.test | 47 ++++++++++++
tests/tap-deps.test | 11 +---
tests/tap-diagnostic.test | 20 +-----
tests/tap-empty-diagnostic.test | 16 +----
tests/tap-empty.test | 20 +-----
tests/tap-escape-directive.test | 14 +----
tests/tap-exit.test | 20 +-----
tests/tap-fancy.test | 20 +-----
tests/tap-fancy2.test | 14 +----
tests/tap-global-log.test | 22 +-----
tests/tap-global-result.test | 28 +-------
tests/tap-html.test | 17 +----
tests/tap-log.test | 17 +----
tests/tap-merge-stdout-stderr.test | 16 +----
tests/tap-message-0.test | 20 +-----
tests/tap-no-disable-hard-error.test | 17 +----
tests/tap-no-merge-stdout-stderr.test | 15 +----
tests/tap-no-spurious-summary.test | 20 +-----
tests/tap-no-spurious.test | 14 +----
tests/tap-not-ok-skip.test | 20 +-----
tests/tap-numeric-description.test | 20 +-----
tests/tap-out-of-order.test | 18 +----
tests/tap-passthrough-exit.test | 15 +----
tests/tap-passthrough.test | 20 +-----
tests/tap-plan-corner.test | 20 +-----
tests/tap-plan-corner2.test | 20 +-----
tests/tap-plan-errors.test | 26 +------
tests/tap-plan.test | 22 +-----
tests/tap-realtime.test | 16 +----
tests/tap-recheck-logs.test | 17 +----
tests/tap-setup.sh | 48 ++++++++++++
tests/tap-signal.test | 20 +-----
tests/tap-skip-whole-whitespace.test | 26 +------
tests/tap-skip-whole.test | 25 +------
tests/tap-todo-skip-together.test | 20 +-----
tests/tap-todo-skip-whitespace.test | 20 +-----
tests/tap-todo-skip.test | 20 +-----
tests/tap-unplanned.test | 66 ++++++-----------
tests/tap-whitespace-normalization.test | 18 +-----
tests/tap-with-and-without-number.test | 20 +-----
tests/tap-xfail-tests.test | 39 +++-------
47 files changed, 403 insertions(+), 869 deletions(-)
create mode 100755 tests/tap-common-setup.test
create mode 100755 tests/tap-setup.sh
diff --git a/ChangeLog b/ChangeLog
index 039f043..c7f5836 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,73 @@
2011-08-01 Stefano Lattarini <address@hidden>
+ testsuite: optimize tests on TAP for speed and against duplication
+ The creation and configuration of common files and data used by
+ many tests on TAP is, with this change, factored out into a new
+ dedicated auxiliary test, from which those tests will depend upon.
+ This reduces code duplication in tests and, more importantly,
+ offers a noticeable speedup in the involved tests (30-40%).
+ * tests/tap-common-setup.test: New test, setting up the common
+ files and data used by various tests on TAP support.
+ * tests/tap-setup.sh: New file, to be sourced by tests wanting to
+ bring in data generated by `tap-common-setup.test'.
+ * tests/tap-autonumber.test: Update to use the pre-computed data
+ files.
+ * tests/tap-bailout.test: Likewise.
+ * tests/tap-color.test: Likewise.
+ * tests/tap-deps.test: Likewise.
+ * tests/tap-diagnostic.test: Likewise.
+ * tests/tap-empty-diagnostic.test: Likewise.
+ * tests/tap-empty.test: Likewise.
+ * tests/tap-escape-directive.test: Likewise.
+ * tests/tap-exit.test: Likewise.
+ * tests/tap-signal.test: Likewise.
+ * tests/tap-fancy.test: Likewise.
+ * tests/tap-fancy2.test: Likewise.
+ * tests/tap-global-log.test: Likewise.
+ * tests/tap-global-result.test: Likewise.
+ * tests/tap-html.test: Likewise.
+ * tests/tap-log.test: Likewise.
+ * tests/tap-merge-stdout-stderr.test: Likewise.
+ * tests/tap-no-merge-stdout-stderr.test: Likewise.
+ * tests/tap-message-0.test: Likewise.
+ * tests/tap-no-disable-hard-error.test: Likewise.
+ * tests/tap-no-spurious-summary.test: Likewise.
+ * tests/tap-no-spurious.test: Likewise.
+ * tests/tap-not-ok-skip.test: Likewise.
+ * tests/tap-numeric-description.test: Likewise.
+ * tests/tap-out-of-order.test: Likewise.
+ * tests/tap-passthrough.test: Likewise.
+ * tests/tap-passthrough-exit.test: Likewise.
+ * tests/tap-plan.test: Likewise.
+ * tests/tap-plan-corner.test: Likewise.
+ * tests/tap-plan-corner2.test: Likewise.
+ * tests/tap-plan-errors.test: Likewise.
+ * tests/tap-realtime.test: Likewise.
+ * tests/tap-recheck-logs.test: Likewise.
+ * tests/tap-skip-whole.test: Likewise.
+ * tests/tap-todo-skip-together.test: Likewise.
+ * tests/tap-todo-skip-whitespace.test: Likewise.
+ * tests/tap-todo-skip.test: Likewise.
+ * tests/tap-unplanned.test: Likewise.
+ * tests/tap-with-and-without-number.test: Likewise.
+ * tests/tap-xfail-tests.test: Likewise.
+ * tests/tap-skip-whole-whitespace.test: Likewise, and remove
+ redundant definitions of `$sp' and `$tab' (they are already
+ defined in `tests/defs').
+ * tests/tap-whitespace-normalization.test: Likewise.
+ * tests/Makefile.am (TESTS): Update.
+ (EXTRA_DIST): Distribute `tap-setup.sh'.
+ (tap_with_common_setup_tests, tap_with_common_setup_logs)): New
+ variables, holding respectively the list of tests using the files
+ pre-computed by `tap-common-setup.test', and the list of their
+ corresponding log files.
+ (tap_other_tests): New variable, holding the list of other tests
+ on TAP support.
+ ($(tap_with_common_setup_logs)): Depend on `tap-common-setup.log'
+ and `tap-setup.sh'.
+
+2011-08-01 Stefano Lattarini <address@hidden>
+
test harness: use new `.trs' files to hold test metadata
With this change, the test harness will keep test metadata in
dedicated `.trs' files, instead of having them embedded into the
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 104f70b..09e5340 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -994,55 +994,8 @@ suffix13.test \
symlink.test \
symlink2.test \
syntax.test \
-tap-autonumber.test \
-tap-bad-prog.test \
-tap-bailout.test \
-tap-basic.test \
-tap-color.test \
-tap-deps.test \
-tap-diagnostic.test \
-tap-doc.test \
-tap-empty.test \
-tap-empty-diagnostic.test \
-tap-escape-directive.test \
-tap-exit.test \
-tap-signal.test \
-tap-fancy.test \
-tap-fancy2.test \
-tap-global-log.test \
-tap-global-result.test \
-tap-html.test \
-tap-log.test \
-tap-more.test \
-tap-more2.test \
-tap-message-0.test \
-tap-merge-stdout-stderr.test \
-tap-no-merge-stdout-stderr.test \
-tap-no-disable-hard-error.test \
-tap-no-spurious-summary.test \
-tap-no-spurious.test \
-tap-not-ok-skip.test \
-tap-numeric-description.test \
-tap-out-of-order.test \
-tap-passthrough.test \
-tap-passthrough-exit.test \
-tap-plan.test \
-tap-plan-errors.test \
-tap-plan-corner.test \
-tap-plan-corner2.test \
-tap-realtime.test \
-tap-recheck-logs.test \
-tap-recheck.test \
-tap-summary.test \
-tap-skip-whole.test \
-tap-skip-whole-whitespace.test \
-tap-todo-skip.test \
-tap-todo-skip-whitespace.test \
-tap-todo-skip-together.test \
-tap-unplanned.test \
-tap-whitespace-normalization.test \
-tap-with-and-without-number.test \
-tap-xfail-tests.test \
+$(tap_with_common_setup_tests) \
+$(tap_other_tests) \
tags.test \
tags2.test \
tagsub.test \
@@ -1170,6 +1123,72 @@ EXTRA_DIST += extract-testsuite-summary
testsuite-summary-count-many.log: trivial-test-driver
testsuite-summary-count-many.log: extract-testsuite-summary
+# List of tests on TAP support that use the files pre-computed by
+# `tap-common-setup.test', and sources the `tap-setup.sh' helper
+# script.
+tap_with_common_setup_tests = \
+tap-autonumber.test \
+tap-bailout.test \
+tap-color.test \
+tap-deps.test \
+tap-diagnostic.test \
+tap-empty-diagnostic.test \
+tap-empty.test \
+tap-escape-directive.test \
+tap-exit.test \
+tap-signal.test \
+tap-fancy.test \
+tap-fancy2.test \
+tap-global-log.test \
+tap-global-result.test \
+tap-html.test \
+tap-log.test \
+tap-merge-stdout-stderr.test \
+tap-no-merge-stdout-stderr.test \
+tap-message-0.test \
+tap-no-disable-hard-error.test \
+tap-no-spurious-summary.test \
+tap-no-spurious.test \
+tap-not-ok-skip.test \
+tap-numeric-description.test \
+tap-out-of-order.test \
+tap-passthrough.test \
+tap-passthrough-exit.test \
+tap-plan.test \
+tap-plan-corner.test \
+tap-plan-corner2.test \
+tap-plan-errors.test \
+tap-realtime.test \
+tap-recheck-logs.test \
+tap-skip-whole-whitespace.test \
+tap-skip-whole.test \
+tap-todo-skip-together.test \
+tap-todo-skip-whitespace.test \
+tap-todo-skip.test \
+tap-unplanned.test \
+tap-whitespace-normalization.test \
+tap-with-and-without-number.test \
+tap-xfail-tests.test
+
+# Their log files.
+tap_with_common_setup_logs = $(tap_with_common_setup_tests:.test=.log)
+
+# Their dependencies.
+$(tap_with_common_setup_logs): tap-common-setup.log tap-setup.sh
+EXTRA_DIST += tap-setup.sh
+
+# Other tests on TAP support.
+tap_other_tests = \
+tap-common-setup.test \
+tap-bad-prog.test \
+tap-basic.test \
+tap-doc.test \
+tap-empty.test \
+tap-more.test \
+tap-more2.test \
+tap-recheck.test \
+tap-summary.test
+
# Dependencies valid for each test case.
$(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 1732555..065a772 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -276,7 +276,7 @@ top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(parallel_tests) $(instspc_tests)
EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.sh \
$(TESTS) trivial-test-driver testsuite-summary-checks.sh \
- extract-testsuite-summary
+ extract-testsuite-summary tap-setup.sh
XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
override-conditional-2.test pr8365-remake-timing.test \
yacc-dist-nobuild-subdir.test tap-bad-prog.test \
@@ -1245,55 +1245,8 @@ suffix13.test \
symlink.test \
symlink2.test \
syntax.test \
-tap-autonumber.test \
-tap-bad-prog.test \
-tap-bailout.test \
-tap-basic.test \
-tap-color.test \
-tap-deps.test \
-tap-diagnostic.test \
-tap-doc.test \
-tap-empty.test \
-tap-empty-diagnostic.test \
-tap-escape-directive.test \
-tap-exit.test \
-tap-signal.test \
-tap-fancy.test \
-tap-fancy2.test \
-tap-global-log.test \
-tap-global-result.test \
-tap-html.test \
-tap-log.test \
-tap-more.test \
-tap-more2.test \
-tap-message-0.test \
-tap-merge-stdout-stderr.test \
-tap-no-merge-stdout-stderr.test \
-tap-no-disable-hard-error.test \
-tap-no-spurious-summary.test \
-tap-no-spurious.test \
-tap-not-ok-skip.test \
-tap-numeric-description.test \
-tap-out-of-order.test \
-tap-passthrough.test \
-tap-passthrough-exit.test \
-tap-plan.test \
-tap-plan-errors.test \
-tap-plan-corner.test \
-tap-plan-corner2.test \
-tap-realtime.test \
-tap-recheck-logs.test \
-tap-recheck.test \
-tap-summary.test \
-tap-skip-whole.test \
-tap-skip-whole-whitespace.test \
-tap-todo-skip.test \
-tap-todo-skip-whitespace.test \
-tap-todo-skip-together.test \
-tap-unplanned.test \
-tap-whitespace-normalization.test \
-tap-with-and-without-number.test \
-tap-xfail-tests.test \
+$(tap_with_common_setup_tests) \
+$(tap_other_tests) \
tags.test \
tags2.test \
tagsub.test \
@@ -1405,6 +1358,70 @@ yflags-force-conditional.test \
yflags-var-expand.test \
$(parallel_tests)
+
+# List of tests on TAP support that use the files pre-computed by
+# `tap-common-setup.test', and sources the `tap-setup.sh' helper
+# script.
+tap_with_common_setup_tests = \
+tap-autonumber.test \
+tap-bailout.test \
+tap-color.test \
+tap-deps.test \
+tap-diagnostic.test \
+tap-empty-diagnostic.test \
+tap-empty.test \
+tap-escape-directive.test \
+tap-exit.test \
+tap-signal.test \
+tap-fancy.test \
+tap-fancy2.test \
+tap-global-log.test \
+tap-global-result.test \
+tap-html.test \
+tap-log.test \
+tap-merge-stdout-stderr.test \
+tap-no-merge-stdout-stderr.test \
+tap-message-0.test \
+tap-no-disable-hard-error.test \
+tap-no-spurious-summary.test \
+tap-no-spurious.test \
+tap-not-ok-skip.test \
+tap-numeric-description.test \
+tap-out-of-order.test \
+tap-passthrough.test \
+tap-passthrough-exit.test \
+tap-plan.test \
+tap-plan-corner.test \
+tap-plan-corner2.test \
+tap-plan-errors.test \
+tap-realtime.test \
+tap-recheck-logs.test \
+tap-skip-whole-whitespace.test \
+tap-skip-whole.test \
+tap-todo-skip-together.test \
+tap-todo-skip-whitespace.test \
+tap-todo-skip.test \
+tap-unplanned.test \
+tap-whitespace-normalization.test \
+tap-with-and-without-number.test \
+tap-xfail-tests.test
+
+
+# Their log files.
+tap_with_common_setup_logs = $(tap_with_common_setup_tests:.test=.log)
+
+# Other tests on TAP support.
+tap_other_tests = \
+tap-common-setup.test \
+tap-bad-prog.test \
+tap-basic.test \
+tap-doc.test \
+tap-empty.test \
+tap-more.test \
+tap-more2.test \
+tap-recheck.test \
+tap-summary.test
+
all: all-am
.SUFFIXES:
@@ -1861,6 +1878,9 @@ testsuite-summary-color.log testsuite-summary-count.log: \
testsuite-summary-count-many.log: trivial-test-driver
testsuite-summary-count-many.log: extract-testsuite-summary
+# Their dependencies.
+$(tap_with_common_setup_logs): tap-common-setup.log tap-setup.sh
+
# Dependencies valid for each test case.
$(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
diff --git a/tests/tap-autonumber.test b/tests/tap-autonumber.test
index 745a639..12dec11 100755
--- a/tests/tap-autonumber.test
+++ b/tests/tap-autonumber.test
@@ -23,20 +23,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-EXTRA_DIST = $(TESTS)
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<'END'
1..14
@@ -58,13 +45,7 @@ not ok
ok
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
-$MAKE check >stdout && { cat stdout; Exit 1; }
+TESTS=all.test $MAKE -e check >stdout && { cat stdout; Exit 1; }
cat stdout
count_test_results total=14 pass=6 fail=5 xpass=1 xfail=1 skip=1 error=0
diff --git a/tests/tap-bailout.test b/tests/tap-bailout.test
index 6c0a588..8354b27 100755
--- a/tests/tap-bailout.test
+++ b/tests/tap-bailout.test
@@ -20,19 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = a.test b.test c.test d.test e.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
: > exp
@@ -131,13 +119,8 @@ echo "ERROR: e.test - Bail out!" >> exp
# Doing the sums above, we have:
test_counts='total=12 pass=3 fail=1 xpass=1 xfail=1 skip=1 error=5'
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
-$MAKE check >stdout && { cat stdout; Exit 1; }
+TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \
+ && { cat stdout; Exit 1; }
cat stdout
count_test_results $test_counts
diff --git a/tests/tap-color.test b/tests/tap-color.test
index 82c0b51..dbd6629 100755
--- a/tests/tap-color.test
+++ b/tests/tap-color.test
@@ -20,9 +20,6 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
TERM=ansi; export TERM
esc=''
@@ -42,20 +39,16 @@ case `echo "$std" | grep .` in
*) echo "$me: grep can't parse nonprinting characters" >&2; Exit 77;;
esac
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
AUTOMAKE_OPTIONS = color-tests
AM_TEST_LOG_DRIVER_FLAGS = --comments
TEST_LOG_COMPILER = cat
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TESTS = all.test skip.test bail.test badplan.test noplan.test \
few.test many.test order.test
END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
cat > all.test << 'END'
1..5
ok 1 - foo
@@ -102,12 +95,6 @@ cat > order.test << 'END'
ok 5
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
AM_COLOR_TESTS=always $MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-common-setup.test b/tests/tap-common-setup.test
new file mode 100755
index 0000000..de8ff2c
--- /dev/null
+++ b/tests/tap-common-setup.test
@@ -0,0 +1,47 @@
+#! /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/>.
+
+# Auxiliary test to set up common data used by many tests on TAP support.
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+cp "$top_testsrcdir"/lib/tap-driver . \
+ || fatal_ "failed to fetch auxiliary script tap-driver"
+
+cat >> configure.in << END
+AC_SUBST([PERL], ['$PERL'])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
+TEST_LOG_COMPILER = cat
+TESTS = all.test
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+rm -rf autom4te*.cache
+
+# So that the data files we've created won't be removed at exit.
+keep_testdirs=yes
+
+:
diff --git a/tests/tap-deps.test b/tests/tap-deps.test
index ec74485..b86d235 100755
--- a/tests/tap-deps.test
+++ b/tests/tap-deps.test
@@ -20,22 +20,15 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
# The tests are *deliberately* listed in inversed order here.
TESTS = c.test b.test a.test
b.log: a.log
c.log: b.log
END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
cat > a.test << 'END'
#!/bin/sh
echo 1..2
diff --git a/tests/tap-diagnostic.test b/tests/tap-diagnostic.test
index caef651..73ab45e 100755
--- a/tests/tap-diagnostic.test
+++ b/tests/tap-diagnostic.test
@@ -21,19 +21,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
metacharacters=\''"\$!&()[]<>#;^?*'
@@ -65,12 +53,6 @@ PASS: all.test 4 - zardoz
# all.test: Shell metacharacters here: $metacharacters
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
$MAKE check >stdout || { cat stdout; Exit 1; }
cat stdout
$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
diff --git a/tests/tap-empty-diagnostic.test b/tests/tap-empty-diagnostic.test
index 0edea13..2dcc880 100755
--- a/tests/tap-empty-diagnostic.test
+++ b/tests/tap-empty-diagnostic.test
@@ -20,20 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-AM_TEST_LOG_DRIVER_FLAGS = --comments
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
sed 's/\$$//' > all.test <<END
1..1$
@@ -53,6 +40,7 @@ $AUTOMAKE
$MAKE check >stdout || { cat stdout; Exit 1; }
cat stdout
+grep '^PASS:.*all\.test' stdout # Sanity check.
grep '#.*all\.test' stdout && Exit 1
grep "all\.test[ $tab]*:[ $tab]*$" stdout && Exit 1
diff --git a/tests/tap-empty.test b/tests/tap-empty.test
index 565c134..557b7c7 100755
--- a/tests/tap-empty.test
+++ b/tests/tap-empty.test
@@ -21,25 +21,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
# Empty TAP input.
: > empty.test
diff --git a/tests/tap-escape-directive.test b/tests/tap-escape-directive.test
index fb333ba..2f8cb73 100755
--- a/tests/tap-escape-directive.test
+++ b/tests/tap-escape-directive.test
@@ -20,19 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<'END'
1..2
diff --git a/tests/tap-exit.test b/tests/tap-exit.test
index 07209d1..381adff 100755
--- a/tests/tap-exit.test
+++ b/tests/tap-exit.test
@@ -22,19 +22,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TESTS =
-END
-
+echo TESTS = > Makefile.am
for st in 1 2 77 99; do
unindent > exit${st}.test <<END
#!/bin/sh
@@ -47,11 +35,7 @@ done
chmod a+x *.test
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
$MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-fancy.test b/tests/tap-fancy.test
index 68612de..3348db7 100755
--- a/tests/tap-fancy.test
+++ b/tests/tap-fancy.test
@@ -20,25 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
#
# From manpage Test::Harness::TAP(3):
diff --git a/tests/tap-fancy2.test b/tests/tap-fancy2.test
index 977d38f..ddd64ea 100755
--- a/tests/tap-fancy2.test
+++ b/tests/tap-fancy2.test
@@ -20,19 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
#
# From manpage Test::Harness::TAP(3):
diff --git a/tests/tap-global-log.test b/tests/tap-global-log.test
index da5aeb8..a4f6428 100755
--- a/tests/tap-global-log.test
+++ b/tests/tap-global-log.test
@@ -20,13 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > ok.test << 'END'
1..5
@@ -108,20 +102,8 @@ cat > skipall.test << 'END'
1..0 # SKIP all
END
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-END
-echo TESTS = *.test >> Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
# We don't care about the exit status of "make check" here.
-$MAKE check || :
+TESTS="`echo *.test`" $MAKE -e check || :
cat test-suite.log
grep 'ok\.test|not seen' test-suite.log && Exit 1
diff --git a/tests/tap-global-result.test b/tests/tap-global-result.test
index d2e593e..c49fae4 100755
--- a/tests/tap-global-result.test
+++ b/tests/tap-global-result.test
@@ -21,25 +21,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = \
- ok.test \
- skip.test skipall.test \
- fail.test fail2.test \
- xpass.test xpass2.test \
- error.test error2.test \
- hodgepodge.test hodgepodge-all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > ok.test <<END
1..3
@@ -97,13 +79,7 @@ END
# TODO: add scripts with TAP errors (multiple plans, out-of-order
# tests, etc).
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
-$MAKE check >stdout && { cat stdout; Exit 1; }
+TESTS="`echo *.test`" $MAKE -e check >stdout && { cat stdout; Exit 1; }
cat stdout
for tst in ok skip skipall fail fail2 xpass xpass2 error error2 \
diff --git a/tests/tap-html.test b/tests/tap-html.test
index 12dcb36..b5a1beb 100755
--- a/tests/tap-html.test
+++ b/tests/tap-html.test
@@ -21,20 +21,13 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TEST_LOG_COMPILER = cat
TESTS = ok.test ko.test
END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
cat > ok.test << 'END'
1..3
ok 1 - expected success
@@ -49,12 +42,6 @@ ok 2 - spurious success # TODO
Bail out! hard error
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
no_rst2html_error ()
{
$EGREP '(test-suite\.log:[0-9]|WARNING|SEVERE)' output && Exit 1
diff --git a/tests/tap-log.test b/tests/tap-log.test
index e5bab2f..eecb2a2 100755
--- a/tests/tap-log.test
+++ b/tests/tap-log.test
@@ -25,20 +25,13 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TESTS = pass.test skip.test xfail.test fail.test xpass.test error.test
TEST_SUITE_LOG = global.log
END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
# Custom markers, for use in grepping checks.
cmarker=::: # comment marker
pmarker=%%% # plain maker
@@ -93,12 +86,6 @@ END
chmod a+x *.test
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-./configure
-
TEST_SUITE_LOG=my.log $MAKE -e check && Exit 1
ls -l # For debugging.
test ! -f test-suite.log
diff --git a/tests/tap-merge-stdout-stderr.test
b/tests/tap-merge-stdout-stderr.test
index e73f0ec..787ad51 100755
--- a/tests/tap-merge-stdout-stderr.test
+++ b/tests/tap-merge-stdout-stderr.test
@@ -24,25 +24,12 @@ parallel_tests=yes
cp "$top_testsrcdir"/lib/tap-driver . \
|| fatal_ "failed to fetch auxiliary script tap-driver"
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
AM_TEST_LOG_DRIVER_FLAGS = --comments --merge
TESTS = all.test
END
-: > all.test # Updated later.
-chmod a+x all.test
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<END
#!/bin/sh
@@ -53,6 +40,7 @@ echo "not ok 3 # TODO" >&2
echo "ok 4 # SKIP"
echo "# foo foo foo" >&2
END
+chmod a+x all.test
$MAKE check >stdout || { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-message-0.test b/tests/tap-message-0.test
index 9f16171..bce333f 100755
--- a/tests/tap-message-0.test
+++ b/tests/tap-message-0.test
@@ -23,19 +23,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test << 'END'
1..10
@@ -51,12 +39,6 @@ not ok 9 0 # TODO 0
ok 10 0 # SKIP 0
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
$MAKE check >stdout || { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-no-disable-hard-error.test
b/tests/tap-no-disable-hard-error.test
index a2f88f9..678e184 100755
--- a/tests/tap-no-disable-hard-error.test
+++ b/tests/tap-no-disable-hard-error.test
@@ -21,21 +21,14 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
DISABLE_HARD_ERRORS = yes
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TEST_LOG_COMPILER = cat
TESTS = bail.test few.test noplan.test
END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
cat > bail.test <<END
1..1
Bail out!
@@ -49,12 +42,6 @@ cat > noplan.test <<END
# nothing here
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
$MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-no-merge-stdout-stderr.test
b/tests/tap-no-merge-stdout-stderr.test
index c2995b2..25a06fd 100755
--- a/tests/tap-no-merge-stdout-stderr.test
+++ b/tests/tap-no-merge-stdout-stderr.test
@@ -21,25 +21,12 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TEST_LOG_DRIVER_FLAGS = --comments
TESTS = all.test
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<END
#!/bin/sh
diff --git a/tests/tap-no-spurious-summary.test
b/tests/tap-no-spurious-summary.test
index 4c358da..bc7fd51 100755
--- a/tests/tap-no-spurious-summary.test
+++ b/tests/tap-no-spurious-summary.test
@@ -21,19 +21,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<'END'
1..1
@@ -47,12 +35,6 @@ cat > all.test <<'END'
ok 1
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
$MAKE check >stdout || { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-no-spurious.test b/tests/tap-no-spurious.test
index cfe7dbd..91b115f 100755
--- a/tests/tap-no-spurious.test
+++ b/tests/tap-no-spurious.test
@@ -21,19 +21,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
echo 1..5 > all.test
diff --git a/tests/tap-not-ok-skip.test b/tests/tap-not-ok-skip.test
index 57b8d7a..f154d23 100755
--- a/tests/tap-not-ok-skip.test
+++ b/tests/tap-not-ok-skip.test
@@ -21,19 +21,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<'END'
1..4
@@ -43,12 +31,6 @@ not ok - foo # SKIP
not ok 4 - bar # SKIP
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
$MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-numeric-description.test
b/tests/tap-numeric-description.test
index a2b4f79..ea01038 100755
--- a/tests/tap-numeric-description.test
+++ b/tests/tap-numeric-description.test
@@ -19,19 +19,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing 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
@@ -66,12 +54,6 @@ XPASS: all.test 9 ${x9} # TODO
XPASS: all.test 10 - ${x10} # TODO
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
$MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-out-of-order.test b/tests/tap-out-of-order.test
index 2639e2c..f8f69c7 100755
--- a/tests/tap-out-of-order.test
+++ b/tests/tap-out-of-order.test
@@ -20,19 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = a.test b.test c.test d.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > a.test <<END
1..3
@@ -76,7 +64,9 @@ $AUTOMAKE
./configure
-$MAKE check >stdout && { cat stdout; Exit 1; }
+
+TESTS='a.test b.test c.test d.test' $MAKE -e check >stdout \
+ && { cat stdout; Exit 1; }
cat stdout
count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8
diff --git a/tests/tap-passthrough-exit.test b/tests/tap-passthrough-exit.test
index 98213a3..ae8ffa8 100755
--- a/tests/tap-passthrough-exit.test
+++ b/tests/tap-passthrough-exit.test
@@ -22,16 +22,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TEST_LOG_COMPILER = $(SHELL)
TESTS =
END
@@ -48,11 +39,7 @@ END
echo TESTS += exit-$e.test >> Makefile.am
done
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
st=0
$MAKE check || st=$?
diff --git a/tests/tap-passthrough.test b/tests/tap-passthrough.test
index b4a7c12..ba773ed 100755
--- a/tests/tap-passthrough.test
+++ b/tests/tap-passthrough.test
@@ -23,27 +23,9 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS =
-END
-
weirdchars=\''"address@hidden&()[]<>#;,:.^?*/'
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
#
# Only successful tests.
diff --git a/tests/tap-plan-corner.test b/tests/tap-plan-corner.test
index 7f46263..4215556 100755
--- a/tests/tap-plan-corner.test
+++ b/tests/tap-plan-corner.test
@@ -20,25 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > leading-repeated-1.test <<END
1..1
diff --git a/tests/tap-plan-corner2.test b/tests/tap-plan-corner2.test
index 155cf85..54fd5e9 100755
--- a/tests/tap-plan-corner2.test
+++ b/tests/tap-plan-corner2.test
@@ -20,25 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
# The leading blank line is meant.
cat > leading-blank.test <<END
diff --git a/tests/tap-plan-errors.test b/tests/tap-plan-errors.test
index 539cb8f..fd12e1b 100755
--- a/tests/tap-plan-errors.test
+++ b/tests/tap-plan-errors.test
@@ -26,35 +26,17 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = foo.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
my_check ()
{
- cat > foo.test
+ cat > all.test
test -n "$err" || fatal_ "\$err not set before calling my_check"
- cat foo.test # For debugging.
+ cat all.test # For debugging.
$MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
count_test_results "$@"
- grep "^ERROR: foo\\.test - $err$" stdout
+ grep "^ERROR: all\\.test - $err$" stdout
unset err
}
diff --git a/tests/tap-plan.test b/tests/tap-plan.test
index 10fa377..79e9bdd 100755
--- a/tests/tap-plan.test
+++ b/tests/tap-plan.test
@@ -22,25 +22,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = top.test bot.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > top.test <<END
1..3
@@ -62,7 +44,7 @@ END
# Check that the plans doesn't cause any problem
-$MAKE check >stdout || { cat stdout; Exit 1; }
+TESTS='top.test bot.test' $MAKE -e check >stdout || { cat stdout; Exit 1; }
cat stdout
count_test_results total=7 pass=5 xfail=1 skip=1 fail=0 xpass=0 error=0
diff --git a/tests/tap-realtime.test b/tests/tap-realtime.test
index 0f43e9e..4a38f14 100755
--- a/tests/tap-realtime.test
+++ b/tests/tap-realtime.test
@@ -35,18 +35,10 @@ expect -f expect-check || {
}
rm -f expect-check
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TESTS = all.test
END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<'END'
#! /bin/sh
@@ -72,12 +64,6 @@ END
chmod a+x all.test
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
cat > expect-make <<'END'
eval spawn $env(MAKE) check
expect {
diff --git a/tests/tap-recheck-logs.test b/tests/tap-recheck-logs.test
index a3484bb..6e1b646 100755
--- a/tests/tap-recheck-logs.test
+++ b/tests/tap-recheck-logs.test
@@ -20,21 +20,14 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TEST_LOG_COMPILER = cat
TESTS = foo.test bar.test baz.test
baz.log: zardoz
END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
: > zardoz
cat > foo.test <<'END'
@@ -53,12 +46,6 @@ cat > baz.test <<'END'
Bail out!
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-./configure
-
# Even the tests that are not re-run should contribute to the testsuite
# summary when obtained by "make check RECHECK_LOGS=".
grep_summary ()
diff --git a/tests/tap-setup.sh b/tests/tap-setup.sh
new file mode 100755
index 0000000..0d1a1e3
--- /dev/null
+++ b/tests/tap-setup.sh
@@ -0,0 +1,48 @@
+#! /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/>.
+
+# Auxiliary shell script that copies the common data and files used by
+# many tests on TAP support into the current directory. It should be
+# sourced by client test scripts, and assumes the auxiliary test
+# `tap-common-setup.test' has been run beforehand (it will error out
+# if this is not the case).
+
+# 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 \
+ || fatal_ "running from a wrong directory"
+
+test ! -f Makefile.am || mv Makefile.am Makefile.am~ \
+ || fatal_ "failed to save Makefile.am"
+
+test -d ../tap-common-setup.dir && cp -Rp ../tap-common-setup.dir/* . \
+ || fatal_ "couldn't get precomputed data files"
+
+cp "$top_testsrcdir"/lib/tap-driver . \
+ || fatal_ "failed to fetch auxiliary script tap-driver"
+
+if test -f Makefile.am~; then
+ mv -f Makefile.am~ Makefile.am \
+ || fatal_ "failed to restore Makefile.am"
+ echo 'TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver' >> Makefile.am \
+ || fatal_ "failed to update Makefile.am"
+ $AUTOMAKE Makefile \
+ || fatal_ "failed to remake Makefile.in"
+ ./config.status Makefile \
+ || fatal_ "failed to remake Makefile"
+fi
+
+:
diff --git a/tests/tap-signal.test b/tests/tap-signal.test
index b1ac2df..fb75c83 100755
--- a/tests/tap-signal.test
+++ b/tests/tap-signal.test
@@ -20,19 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TESTS =
-END
-
+echo TESTS = > Makefile.am
for sig in 1 2 13 15; do
unindent > signal-$sig.test <<END
#!/bin/sh
@@ -46,11 +34,7 @@ done
chmod a+x *.test
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
for append in '' 'TEST_LOG_DRIVER_FLAGS = --ignore-exit'; do
echo "$append" >> Makefile
diff --git a/tests/tap-skip-whole-whitespace.test
b/tests/tap-skip-whole-whitespace.test
index 2a19d4c..bf83241 100755
--- a/tests/tap-skip-whole-whitespace.test
+++ b/tests/tap-skip-whole-whitespace.test
@@ -21,22 +21,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-sp=' '
-tab=' '
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = foo.test bar.test baz.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > foo.test <<END
1..0${tab}${tab} #${tab}SKIP ${tab}Strip leading & trailing ${tab}${tab}
@@ -50,13 +35,8 @@ cat > baz.test <<END
1..0 # SKIP${tab} Strip${tab}external preserve ${tab}middle ${tab}${sp}
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
-$MAKE check > stdout || { cat stdout; Exit 1; }
+TESTS='foo.test bar.test baz.test' $MAKE -e check > stdout \
+ || { cat stdout; Exit 1; }
cat stdout
count_test_results total=3 pass=0 fail=0 error=0 xpass=0 xfail=0 skip=3
diff --git a/tests/tap-skip-whole.test b/tests/tap-skip-whole.test
index bd75e90..6b14be4 100755
--- a/tests/tap-skip-whole.test
+++ b/tests/tap-skip-whole.test
@@ -20,21 +20,9 @@
parallel_tests=yes
. ./defs || Exit 1
-weirdchars=\''"$!&()[]<>#;^?*/@%=,.:'
-
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = foo.test bar.test baz.test wget.test curl.test mu.test
-END
+weirdchars=\''"$!&()[]<>#;^?*/@%=,.:'
cat > foo.test <<END
1..0
@@ -78,13 +66,8 @@ not ok 333
1..7
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
-$MAKE check >stdout || { cat stdout; Exit 1; }
+env TESTS='foo.test bar.test baz.test wget.test curl.test mu.test' \
+ $MAKE -e check >stdout || { cat stdout; Exit 1; }
cat stdout
count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0
diff --git a/tests/tap-todo-skip-together.test
b/tests/tap-todo-skip-together.test
index 1528ca3..14b8ed5 100755
--- a/tests/tap-todo-skip-together.test
+++ b/tests/tap-todo-skip-together.test
@@ -20,19 +20,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<END
1..2
@@ -40,12 +28,6 @@ ok 1 # SKIP TODO
not ok 2 # TODO SKIP
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
$MAKE check >stdout || { cat stdout; Exit 1; }
cat stdout
diff --git a/tests/tap-todo-skip-whitespace.test
b/tests/tap-todo-skip-whitespace.test
index 68fbbc1..695e98c 100755
--- a/tests/tap-todo-skip-whitespace.test
+++ b/tests/tap-todo-skip-whitespace.test
@@ -21,25 +21,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > stub.tap <<END
1 # TODO
diff --git a/tests/tap-todo-skip.test b/tests/tap-todo-skip.test
index c37b631..d00dddd 100755
--- a/tests/tap-todo-skip.test
+++ b/tests/tap-todo-skip.test
@@ -26,25 +26,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
# ----------------------------------------------------- #
# Check all possible combinations of: #
diff --git a/tests/tap-unplanned.test b/tests/tap-unplanned.test
index 696f73b..177e36e 100755
--- a/tests/tap-unplanned.test
+++ b/tests/tap-unplanned.test
@@ -20,27 +20,9 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = foo.test
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
-cat > foo.test <<END
+cat > all.test <<END
1..1
ok 1
ok 2
@@ -48,10 +30,10 @@ END
$MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
count_test_results total=3 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=2
-grep '^ERROR: foo\.test - too many tests run (expected 1, got 2)$' stdout
-grep '^ERROR: foo\.test 2 # UNPLANNED$' stdout
+grep '^ERROR: all\.test - too many tests run (expected 1, got 2)$' stdout
+grep '^ERROR: all\.test 2 # UNPLANNED$' stdout
-cat > foo.test <<END
+cat > all.test <<END
1..2
ok 1
ok 2
@@ -60,11 +42,11 @@ END
$MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
count_test_results total=4 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=2
-grep '^ERROR: foo\.test - too many tests run (expected 2, got 3)$' stdout
-grep '^ERROR: foo\.test 3 # UNPLANNED$' stdout
+grep '^ERROR: all\.test - too many tests run (expected 2, got 3)$' stdout
+grep '^ERROR: all\.test 3 # UNPLANNED$' stdout
# Interaction with XFAIL_TESTS.
-cat > foo.test <<END
+cat > all.test <<END
1..2
not ok 1
ok 2 # SKIP
@@ -72,15 +54,15 @@ ok 3
not ok 4
ok 5 # SKIP
END
-XFAIL_TESTS=foo.test $MAKE -e check >stdout && { cat stdout; Exit 1; }
+XFAIL_TESTS=all.test $MAKE -e check >stdout && { cat stdout; Exit 1; }
cat stdout
count_test_results total=6 pass=0 fail=0 xpass=0 xfail=1 skip=1 error=4
-grep '^ERROR: foo\.test - too many tests run (expected 2, got 5)$' stdout
-grep '^ERROR: foo\.test 3 # UNPLANNED$' stdout
-grep '^ERROR: foo\.test 4 # UNPLANNED$' stdout
-grep '^ERROR: foo\.test 5 # UNPLANNED$' stdout
+grep '^ERROR: all\.test - too many tests run (expected 2, got 5)$' stdout
+grep '^ERROR: all\.test 3 # UNPLANNED$' stdout
+grep '^ERROR: all\.test 4 # UNPLANNED$' stdout
+grep '^ERROR: all\.test 5 # UNPLANNED$' stdout
-cat > foo.test <<END
+cat > all.test <<END
1..1
ok 1
@@ -143,11 +125,11 @@ $MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
count_test_results total=22 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=21
-echo 'PASS: foo.test 1' > exp
-sed -e '/^$/d' -e 's/.*/ERROR: foo.test & # UNPLANNED/' t >> exp
-echo 'ERROR: foo.test - too many tests run (expected 1, got 21)' >> exp
+echo 'PASS: all.test 1' > exp
+sed -e '/^$/d' -e 's/.*/ERROR: all.test & # UNPLANNED/' t >> exp
+echo 'ERROR: all.test - too many tests run (expected 1, got 21)' >> exp
-$FGREP ': foo.test' stdout > got
+$FGREP ': all.test' stdout > got
cat exp
cat got
@@ -159,7 +141,7 @@ diff exp got
# message about the unmatched number of tests once we've got the plan.
for x in 'ok' 'ok 3' 'not ok' 'not ok # TODO' 'ok # TODO' 'ok # SKIP'; do
- unindent > foo.test <<END
+ unindent > all.test <<END
ok 1
ok 2 # SKIP
$x
@@ -167,11 +149,11 @@ for x in 'ok' 'ok 3' 'not ok' 'not ok # TODO' 'ok # TODO'
'ok # SKIP'; do
END
$MAKE check >stdout && { cat stdout; Exit 1; }
cat stdout
- test `$FGREP -c ': foo.test' stdout` -eq 4
- $EGREP '^PASS: foo\.test 1($| )' stdout
- $EGREP '^SKIP: foo\.test 2($| )' stdout
- $EGREP ': foo\.test 3($| )' stdout
- grep '^ERROR: foo\.test - too many tests run (expected 2, got 3)$' stdout
+ test `$FGREP -c ': all.test' stdout` -eq 4
+ $EGREP '^PASS: all\.test 1($| )' stdout
+ $EGREP '^SKIP: all\.test 2($| )' stdout
+ $EGREP ': all\.test 3($| )' stdout
+ grep '^ERROR: all\.test - too many tests run (expected 2, got 3)$' stdout
done
:
diff --git a/tests/tap-whitespace-normalization.test
b/tests/tap-whitespace-normalization.test
index 16e6801..a902438 100755
--- a/tests/tap-whitespace-normalization.test
+++ b/tests/tap-whitespace-normalization.test
@@ -23,25 +23,13 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
TEST_LOG_COMPILER = cat
TESTS =
END
: > exp
-sp=' '
-tab=' '
-
spaces_a=${sp}${tab}${tab}${sp}${sp}${tab}
spaces_b=${tab}${tab}${sp}${tab}${sp}${sp}${sp}
@@ -157,11 +145,7 @@ END
chmod a+x *.test
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing 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/tests/tap-with-and-without-number.test
b/tests/tap-with-and-without-number.test
index a1f7a4b..e989cc8 100755
--- a/tests/tap-with-and-without-number.test
+++ b/tests/tap-with-and-without-number.test
@@ -22,19 +22,7 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
-
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = all.test
-END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
cat > all.test <<'END'
1..7
@@ -47,12 +35,6 @@ ok 6 # SKIP
ok zardoz
END
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
$MAKE check >stdout || { cat stdout; Exit 1; }
cat stdout
count_test_results total=7 pass=4 fail=0 xpass=0 xfail=2 skip=1 error=0
diff --git a/tests/tap-xfail-tests.test b/tests/tap-xfail-tests.test
index f159e8a..22733c8 100755
--- a/tests/tap-xfail-tests.test
+++ b/tests/tap-xfail-tests.test
@@ -20,28 +20,11 @@
parallel_tests=yes
. ./defs || Exit 1
-cp "$top_testsrcdir"/lib/tap-driver . \
- || fatal_ "failed to fetch auxiliary script tap-driver"
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
-cat >> configure.in <<END
-AC_SUBST([PERL], ['$PERL'])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver
-TEST_LOG_COMPILER = cat
-TESTS = the.test
-XFAIL_TESTS = $(TESTS)
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
+echo 'XFAIL_TESTS = $(TESTS)' >> Makefile
-cat > the.test <<END
+cat > all.test <<END
1..6
ok 1
not ok 2
@@ -59,18 +42,18 @@ cat stdout
count_test_results total=7 pass=0 fail=0 xpass=2 xfail=3 skip=1 error=1
-grep '^XPASS: the\.test 1$' stdout
-grep '^XFAIL: the\.test 2$' stdout
-grep '^XPASS: the\.test 3 # TODO' stdout
-grep '^XFAIL: the\.test 4 # TODO' stdout
-grep '^SKIP: the\.test 5 # SKIP' stdout
-grep '^XFAIL: the\.test 6 # SKIP' stdout
-grep '^ERROR: the\.test - Bail out!' stdout
+grep '^XPASS: all\.test 1$' stdout
+grep '^XFAIL: all\.test 2$' stdout
+grep '^XPASS: all\.test 3 # TODO' stdout
+grep '^XFAIL: all\.test 4 # TODO' stdout
+grep '^SKIP: all\.test 5 # SKIP' stdout
+grep '^XFAIL: all\.test 6 # SKIP' stdout
+grep '^ERROR: all\.test - Bail out!' stdout
# Check that the exit status of the testsuite is indeed 0 when we
# would expect success.
-cat > the.test <<END
+cat > all.test <<END
1..3
not ok 1
ok 2 # SKIP
--
1.7.2.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [FYI] {GSoC} testsuite: optimize tests on TAP for speed and against duplication,
Stefano Lattarini <=