Hash :
61168e3c
Author :
Date :
2012-01-06T12:39:24
tests: skip tests on perl TAP driver if TAP::Parser is not available We had so far taken for granted that all the perl installations modern enough to correctly run automake also came with a built-in TAP::Parser module; unfortunately, testing on MinGW/MSYS has shown that this is not always true, and that a lot of spurious testsuite failures would take place in such a situation (see automake bug#10440). Luckily, the perl implementation of the Automake TAP driver is only meant to be used for prototyping and consistency checks, the "real" Automake TAP driver being the portable one implemented in awk. So we can simply skip the affected tests on systems lacking TAP::Parser. * tests/defs (fetch_tap_driver): Skip the whole test case if the desired tap driver implementation is the perl one but the TAP::Parser module is unavailable. * tests/tap-bad-prog.tap: Adjust order of calls to `plan_' and `fetch_tap_driver', to ensure the test is not skipped after the TAP plan has been outputted (which would lead to a spurious error). * tests/tap-bad-signal.tap: Tweak to avoid the need to source the `tap-setup.sh' script, as that might cause a test skip too late, i.e., after a TAP plan has been already printed. * tests/tap-test-number-0.test: Do not force the test to skip when the tested TAP driver implementation is not the perl one. On the other hand, when it *is* the perl one, skip the test if the TAP::Parser module is unavailable. * tests/test-driver-cond.test: Skip the part of the test actually running "make check" if the TAP::Parser module is unavailable. * tests/get-sysconf.test: Also print the version of the `TAP::Parser' module, if available. Reported by Peter Rosin.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
#! /bin/sh
# Copyright (C) 2011, 2012 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# TAP support:
# - a test script terminated by a signal causes an hard error
am_parallel_tests=yes
. ./defs || Exit 1
fetch_tap_driver
plan_ 10
cat >> configure.in <<END
AC_OUTPUT
END
cat > Makefile.am << END
TEST_LOG_DRIVER = \$(srcdir)/tap-driver
TEST_LOG_COMPILER = $PERL -w
## Will be updated later.
TESTS =
END
all_signals='1 2 3 9 13 15'
blocked_signals=''
for sig in $all_signals; do
# Ignore blocked signals
if is_blocked_signal $sig; then
blocked_signals="$blocked_signals $sig"
continue
fi
# Write the dummy test scripts in perl, not as shell scripts, to work
# around unportabilities in the handling of signals (in fact, even
# with bash, the older script were unable to properly deliver a SIGQUIT
# to themselves consistently). The shebang is dummy here, as we prefer
# to rely on the definition of TEST_LOG_COMPILER instead.
unindent > signal-$sig.test <<END
#! perl
# We need autoflush to avoid losing output, which could cause spurious
# "no test plan seen" in the TAP driver.
BEGIN { $| = 1 }
use warnings FATAL => "all";
print "1..1\\n";
print "ok 1\\n";
kill $sig, \$\$;
print "Bail out! \$0 not killed?\\n";
END
echo TESTS += signal-$sig.test >> Makefile.am
done
results_count=`ls *.test | wc -l | tr -d "$tab$sp"`
chmod a+x *.test
$ACLOCAL
$AUTOCONF
$AUTOMAKE
./configure
signal_caught ()
{
numeric=$1
case $numeric in
1) symbolic=HUP;;
2) symbolic=INT;;
3) symbolic=QUIT;;
9) symbolic=KILL;;
13) symbolic=PIPE;;
15) symbolic=TERM;;
*) fatal_ "unexpected signal number '$numeric'"
esac
sig_re="((SIG)?$symbolic|$numeric)"
wbound_re="($|[^a-zA-Z0-9_-])"
pfx_re="^ERROR: signal-$numeric\\.test"
case $am_tap_implementation in
perl) rx="$pfx_re - terminated by signal $sig_re$";;
shell) rx="$pfx_re .*terminated by signal $sig_re$wbound_re";;
*) fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'";;
esac
desc="TAP driver catch test termination by signal SIG$symbolic"
case " $blocked_signals " in
*" $numeric "*) skip_ -r "SIG$symbolic is blocked" "$desc" ;;
*) command_ok_ "$desc" env LC_ALL=C $EGREP "$rx" stdout ;;
esac
}
command_ok_ '"make check" fails' eval 'not $MAKE check >stdout'
cat stdout # For debugging.
command_ok_ "count of test results" count_test_results \
total=`expr $results_count '*' 2` \
pass=$results_count error=$results_count \
fail=0 xpass=0 xfail=0 skip=0
for sig in $all_signals; do
signal_caught $sig
done
echo 'TEST_LOG_DRIVER_FLAGS = --ignore-exit' >> Makefile
command_ok_ '"make check" passes [--ignore-exit]' eval '$MAKE check >stdout'
cat stdout # For debugging.
command_ok_ "count of test results [--ignore-exit]" count_test_results \
total=$results_count pass=$results_count \
fail=0 xpass=0 xfail=0 skip=0 error=0
: