diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-02-17 13:14:57 +0100 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-02-17 13:14:57 +0100 |
commit | 622a348efd03f4fe39194f80ef8373cb6686111a (patch) | |
tree | 7035df30477afb6dad2f5320bc29414962afcbde /syntax-checks.mk | |
parent | 0f858eabaed9377bb4c0cf62fec44237528f9728 (diff) | |
download | automake-622a348efd03f4fe39194f80ef8373cb6686111a.tar.gz |
tests: TAP-based tests should error if no plan was specified
After this change, it will still be OK for TAP-based tests not to
report any explicit TAP plan -- but they should state *explicitly*
that they want to do so, by calling the 'plan_' function with a
proper argument (currently, either "later" or "unknonwn").
Motivated by a recent issue introduced by yesterday's commit
'v1.11-1959-g0699a84' (pointed out by Peter Rosin, and fixed
by follow-up commit 'v1.11-1961-gea44190').
* tests/tap-functions.sh (plan_): Get rid of '$have_tap_plan_',
and refactor use and initialization of '$planned_' in a way that
will allow client script to get more information on which kind
of plan (if any) has been declared by the former 'plan_' invocation.
(skip_all_): Adjust.
* tests/defs (exit trap): Only print the "lazy" TAP plan if 'plan_'
has requested that *explicitly*.
* syntax-check.mk (sc_tests_tap_plan): Remove: it's obsolete now,
since a TAP-based test that doesn't call 'plan_' explicitly won't
print any TAP plan, and the TAP driver will catch that and report
an error.
(syntax_check_rules): Adjust.
Diffstat (limited to 'syntax-checks.mk')
-rw-r--r-- | syntax-checks.mk | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/syntax-checks.mk b/syntax-checks.mk index 13531bdea..a8bdcadd9 100644 --- a/syntax-checks.mk +++ b/syntax-checks.mk @@ -68,7 +68,6 @@ sc_tests_automake_fails \ sc_tests_plain_aclocal \ sc_tests_plain_perl \ sc_tests_required_after_defs \ -sc_tests_tap_plan \ sc_tests_overriding_macros_on_cmdline \ sc_tests_plain_sleep \ sc_tests_plain_egrep_fgrep \ @@ -426,33 +425,6 @@ sc_tests_required_after_defs: fi; \ done -## TAP-based test scripts should not forget to declare a TAP plan. In -## case it is not known in advance how many tests will be run, a "lazy" -## plan can be used; but its use should be deliberate, explicitly declared -## with a "plan_ later" call, rather than the result of an oversight. -## This check helps to ensure this is indeed the case. -sc_tests_tap_plan: - @with_plan=`grep -l '^ *plan_ ' $(srcdir)/tests/*.tap`; \ - with_plan=`echo $$with_plan`; \ - ok=:; \ - for t in $(srcdir)/tests/*.tap; do \ - case " $$with_plan " in *" $$t "*) continue;; esac; \ - case $$t in \ - *-w.tap) \ - : it is ok for an *auto-generated* test sourcing an \ - : hand-written one not to declare a TAP plan: that will \ - : be done by the sourced test; \ - t2=`echo $$t | sed -e 's|.*/||' -e 's/-w\.tap$$/.tap/'` \ - && grep -E "^ *\\. *[^ ]*/$$t2\\b" $$t >/dev/null \ - && continue || : ;; \ - esac; \ - ok=false; echo $$t; \ - done; \ - $$ok || { \ - echo 'The tests above do not declare a TAP plan.' 1>&2; \ - exit 1; \ - } - ## Overriding a Makefile macro on the command line is not portable when ## recursive targets are used. Better use an envvar. SHELL is an ## exception, POSIX says it can't come from the environment. V, DESTDIR, |