Since commit `v1.11-976-g4740f56', an early TAP plan can also be specified after input lines have already been seen, as long as no one of them is a TAP result line. We can now take advantage of this in our own testsuite, allowing the TAP-based scripts to specify their earlier plan after having included `./defs'. In particular, this offers the benefit of allowing those scripts to issue a "skip all" plan (e.g., "1..0 # SKIP reason ...") after the inclusion of `./defs', which wasn't possible with the older interface (introduced in commit `v1.11-1114-g0286308').
* tests/defs: Don't try to call `plan_' if `$planned' is defined, the calling scripts can do that directly now. * tests/ac-output-old.tap: Use `plan_' directly instead of setting `$planned' before including `./defs'. * tests/automake-cmdline.tap: Likewise. * tests/depmod.tap: Likewise. * tests/instspc.tap: Likewise. * tests/tap-bad-prog.tap: Likewise. * tests/add-missing.tap: Don't set `$planned'. --- ChangeLog | 22 ++++++++++++++++++++++ tests/ac-output-old.tap | 3 ++- tests/add-missing.tap | 1 - tests/automake-cmdline.tap | 3 ++- tests/defs | 5 ----- tests/depmod.tap | 7 ++++--- tests/instspc.tap | 3 ++- tests/tap-bad-prog.tap | 3 ++- 8 files changed, 34 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad1d3f5..b3e9573 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,27 @@ 2011-08-08 Stefano Lattarini <stefano.lattar...@gmail.com> + testsuite: improve interface for giving early TAP plan + Since commit `v1.11-976-g4740f56', an early TAP plan can also be + specified after input lines have already been seen, as long as + no one of them is a TAP result line. We can now take advantage + of this in our own testsuite, allowing the TAP-based scripts to + specify their earlier plan after having included `./defs'. In + particular, this offers the benefit of allowing those scripts to + issue a "skip all" plan (e.g., "1..0 # SKIP reason ...") after + the inclusion of `./defs', which wasn't possible with the older + interface (introduced in commit `v1.11-1114-g0286308'). + * tests/defs: Don't try to call `plan_' if `$planned' is defined, + the calling scripts can do that directly now. + * tests/ac-output-old.tap: Use `plan_' directly instead of + setting `$planned' before including `./defs'. + * tests/automake-cmdline.tap: Likewise. + * tests/depmod.tap: Likewise. + * tests/instspc.tap: Likewise. + * tests/tap-bad-prog.tap: Likewise. + * tests/add-missing.tap: Don't set `$planned'. + +2011-08-08 Stefano Lattarini <stefano.lattar...@gmail.com> + test defs: fix bug in TAP version of `skip_all_' * tests/tap-functions (skip_all_): Set `$have_tap_plan_' to "yes" when called, so that the exit trap won't write another TAP plan. diff --git a/tests/ac-output-old.tap b/tests/ac-output-old.tap index 201e517..ee2d150 100755 --- a/tests/ac-output-old.tap +++ b/tests/ac-output-old.tap @@ -19,9 +19,10 @@ # line breaking in the use of AC_OUTPUT. Synthesised by a bunch # of older tests (referenced below). -planned=22 . ./defs || Exit 1 +plan_ 22 + rm -f configure.in depcomp # Not required. # ----------------------------------------------------------------------- diff --git a/tests/add-missing.tap b/tests/add-missing.tap index cbf6e57..4c6a624 100755 --- a/tests/add-missing.tap +++ b/tests/add-missing.tap @@ -19,7 +19,6 @@ # the files) it's supposed to, and that these files are symlinked by # default, but copied if the `--copy' option is used. -planned=unknown # Counting it would be too much data-dependent. . ./defs || Exit 1 build_aux=build-aux diff --git a/tests/automake-cmdline.tap b/tests/automake-cmdline.tap index 1c53a6d..9397900 100755 --- a/tests/automake-cmdline.tap +++ b/tests/automake-cmdline.tap @@ -16,9 +16,10 @@ # Test Automake's command-line options. -planned=17 . ./defs || Exit 1 +plan_ 17 + # Usage: bad_cmdline DESCRIPTION REGEX-FOR-STDERR [ARGS-FOR-AUTOMAKE...] do_check () { diff --git a/tests/defs b/tests/defs index d3ae1dd..8db1084 100644 --- a/tests/defs +++ b/tests/defs @@ -445,11 +445,6 @@ xsi_shell_code=' ## required by them. ## ## ----------------------------------------------------------- ## -# The TAP plan must be either the fist or last line of output. -if test $using_tap = yes && test ${planned-unknown} != unknown; then - plan_ "$planned" -fi - # Print it here, so that the user will see it also if the test # will be skipped due to some tool missing in $PATH itself. echo "$PATH" diff --git a/tests/depmod.tap b/tests/depmod.tap index 85bd972..82fd844 100755 --- a/tests/depmod.tap +++ b/tests/depmod.tap @@ -51,12 +51,13 @@ # which caused make to die with an error like: # "sub/.deps/subfoo.Po:3: *** missing separator. Stop." +required=cc +. ./defs || Exit 99 + # Per each valid depmode three kinds of VPATH, and per each of them # a test on "./configure" and one on "make & remake"; so there are # 17 * 3 * 2 = 102. -planned=102 -required=cc -. ./defs || Exit 99 +plan_ 102 ocwd=`pwd` || fatal_ "cannot get current working directory" diff --git a/tests/instspc.tap b/tests/instspc.tap index f421fc7..dc52299 100755 --- a/tests/instspc.tap +++ b/tests/instspc.tap @@ -19,9 +19,10 @@ # Original report from James Amundson about file names with spaces. # Other characters added by Paul Eggert. -planned=94 # Two tests per "problematic string". . ./defs || Exit 99 +plan_ 94 # Two tests per "problematic string". + # Usage: is_in_list ITEM [LIST...] is_in_list () { diff --git a/tests/tap-bad-prog.tap b/tests/tap-bad-prog.tap index 086b38e..cf475a1 100755 --- a/tests/tap-bad-prog.tap +++ b/tests/tap-bad-prog.tap @@ -18,10 +18,11 @@ # - missing, unreadable, or not-executable test scripts cause proper # error reports -planned=5 parallel_tests=yes . ./defs || Exit 1 +plan_ 5 + cp "$top_testsrcdir"/lib/tap-driver . \ || fatal_ "failed to fetch auxiliary script tap-driver" -- 1.7.2.3