2 # Copyright (C) 2011-2013 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
26 cat >> configure.ac <<END
30 cat > Makefile.am << END
31 TEST_LOG_DRIVER = \$(srcdir)/tap-driver
32 TEST_LOG_COMPILER = $PERL -w
33 ## Will be updated later.
37 all_signals='1 2 3 9 13 15'
39 for sig in $all_signals; do
40 # Ignore blocked signals
41 if is_blocked_signal $sig; then
42 blocked_signals="$blocked_signals $sig"
45 # Write the dummy test scripts in perl, not as shell scripts, to work
46 # around unportabilities in the handling of signals (in fact, even
47 # with bash, the older script were unable to properly deliver a SIGQUIT
48 # to themselves consistently). The shebang is dummy here, as we prefer
49 # to rely on the definition of TEST_LOG_COMPILER instead.
50 unindent > signal-$sig.test <<END
52 # We need autoflush to avoid losing output, which could cause spurious
53 # "no test plan seen" in the TAP driver.
55 use warnings FATAL => "all";
59 print "Bail out! \$0 not killed?\\n";
61 echo TESTS += signal-$sig.test >> Makefile.am
63 results_count=$(ls *.test | wc -l | tr -d "$tab$sp")
73 system=$(uname -s -r || echo unknown) # Needed later.
85 *) fatal_ "unexpected signal number '$numeric'"
87 # Sending a SIGQUIT on Cygwin 1.5 can cause a segmentation fault
88 # instead (sometimes). Don't let this older bug pollute the results
90 case $numeric,$system in
91 3,CYGWIN*\ 1.5.*) sig_re="((SIG)?($symbolic|SEGV)|$numeric|11)";;
92 *) sig_re="((SIG)?$symbolic|$numeric)";;
94 wbound_re="($|[^a-zA-Z0-9_-])"
95 pfx_re="^ERROR: signal-$numeric\\.test"
96 case $am_tap_implementation in
97 # Dummy escape to please maintainer-check.
98 per\l) rx="$pfx_re - terminated by signal $sig_re$";;
99 shell) rx="$pfx_re .*terminated by signal $sig_re$wbound_re";;
100 *) fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'";;
102 desc="TAP driver catch test termination by signal SIG$symbolic"
103 case " $blocked_signals " in
104 *" $numeric "*) skip_ -r "SIG$symbolic is blocked" "$desc" ;;
105 *) command_ok_ "$desc" env LC_ALL=C $EGREP "$rx" stdout ;;
109 command_ok_ '"make check" fails' eval '
111 run_make -e IGNORE -O check
112 # Extra "echo" and silencing of xtraces required to avoid possible
113 # garbled output with NetBSD make, which would miss some final
114 # newlines in the expected places and thus mess up our TAP output.
116 test $am_make_rc -gt 0
119 cat stdout # For debugging.
121 command_ok_ "count of test results" count_test_results \
122 total=$(($results_count * 2)) \
123 pass=$results_count error=$results_count \
124 fail=0 xpass=0 xfail=0 skip=0
126 for sig in $all_signals; do
130 echo 'TEST_LOG_DRIVER_FLAGS = --ignore-exit' >> Makefile
132 command_ok_ '"make check" passes [--ignore-exit]' run_make -O check
134 command_ok_ "count of test results [--ignore-exit]" count_test_results \
135 total=$results_count pass=$results_count \
136 fail=0 xpass=0 xfail=0 skip=0 error=0