2011-08-13 Stefano Lattarini <stefano.lattarini@gmail.com>
+ testsuite: more granular count of test results in our TAP library
+ * tests/tap-functions.sh ($tap_bad_count_): Removed, superseded
+ by ...
+ ($tap_fail_count_, $tap_xpass_count_): ... these new variables,
+ which keep more granular counts.
+ ($tap_pass_count_: New variable.
+ * tests/defs (exit trap): Adjust and simplify accordingly.
+
+2011-08-13 Stefano Lattarini <stefano.lattarini@gmail.com>
+
testsuite: fixlets and improvements in two long TAP-based tests
* tests/depmod.tap: Clean up the subdirectories used by tests that
passed, to avoid ending up with a too big test directory. This is
if test $have_tap_plan_ != yes; then
plan_ "now"
fi
- test $exit_status -eq 0 \
- && test $tap_xfail_count_ -eq 0 \
- && test $tap_skip_count_ -eq 0 \
- && test $tap_bad_count_ -eq 0 \
+ test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
|| keep_testdirs=yes
else
# This is to ensure that a test script does give a SKIP outcome just
# from within a subshell, unless explicitly noted otherwise.
#
-# The count of the TAP test results seen so far.
+# The counts of the TAP test results seen so far: total count and
+# per-result counts.
tap_count_=0
-# The count of skipped tests.
+tap_pass_count_=0
tap_skip_count_=0
-# The count of tests that experienced an expected failure.
+tap_fail_count_=0
tap_xfail_count_=0
-# The count of tests with unexpected outcomes (i.e., failed and xpassed).
-tap_bad_count_=0
+tap_xpass_count_=0
# The first "test -n" tries to avoid extra forks when possible.
if test -n "${ZSH_VERSION}${BASH_VERSION}" \
esac
incr_ tap_count_
case $tap_result_,$tap_directive_ in
- ok,) ;; # Passed.
+ ok,) incr_ tap_pass_count_;; # Passed.
not\ ok,TODO) incr_ tap_xfail_count_;; # Expected failure.
- not\ ok,*|ok,TODO) incr_ tap_bad_count_ ;; # Failed or xpassed.
+ not\ ok,*) incr_ tap_fail_count_ ;; # Failed.
+ ok,TODO) incr_ tap_xpass_count_ ;; # Unexpected pass.
ok,SKIP) incr_ tap_skip_count_ ;; # Skipped.
*) bailout_ "internal error in 'result_'";; # Can't happen.
esac