2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # - a test script terminated by a signal causes an hard error
27 cat >> configure.ac <<END
31 cat > Makefile.am << END
32 TEST_LOG_DRIVER = \$(srcdir)/tap-driver
33 TEST_LOG_COMPILER = $PERL -w
34 ## Will be updated later.
38 all_signals='1 2 3 9 13 15'
40 for sig in $all_signals; do
41 # Ignore blocked signals
42 if is_blocked_signal $sig; then
43 blocked_signals="$blocked_signals $sig"
46 # Write the dummy test scripts in perl, not as shell scripts, to work
47 # around unportabilities in the handling of signals (in fact, even
48 # with bash, the older script were unable to properly deliver a SIGQUIT
49 # to themselves consistently). The shebang is dummy here, as we prefer
50 # to rely on the definition of TEST_LOG_COMPILER instead.
51 unindent > signal-$sig.test <<END
53 # We need autoflush to avoid losing output, which could cause spurious
54 # "no test plan seen" in the TAP driver.
56 use warnings FATAL => "all";
60 print "Bail out! \$0 not killed?\\n";
62 echo TESTS += signal-$sig.test >> Makefile.am
64 results_count=`ls *.test | wc -l | tr -d "$tab$sp"`
74 system=`uname -s -r || echo unknown` # Needed later.
86 *) fatal_ "unexpected signal number '$numeric'"
88 # Sending a SIGQUIT on Cygwin 1.5 can cause a segmentation fault
89 # instead (sometimes). Don't let this older bug pollute the results
91 case $numeric,$system in
92 3,CYGWIN*\ 1.5.*) sig_re="((SIG)?($symbolic|SEGV)|$numeric|11)";;
93 *) sig_re="((SIG)?$symbolic|$numeric)";;
95 wbound_re="($|[^a-zA-Z0-9_-])"
96 pfx_re="^ERROR: signal-$numeric\\.test"
97 case $am_tap_implementation in
98 # Dummy escape to please maintainer-check.
99 per\l) rx="$pfx_re - terminated by signal $sig_re$";;
100 shell) rx="$pfx_re .*terminated by signal $sig_re$wbound_re";;
101 *) fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'";;
103 desc="TAP driver catch test termination by signal SIG$symbolic"
104 case " $blocked_signals " in
105 *" $numeric "*) skip_ -r "SIG$symbolic is blocked" "$desc" ;;
106 *) command_ok_ "$desc" env LC_ALL=C $EGREP "$rx" stdout ;;
110 command_ok_ '"make check" fails' eval '
112 st=0; $MAKE check >stdout || st=$?
114 # Extra "echo" and silencing of xtraces required to avoid possible
115 # garbled output with NetBSD make, which would miss some final
116 # newlines in the expected places and thus mess up our TAP output.
121 cat stdout # For debugging.
123 command_ok_ "count of test results" count_test_results \
124 total=`expr $results_count '*' 2` \
125 pass=$results_count error=$results_count \
126 fail=0 xpass=0 xfail=0 skip=0
128 for sig in $all_signals; do
132 echo 'TEST_LOG_DRIVER_FLAGS = --ignore-exit' >> Makefile
134 command_ok_ '"make check" passes [--ignore-exit]' eval '$MAKE check >stdout'
135 cat stdout # For debugging.
137 command_ok_ "count of test results [--ignore-exit]" count_test_results \
138 total=$results_count pass=$results_count \
139 fail=0 xpass=0 xfail=0 skip=0 error=0