testsuite: scaffolding to allow use of TAP in our own tests
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 17 Jul 2011 11:38:42 +0000 (13:38 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 3 Aug 2011 10:50:38 +0000 (12:50 +0200)
commitc349db06721d376cb70be78450e78d30a476910d
tree703795a806fab500f951634d7f242f6d64b6c6a5
parent25903324b11ea930bf6f6107e119158d494a0603
testsuite: scaffolding to allow use of TAP in our own tests

Now that Automake has initial support for the TAP test protocol,
we can start "eating our own dog food" and rewrite some tests to
use TAP; this should allow for better granularity, especially in
the control of skips and expected failures.  With this change, we
set up the initial scaffolding required by the planned TAP tests,
and convert few older tests to use TAP, mostly in order to verify
that there are no obvious errors.  The tests in our testsuite that
use the TAP protocol will be marked by the new `.tap' extension.

* tests/plain-functions.sh: New file containing definition of
helper shell functions used by the "protocol-less" tests of the
Automake testsuite.
* tests/tap-functions.sh:  New file containing definition of
helper shell functions used by the TAP-producing tests of the
Automake testsuite.
* tests/defs: Remove definitions of some functions that are
now defined in `plain-functions.sh'.  Instead, source one of
`plain-functions.sh' or `tap-functions.sh', depending on whether
`$use_tap' is set to "no" or "yes".
(exit trap): Call `late_plan_' if `$use_tap' is true.  Also,
unset shell traces before issuing the latest commands, to avoid
confusing the tap driver with spurious output.
* tests/defs-static.in ($use_tap): New variable, by default set
to "yes" if the calling test script has a `.tap' suffix, and to
"no" otherwise.  The individual scripts can override it though.
In code sanity-checking the environment, verify that `$use_tap'
is not exported.
* tests/self-check-env-sanitize.test: Update, and small related
reformatting.
* tests/self-check-tap.test: New very minimal self test.
* tests/acoutbs.test, tests/acoutbs2.test, tests/acoutnoq.test,
tests/acoutpt.test, tests/acoutpt2.test, tests/acoutqnl.test:
Removed, merged into ...
* tests/ac-output-old.tap: ... this new test, that uses TAP.
* tests/Makefile.am (TAP_LOG_DRIVER): Define to invoke our own
`tap-driver' script.
(TAP_LOG_DRIVER_FLAGS): Define to `--merge', so that the stdout
and stderr of the test scripts remains synced.
(TEST_EXTENSIONS): Define, to add the `.tap' suffix; also list
the `.test' suffix explicitly.
(EXTRA_DIST): Distribute the new files `plain-functions.sh' and
`tap-functions.sh'.
($(TEST_LOGS)): Depends on them.
(AM_TESTS_ENVIRONMENT): Ensure that `use_tap' is not exported in
the environment of the tests.
(TESTS): Update.
16 files changed:
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/ac-output-old.tap [new file with mode: 0755]
tests/acoutbs.test [deleted file]
tests/acoutbs2.test [deleted file]
tests/acoutnoq.test [deleted file]
tests/acoutpt.test [deleted file]
tests/acoutpt2.test [deleted file]
tests/acoutqnl.test [deleted file]
tests/defs
tests/defs-static.in
tests/plain-functions.sh [new file with mode: 0644]
tests/self-check-env-sanitize.test
tests/self-check-tap.test [new file with mode: 0755]
tests/tap-functions.sh [new file with mode: 0644]