From: Stefano Lattarini Date: Mon, 8 Aug 2011 13:43:53 +0000 (+0200) Subject: testsuite: improve interface for giving early TAP plan X-Git-Tag: ng-0.5a~89^2~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8be644b8612ae1ab23bd9de646991c90e03cdea1;p=thirdparty%2Fautomake.git 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'. --- diff --git a/ChangeLog b/ChangeLog index ad1d3f5b4..b3e9573b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2011-08-08 Stefano Lattarini + + 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 test defs: fix bug in TAP version of `skip_all_' diff --git a/tests/ac-output-old.tap b/tests/ac-output-old.tap index 201e5177b..ee2d15035 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 cbf6e573d..4c6a6248c 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 1c53a6d62..9397900c6 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 d3ae1dd80..8db108437 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 85bd9720b..82fd84469 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 f421fc793..dc5229901 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 086b38e34..cf475a198 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"