From 726540faa1a5136004eb41d5b70f61e8aa2b795f Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 13 Aug 2011 12:39:59 +0200 Subject: [PATCH] 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. --- ChangeLog | 10 ++++++++++ tests/defs | 5 +---- tests/tap-functions.sh | 15 ++++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d4ee09..cd30f9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2011-08-13 Stefano Lattarini + 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 + 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 diff --git a/tests/defs b/tests/defs index 047e22f..3bd378e 100644 --- a/tests/defs +++ b/tests/defs @@ -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 diff --git a/tests/tap-functions.sh b/tests/tap-functions.sh index 603b53c..ea88887 100644 --- a/tests/tap-functions.sh +++ b/tests/tap-functions.sh @@ -22,14 +22,14 @@ # 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 -- 2.7.4