testsuite: more granular count of test results in our TAP library
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 13 Aug 2011 10:39:59 +0000 (12:39 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 13 Aug 2011 19:04:09 +0000 (21:04 +0200)
* 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.

ChangeLog
tests/defs
tests/tap-functions.sh

index 1d4ee09..cd30f9f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 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
index 047e22f..3bd378e 100644 (file)
@@ -871,10 +871,7 @@ if test "$sh_errexit_works" = yes; then
       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
index 603b53c..ea88887 100644 (file)
 #            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}" \
@@ -132,9 +132,10 @@ result_ ()
   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