doc: typos in test file.
[automake.git] / t / parallel-tests-exit-statuses.sh
blobdd72b9c1c807ffaf5540445050bc5cd2309e0d5a
1 #! /bin/sh
2 # Copyright (C) 2011-2024 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)
7 # any later version.
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 <https://www.gnu.org/licenses/>.
17 # Check parallel-tests features: normal and special exit statuses
18 # in the test scripts.
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_OUTPUT
24 END
26 # $failure_statuses should be defined to the list of all integers between
27 # 1 and 255 (inclusive), excluded 77 and 99.
28 failure_statuses=$(seq_ 1 255 | $EGREP -v '^(77|99)$' | tr "$nl" ' ')
29 # For debugging.
30 echo "failure_statuses: $failure_statuses"
31 # Sanity check.
32 test $(for st in $failure_statuses; do echo $st; done | wc -l) -eq 253 \
33 || fatal_ "initializing list of exit statuses for simple failures"
35 cat > Makefile.am <<END
36 LOG_COMPILER = $AM_TEST_RUNNER_SHELL ./do-exit
37 fail_tests = $failure_statuses
38 TESTS = 0 77 99 $failure_statuses
39 \$(TESTS):
40 END
42 cat > do-exit <<'END'
43 #!/bin/sh
44 echo "$0: $1"
45 case $1 in
46 [0-9]|[0-9][0-9]|[0-9][0-9][0-9]) st=$1;;
47 */[0-9]|*/[0-9][0-9]|*/[0-9][0-9][0-9]) st=${1##*/};;
48 *) st=99;;
49 esac
50 exit $st
51 END
52 chmod a+x do-exit
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE -a
59 echo PASS: 0
60 echo SKIP: 77
61 echo ERROR: 99
62 for st in $failure_statuses; do
63 echo "FAIL: $st"
64 done
65 } | LC_ALL=C sort > exp-0
67 sed 's/^FAIL:/XFAIL:/' exp-0 | LC_ALL=C sort > exp-1
68 sed '/^ERROR:/d' exp-1 > exp-2
70 ./configure
72 mk_ ()
74 n=$1; shift
75 unset am_make_rc
76 run_make -e IGNORE -O -- ${1+"$@"} check
77 cat test-suite.log
78 LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-$n
79 cat exp-$n
80 cat got-$n
81 diff exp-$n got-$n
84 mk_ 0
85 test $am_make_rc -gt 0
86 mk_ 1 XFAIL_TESTS="$failure_statuses 99"
87 test $am_make_rc -gt 0
88 mk_ 2 XFAIL_TESTS="$failure_statuses" TESTS="0 77 $failure_statuses"
89 test $am_make_rc -eq 0