testsuite: TAP tests properly decide when to remove tempdirs
Before this change, the TAP tests in the Automake testsuite were
removing the temporary test directory even when they failed or
were skipped, thus making debugging more difficult.
* tests/tap-functions.sh (incr_tap_count): Removed, superseded
by ...
(incr_): ... this function, which can increment the value of any
variable passed to it.
(result_): Updated to use `incr_' instead of the now-removed
`incr_tap_count_'. Keep count of failures, xfailures, xpasses,
and skips, using ...
($tap_skip_count_, $tap_bad_count, _$tap_xfail_count_): ...
these new variables.
* tests/defs (trap): Try to use their values to decide whether
the temporary directory being used by the test script should be
removed or not. Other code reorganizations. And move the code
for the removal of the temporary directory out to ...
(rm_rf_): ... this new subroutine.
(Main code): Use that instead of duplicating the code.