summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-09-08 10:41:24 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-09-08 11:44:55 +0200
commite4777b8dc1a2c22247c6fc251bca06ee1d5acefe (patch)
tree9f6e2567e8e23078921668e04da57dcda8f73f4b
parent87fdf3a085980e3e7768909301ca2b711d33e429 (diff)
downloadautomake-e4777b8dc1a2c22247c6fc251bca06ee1d5acefe.tar.gz
testsuite: automatize generation of dependencies for tests
* tests/gen-test-deps: New script, automatically generates dependencies for the tests. * tests/Makefile.am (EXTRA_DIST): Distribute it. ($(srcdir)/tests-deps.am): New rule. (include $(srcdir)/tests-deps.am): New inclusion. Remove hand-written dependencies for tests. Other related updates. * tests/list-of-tests (tap_with_common_setup_TESTS, tap_other_TESTS): Delete, their content merged back into ... (handwritten_TESTS): ... this. * tests/.gitignore (tests-deps.am): New ignored file. * bootstrap: Generate `tests/tests-deps.am'.
-rw-r--r--ChangeLog16
-rwxr-xr-xbootstrap5
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/Makefile.am37
-rw-r--r--tests/Makefile.in294
-rwxr-xr-xtests/gen-tests-deps127
-rw-r--r--tests/list-of-tests.mk174
7 files changed, 419 insertions, 235 deletions
diff --git a/ChangeLog b/ChangeLog
index dfbb90aa3..faea7f2e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2011-09-08 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ testsuite: automatize generation of dependencies for tests
+ * tests/gen-test-deps: New script, automatically generates
+ dependencies for the tests.
+ * tests/Makefile.am (EXTRA_DIST): Distribute it.
+ ($(srcdir)/tests-deps.am): New rule.
+ (include $(srcdir)/tests-deps.am): New inclusion.
+ Remove hand-written dependencies for tests. Other related
+ updates.
+ * tests/list-of-tests (tap_with_common_setup_TESTS,
+ tap_other_TESTS): Delete, their content merged back into ...
+ (handwritten_TESTS): ... this.
+ * tests/.gitignore (tests-deps.am): New ignored file.
+ * bootstrap: Generate `tests/tests-deps.am'.
+
2011-09-07 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: avoid spurious failure due to bug in older TAP::Parser
diff --git a/bootstrap b/bootstrap
index 9fab5f8ae..77509dcbb 100755
--- a/bootstrap
+++ b/bootstrap
@@ -103,11 +103,14 @@ dosubst m4/amversion.in m4/amversion.m4
# Create temporary replacement for automake.
dosubst automake.in automake.tmp
-# Create required makefile snippet.
+# Create required makefile snippets.
cd tests
$BOOTSTRAP_SHELL ./gen-wrap-tests > wrap-tests.tmp
chmod a-w wrap-tests.tmp
mv -f wrap-tests.tmp wrap-tests.am
+$PERL ./gen-tests-deps > tests-deps.tmp
+chmod a-w tests-deps.tmp
+mv -f tests-deps.tmp tests-deps.am
cd ..
# Run the autotools.
diff --git a/tests/.gitignore b/tests/.gitignore
index 528a0f594..cea5f6d29 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -2,6 +2,7 @@
/automake-*
/defs-static
/wrap-tests.am
+/tests-deps.am
/*.dir
/*.log
/*.trs
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4ca74d1a2..d2c05dc08 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -97,28 +97,6 @@ $(wrap_TESTS):
$(wrap_LOGS): wrap-tests.sh
EXTRA_DIST += wrap-tests.sh
-# Extra dependencies for hand-written tests.
-
-test-driver-custom-multitest.log: trivial-test-driver
-test-driver-custom-multitest-recheck.log: trivial-test-driver
-test-driver-custom-multitest-recheck2.log: trivial-test-driver
-test-driver-custom-html.log: trivial-test-driver
-EXTRA_DIST += trivial-test-driver
-
-testsuite-summary-color.log testsuite-summary-count.log: \
- testsuite-summary-checks.sh extract-testsuite-summary
-EXTRA_DIST += testsuite-summary-checks.sh
-EXTRA_DIST += extract-testsuite-summary
-
-testsuite-summary-count-many.log: trivial-test-driver
-testsuite-summary-count-many.log: extract-testsuite-summary
-
-$(tap_with_common_setup_TESTS:.test=.log): tap-common-setup.log tap-setup.sh
-EXTRA_DIST += tap-setup.sh
-
-tap-summary.log tap-summary-color.log: tap-summary-aux.sh
-EXTRA_DIST += tap-summary-aux.sh
-
# If two test scripts have the same basename, they will end up sharing
# the same log file, leading to all sort of undefined and undesired
# behaviours.
@@ -139,13 +117,22 @@ checked_test_extensions = .test .tap
expected_list_of_tests = $(handwritten_TESTS)
include $(top_srcdir)/CheckListOfTests.am
-# Dependencies valid for each test case.
+# Automatically computed dependencies for tests.
+
+$(srcdir)/tests-deps.am: gen-tests-deps list-of-tests.mk Makefile.am
+ $(AM_V_at)rm -f tests-deps.tmp $@
+ $(AM_V_GEN)$(PERL) $(srcdir)/gen-tests-deps --srcdir $(srcdir) \
+ > tests-deps.tmp
+ $(AM_V_at)chmod a-w tests-deps.tmp && mv -f tests-deps.tmp $@
+EXTRA_DIST += gen-tests-deps
+
+include $(srcdir)/tests-deps.am
+
+# Static dependencies valid for each test case.
$(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
# FIXME: this should be made more granular once we have a cleaner
# subdivision of the tests.
$(TEST_LOGS): plain-functions.sh tap-functions.sh
-
-## Files containing auxiliary functions used by our test cases.
EXTRA_DIST += tap-functions.sh plain-functions.sh
clean-local: clean-local-check
diff --git a/tests/Makefile.in b/tests/Makefile.in
index fd9378223..c7cd0aaf4 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -52,7 +52,8 @@ host_triplet = @host@
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs \
$(srcdir)/defs-static.in $(srcdir)/list-of-tests.mk \
- $(srcdir)/wrap-tests.am $(top_srcdir)/CheckListOfTests.am
+ $(srcdir)/tests-deps.am $(srcdir)/wrap-tests.am \
+ $(top_srcdir)/CheckListOfTests.am
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
@@ -305,9 +306,9 @@ TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/lib/tap-driver.sh
AM_TAP_LOG_DRIVER_FLAGS = --merge --comments --diagnostic-string \
`printf '\043%%\043\n'`
EXTRA_DIST = ChangeLog-old $(handwritten_TESTS) gen-wrap-tests \
- wrap-tests.sh trivial-test-driver testsuite-summary-checks.sh \
- extract-testsuite-summary tap-setup.sh tap-summary-aux.sh \
- tap-functions.sh plain-functions.sh
+ wrap-tests.sh gen-tests-deps tap-summary-aux.sh tap-setup.sh \
+ extract-testsuite-summary testsuite-summary-checks.sh \
+ trivial-test-driver tap-functions.sh plain-functions.sh
# Hand-written tests.
@@ -1244,8 +1245,88 @@ suffix-chain.tap \
symlink.test \
symlink2.test \
syntax.test \
-$(tap_with_common_setup_TESTS) \
-$(tap_other_TESTS) \
+tap-ambiguous-directive.test \
+tap-autonumber.test \
+tap-bailout.test \
+tap-bailout-and-logging.test \
+tap-bailout-suppress-badexit.test \
+tap-bailout-suppress-later-diagnostic.test \
+tap-bailout-suppress-later-errors.test \
+tap-color.test \
+tap-deps.test \
+tap-diagnostic.test \
+tap-empty-diagnostic.test \
+tap-empty.test \
+tap-escape-directive.test \
+tap-escape-directive-2.test \
+tap-exit.test \
+tap-signal.tap \
+tap-fancy.test \
+tap-fancy2.test \
+tap-global-log.test \
+tap-global-result.test \
+tap-html.test \
+tap-log.test \
+tap-msg0-result.test \
+tap-msg0-directive.test \
+tap-msg0-planskip.test \
+tap-msg0-bailout.test \
+tap-msg0-misc.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-numbers.test \
+tap-no-spurious.test \
+tap-not-ok-skip.test \
+tap-number-wordboundary.test \
+tap-numeric-description.test \
+tap-negative-numbers.test \
+tap-numbers-leading-zero.test \
+tap-out-of-order.test \
+tap-passthrough.test \
+tap-passthrough-exit.test \
+tap-plan.test \
+tap-plan-corner.test \
+tap-plan-errors.test \
+tap-plan-middle.test \
+tap-plan-whitespace.test \
+tap-plan-leading-zero.test \
+tap-plan-malformed.test \
+tap-missing-plan-and-bad-exit.test \
+tap-planskip.test \
+tap-planskip-late.test \
+tap-planskip-and-logging.test \
+tap-planskip-unplanned.test \
+tap-planskip-unplanned-corner.test \
+tap-planskip-case-insensitive.test \
+tap-planskip-whitespace.test \
+tap-planskip-badexit.test \
+tap-planskip-bailout.test \
+tap-planskip-later-errors.test \
+tap-realtime.test \
+tap-test-number-0.test \
+tap-recheck-logs.test \
+tap-result-comment.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 \
+tap-common-setup.test \
+tap-bad-prog.tap \
+tap-basic.test \
+tap-diagnostic-custom.test \
+tap-driver-stderr.test \
+tap-doc.test \
+tap-doc2.test \
+tap-more.test \
+tap-more2.test \
+tap-recheck.test \
+tap-summary.test \
+tap-summary-color.test \
tags.test \
tags2.test \
tagsub.test \
@@ -1357,98 +1438,6 @@ yflags-force-override.test \
yflags-force-conditional.test \
yflags-var-expand.test
-
-# List of tests on TAP support that use the files pre-computed by
-# `tap-common-setup.test', and source the `tap-setup.sh' helper
-# script.
-tap_with_common_setup_TESTS = \
-tap-ambiguous-directive.test \
-tap-autonumber.test \
-tap-bailout.test \
-tap-bailout-and-logging.test \
-tap-bailout-suppress-badexit.test \
-tap-bailout-suppress-later-diagnostic.test \
-tap-bailout-suppress-later-errors.test \
-tap-color.test \
-tap-deps.test \
-tap-diagnostic.test \
-tap-empty-diagnostic.test \
-tap-empty.test \
-tap-escape-directive.test \
-tap-escape-directive-2.test \
-tap-exit.test \
-tap-signal.tap \
-tap-fancy.test \
-tap-fancy2.test \
-tap-global-log.test \
-tap-global-result.test \
-tap-html.test \
-tap-log.test \
-tap-msg0-result.test \
-tap-msg0-directive.test \
-tap-msg0-planskip.test \
-tap-msg0-bailout.test \
-tap-msg0-misc.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-numbers.test \
-tap-no-spurious.test \
-tap-not-ok-skip.test \
-tap-number-wordboundary.test \
-tap-numeric-description.test \
-tap-negative-numbers.test \
-tap-numbers-leading-zero.test \
-tap-out-of-order.test \
-tap-passthrough.test \
-tap-passthrough-exit.test \
-tap-plan.test \
-tap-plan-corner.test \
-tap-plan-errors.test \
-tap-plan-middle.test \
-tap-plan-whitespace.test \
-tap-plan-leading-zero.test \
-tap-plan-malformed.test \
-tap-missing-plan-and-bad-exit.test \
-tap-planskip.test \
-tap-planskip-late.test \
-tap-planskip-and-logging.test \
-tap-planskip-unplanned.test \
-tap-planskip-unplanned-corner.test \
-tap-planskip-case-insensitive.test \
-tap-planskip-whitespace.test \
-tap-planskip-badexit.test \
-tap-planskip-bailout.test \
-tap-planskip-later-errors.test \
-tap-realtime.test \
-tap-test-number-0.test \
-tap-recheck-logs.test \
-tap-result-comment.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
-
-
-# Other tests on TAP support.
-tap_other_TESTS = \
-tap-common-setup.test \
-tap-bad-prog.tap \
-tap-basic.test \
-tap-diagnostic-custom.test \
-tap-driver-stderr.test \
-tap-doc.test \
-tap-doc2.test \
-tap-more.test \
-tap-more2.test \
-tap-recheck.test \
-tap-summary.test \
-tap-summary-color.test
-
wrap_TESTS = check-concurrency-bug9245-w.test_pt \
check-exported-srcdir-w.test_pt check-fd-redirect-w.test_pt \
check-subst-prog-w.test_pt check-subst-w.test_pt \
@@ -1622,7 +1611,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .html .log .tap .tap_pltap .test .test_cs .test_pltap .test_pt .trs
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/list-of-tests.mk $(srcdir)/wrap-tests.am $(top_srcdir)/CheckListOfTests.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/list-of-tests.mk $(srcdir)/wrap-tests.am $(top_srcdir)/CheckListOfTests.am $(srcdir)/tests-deps.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -2163,23 +2152,6 @@ $(wrap_TESTS):
# All the "wrapper" tests work by sourcing the script `wrap-tests.sh'.
$(wrap_LOGS): wrap-tests.sh
-# Extra dependencies for hand-written tests.
-
-test-driver-custom-multitest.log: trivial-test-driver
-test-driver-custom-multitest-recheck.log: trivial-test-driver
-test-driver-custom-multitest-recheck2.log: trivial-test-driver
-test-driver-custom-html.log: trivial-test-driver
-
-testsuite-summary-color.log testsuite-summary-count.log: \
- testsuite-summary-checks.sh extract-testsuite-summary
-
-testsuite-summary-count-many.log: trivial-test-driver
-testsuite-summary-count-many.log: extract-testsuite-summary
-
-$(tap_with_common_setup_TESTS:.test=.log): tap-common-setup.log tap-setup.sh
-
-tap-summary.log tap-summary-color.log: tap-summary-aux.sh
-
# If two test scripts have the same basename, they will end up sharing
# the same log file, leading to all sort of undefined and undesired
# behaviours.
@@ -2238,7 +2210,95 @@ clean-local: clean-maintcheck-testslist-tmp
clean-maintcheck-testslist-tmp:
rm -f $(am__tmk) $(am__tfs) $(am__tdf)
-# Dependencies valid for each test case.
+# Automatically computed dependencies for tests.
+
+$(srcdir)/tests-deps.am: gen-tests-deps list-of-tests.mk Makefile.am
+ $(AM_V_at)rm -f tests-deps.tmp $@
+ $(AM_V_GEN)$(PERL) $(srcdir)/gen-tests-deps --srcdir $(srcdir) \
+ > tests-deps.tmp
+ $(AM_V_at)chmod a-w tests-deps.tmp && mv -f tests-deps.tmp $@
+tap-summary.log: tap-summary-aux.sh
+tap-summary-color.log: tap-summary-aux.sh
+tap-ambiguous-directive.log: tap-setup.sh tap-common-setup.log
+tap-autonumber.log: tap-setup.sh tap-common-setup.log
+tap-bailout.log: tap-setup.sh tap-common-setup.log
+tap-bailout-and-logging.log: tap-setup.sh tap-common-setup.log
+tap-bailout-suppress-badexit.log: tap-setup.sh tap-common-setup.log
+tap-bailout-suppress-later-diagnostic.log: tap-setup.sh tap-common-setup.log
+tap-bailout-suppress-later-errors.log: tap-setup.sh tap-common-setup.log
+tap-color.log: tap-setup.sh tap-common-setup.log
+tap-deps.log: tap-setup.sh tap-common-setup.log
+tap-diagnostic.log: tap-setup.sh tap-common-setup.log
+tap-empty-diagnostic.log: tap-setup.sh tap-common-setup.log
+tap-empty.log: tap-setup.sh tap-common-setup.log
+tap-escape-directive.log: tap-setup.sh tap-common-setup.log
+tap-escape-directive-2.log: tap-setup.sh tap-common-setup.log
+tap-exit.log: tap-setup.sh tap-common-setup.log
+tap-signal.log: tap-setup.sh tap-common-setup.log
+tap-fancy.log: tap-setup.sh tap-common-setup.log
+tap-fancy2.log: tap-setup.sh tap-common-setup.log
+tap-global-log.log: tap-setup.sh tap-common-setup.log
+tap-global-result.log: tap-setup.sh tap-common-setup.log
+tap-html.log: tap-setup.sh tap-common-setup.log
+tap-log.log: tap-setup.sh tap-common-setup.log
+tap-msg0-result.log: tap-setup.sh tap-common-setup.log
+tap-msg0-directive.log: tap-setup.sh tap-common-setup.log
+tap-msg0-planskip.log: tap-setup.sh tap-common-setup.log
+tap-msg0-bailout.log: tap-setup.sh tap-common-setup.log
+tap-msg0-misc.log: tap-setup.sh tap-common-setup.log
+tap-merge-stdout-stderr.log: tap-setup.sh tap-common-setup.log
+tap-no-merge-stdout-stderr.log: tap-setup.sh tap-common-setup.log
+tap-no-disable-hard-error.log: tap-setup.sh tap-common-setup.log
+tap-no-spurious-summary.log: tap-setup.sh tap-common-setup.log
+tap-no-spurious-numbers.log: tap-setup.sh tap-common-setup.log
+tap-no-spurious.log: tap-setup.sh tap-common-setup.log
+tap-not-ok-skip.log: tap-setup.sh tap-common-setup.log
+tap-number-wordboundary.log: tap-setup.sh tap-common-setup.log
+tap-numeric-description.log: tap-setup.sh tap-common-setup.log
+tap-negative-numbers.log: tap-setup.sh tap-common-setup.log
+tap-numbers-leading-zero.log: tap-setup.sh tap-common-setup.log
+tap-out-of-order.log: tap-setup.sh tap-common-setup.log
+tap-passthrough.log: tap-setup.sh tap-common-setup.log
+tap-passthrough-exit.log: tap-setup.sh tap-common-setup.log
+tap-plan.log: tap-setup.sh tap-common-setup.log
+tap-plan-corner.log: tap-setup.sh tap-common-setup.log
+tap-plan-errors.log: tap-setup.sh tap-common-setup.log
+tap-plan-middle.log: tap-setup.sh tap-common-setup.log
+tap-plan-whitespace.log: tap-setup.sh tap-common-setup.log
+tap-plan-leading-zero.log: tap-setup.sh tap-common-setup.log
+tap-plan-malformed.log: tap-setup.sh tap-common-setup.log
+tap-missing-plan-and-bad-exit.log: tap-setup.sh tap-common-setup.log
+tap-planskip.log: tap-setup.sh tap-common-setup.log
+tap-planskip-late.log: tap-setup.sh tap-common-setup.log
+tap-planskip-and-logging.log: tap-setup.sh tap-common-setup.log
+tap-planskip-unplanned.log: tap-setup.sh tap-common-setup.log
+tap-planskip-unplanned-corner.log: tap-setup.sh tap-common-setup.log
+tap-planskip-case-insensitive.log: tap-setup.sh tap-common-setup.log
+tap-planskip-whitespace.log: tap-setup.sh tap-common-setup.log
+tap-planskip-badexit.log: tap-setup.sh tap-common-setup.log
+tap-planskip-bailout.log: tap-setup.sh tap-common-setup.log
+tap-planskip-later-errors.log: tap-setup.sh tap-common-setup.log
+tap-realtime.log: tap-setup.sh tap-common-setup.log
+tap-test-number-0.log: tap-setup.sh tap-common-setup.log
+tap-recheck-logs.log: tap-setup.sh tap-common-setup.log
+tap-result-comment.log: tap-setup.sh tap-common-setup.log
+tap-todo-skip-together.log: tap-setup.sh tap-common-setup.log
+tap-todo-skip-whitespace.log: tap-setup.sh tap-common-setup.log
+tap-todo-skip.log: tap-setup.sh tap-common-setup.log
+tap-unplanned.log: tap-setup.sh tap-common-setup.log
+tap-whitespace-normalization.log: tap-setup.sh tap-common-setup.log
+tap-with-and-without-number.log: tap-setup.sh tap-common-setup.log
+tap-xfail-tests.log: tap-setup.sh tap-common-setup.log
+testsuite-summary-count-many.log: extract-testsuite-summary
+testsuite-summary-color.log: testsuite-summary-checks.sh
+testsuite-summary-count.log: testsuite-summary-checks.sh
+testsuite-summary-count-many.log: trivial-test-driver
+test-driver-custom-multitest.log: trivial-test-driver
+test-driver-custom-multitest-recheck.log: trivial-test-driver
+test-driver-custom-multitest-recheck2.log: trivial-test-driver
+test-driver-custom-html.log: trivial-test-driver
+
+# Static dependencies valid for each test case.
$(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
# FIXME: this should be made more granular once we have a cleaner
# subdivision of the tests.
diff --git a/tests/gen-tests-deps b/tests/gen-tests-deps
new file mode 100755
index 000000000..af13842e6
--- /dev/null
+++ b/tests/gen-tests-deps
@@ -0,0 +1,127 @@
+#! /usr/bin/perl
+# Generate tests-deps.am.
+
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+use warnings FATAL => "all";
+use strict;
+use File::Basename ();
+
+my $me = File::Basename::basename $0;
+
+# For use in VPATH builds.
+my $srcdir = ".";
+
+#--------------------------------------------------------------------------
+
+sub line_match ($$)
+{
+ my ($re, $file) = (shift, shift);
+ open (FH, "<$file") or open (FH, "<$srcdir/$file")
+ or die "$me: cannot open file `$file': $!\n";
+ my $ret = 0;
+ while (defined (my $line = <FH>))
+ {
+ if ($line =~ $re)
+ {
+ $ret = 1;
+ last;
+ }
+ }
+ close FH or die "$me: cannot close file `$file': $!\n";
+ return $ret;
+}
+
+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 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;
+ foreach my $test (@tests_list)
+ {
+ next if -f $test || -f "$srcdir/$test";
+ warn "$me: test `$test' not found\n";
+ $ok = 0;
+ }
+ die "$me: some test scripts not found\n" if !$ok;
+ return @tests_list;
+}
+
+sub parse_options (@)
+{
+ use Getopt::Long qw/GetOptions/;
+ local @ARGV = @_;
+ GetOptions ('srcdir=s' => \$srcdir) or die "$me: usage error\n";
+ die "$me: too many arguments\n" if @ARGV > 0;
+ die "$me: srcdir `$srcdir': not a directory\n" unless -d $srcdir;
+}
+
+#--------------------------------------------------------------------------
+
+my %deps_extractor =
+ (
+ use_trivial_test_driver =>
+ {
+ line_matcher => qr/\btrivial-test-driver\b/,
+ dist_prereqs => "trivial-test-driver",
+ },
+ check_testsuite_summary =>
+ {
+ line_matcher => qr/\btestsuite-summary-checks\.sh\b/,
+ dist_prereqs => "testsuite-summary-checks.sh",
+ },
+ extract_testsuite_summary =>
+ {
+ line_matcher => qr/\bextract-testsuite-summary\b/,
+ dist_prereqs => "extract-testsuite-summary",
+ },
+ check_tap_testsuite_summary =>
+ {
+ line_matcher => qr/\btap-summary-aux\.sh\b/,
+ dist_prereqs => "tap-summary-aux.sh",
+ },
+ is_test_on_tap_with_common_setup =>
+ {
+ line_matcher => qr/\btap-setup\.sh\b/,
+ dist_prereqs => "tap-setup.sh",
+ nodist_prereqs => "tap-common-setup.log",
+ },
+ );
+
+#--------------------------------------------------------------------------
+
+parse_options @ARGV;
+
+my @tests = get_list_of_tests;
+
+print "## Generated by $me. DO NOT EDIT BY HAND!\n";
+
+while (my ($k, $x) = each %deps_extractor)
+ {
+ my $dist_prereqs = $x->{dist_prereqs} || "";
+ my $nodist_prereqs = $x->{nodist_prereqs} || "";
+ my @logs = grep { line_match $x->{line_matcher}, $_ } @tests;
+ map { s/\.[^.]*$//; s/$/\.log/; } @logs;
+ print "\n## Added by deps-extracting key `$k'.\n";
+ print "EXTRA_DIST += $dist_prereqs\n";
+ map { print "$_: $dist_prereqs $nodist_prereqs\n" } @logs;
+ }
+
+__END__
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 5e3fae0db..6a0426164 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -919,8 +919,88 @@ suffix-chain.tap \
symlink.test \
symlink2.test \
syntax.test \
-$(tap_with_common_setup_TESTS) \
-$(tap_other_TESTS) \
+tap-ambiguous-directive.test \
+tap-autonumber.test \
+tap-bailout.test \
+tap-bailout-and-logging.test \
+tap-bailout-suppress-badexit.test \
+tap-bailout-suppress-later-diagnostic.test \
+tap-bailout-suppress-later-errors.test \
+tap-color.test \
+tap-deps.test \
+tap-diagnostic.test \
+tap-empty-diagnostic.test \
+tap-empty.test \
+tap-escape-directive.test \
+tap-escape-directive-2.test \
+tap-exit.test \
+tap-signal.tap \
+tap-fancy.test \
+tap-fancy2.test \
+tap-global-log.test \
+tap-global-result.test \
+tap-html.test \
+tap-log.test \
+tap-msg0-result.test \
+tap-msg0-directive.test \
+tap-msg0-planskip.test \
+tap-msg0-bailout.test \
+tap-msg0-misc.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-numbers.test \
+tap-no-spurious.test \
+tap-not-ok-skip.test \
+tap-number-wordboundary.test \
+tap-numeric-description.test \
+tap-negative-numbers.test \
+tap-numbers-leading-zero.test \
+tap-out-of-order.test \
+tap-passthrough.test \
+tap-passthrough-exit.test \
+tap-plan.test \
+tap-plan-corner.test \
+tap-plan-errors.test \
+tap-plan-middle.test \
+tap-plan-whitespace.test \
+tap-plan-leading-zero.test \
+tap-plan-malformed.test \
+tap-missing-plan-and-bad-exit.test \
+tap-planskip.test \
+tap-planskip-late.test \
+tap-planskip-and-logging.test \
+tap-planskip-unplanned.test \
+tap-planskip-unplanned-corner.test \
+tap-planskip-case-insensitive.test \
+tap-planskip-whitespace.test \
+tap-planskip-badexit.test \
+tap-planskip-bailout.test \
+tap-planskip-later-errors.test \
+tap-realtime.test \
+tap-test-number-0.test \
+tap-recheck-logs.test \
+tap-result-comment.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 \
+tap-common-setup.test \
+tap-bad-prog.tap \
+tap-basic.test \
+tap-diagnostic-custom.test \
+tap-driver-stderr.test \
+tap-doc.test \
+tap-doc2.test \
+tap-more.test \
+tap-more2.test \
+tap-recheck.test \
+tap-summary.test \
+tap-summary-color.test \
tags.test \
tags2.test \
tagsub.test \
@@ -1032,96 +1112,6 @@ yflags-force-override.test \
yflags-force-conditional.test \
yflags-var-expand.test
-# List of tests on TAP support that use the files pre-computed by
-# `tap-common-setup.test', and source the `tap-setup.sh' helper
-# script.
-tap_with_common_setup_TESTS = \
-tap-ambiguous-directive.test \
-tap-autonumber.test \
-tap-bailout.test \
-tap-bailout-and-logging.test \
-tap-bailout-suppress-badexit.test \
-tap-bailout-suppress-later-diagnostic.test \
-tap-bailout-suppress-later-errors.test \
-tap-color.test \
-tap-deps.test \
-tap-diagnostic.test \
-tap-empty-diagnostic.test \
-tap-empty.test \
-tap-escape-directive.test \
-tap-escape-directive-2.test \
-tap-exit.test \
-tap-signal.tap \
-tap-fancy.test \
-tap-fancy2.test \
-tap-global-log.test \
-tap-global-result.test \
-tap-html.test \
-tap-log.test \
-tap-msg0-result.test \
-tap-msg0-directive.test \
-tap-msg0-planskip.test \
-tap-msg0-bailout.test \
-tap-msg0-misc.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-numbers.test \
-tap-no-spurious.test \
-tap-not-ok-skip.test \
-tap-number-wordboundary.test \
-tap-numeric-description.test \
-tap-negative-numbers.test \
-tap-numbers-leading-zero.test \
-tap-out-of-order.test \
-tap-passthrough.test \
-tap-passthrough-exit.test \
-tap-plan.test \
-tap-plan-corner.test \
-tap-plan-errors.test \
-tap-plan-middle.test \
-tap-plan-whitespace.test \
-tap-plan-leading-zero.test \
-tap-plan-malformed.test \
-tap-missing-plan-and-bad-exit.test \
-tap-planskip.test \
-tap-planskip-late.test \
-tap-planskip-and-logging.test \
-tap-planskip-unplanned.test \
-tap-planskip-unplanned-corner.test \
-tap-planskip-case-insensitive.test \
-tap-planskip-whitespace.test \
-tap-planskip-badexit.test \
-tap-planskip-bailout.test \
-tap-planskip-later-errors.test \
-tap-realtime.test \
-tap-test-number-0.test \
-tap-recheck-logs.test \
-tap-result-comment.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
-
-# Other tests on TAP support.
-tap_other_TESTS = \
-tap-common-setup.test \
-tap-bad-prog.tap \
-tap-basic.test \
-tap-diagnostic-custom.test \
-tap-driver-stderr.test \
-tap-doc.test \
-tap-doc2.test \
-tap-more.test \
-tap-more2.test \
-tap-recheck.test \
-tap-summary.test \
-tap-summary-color.test
-
print-list-of-tests:
@echo $(handwritten_TESTS)
.PHONY: print-list-of-tests