Merge branch 'minor'
[automake.git] / t / parallel-tests-exit-status-reported.sh
blob2b8420773cd415cdd030db83e095f50a0319e153
1 #! /bin/sh
2 # Copyright (C) 2013-2017 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 # The exit status of a test should be reported in the test logs, so
18 # that one can see at a glance whether the test has succeeded or failed,
19 # without having to look also into the corresponding .trs file.
20 # See automake bug#11814.
22 . test-init.sh
24 echo AC_OUTPUT >> configure.ac
26 echo XFAIL_TESTS = t3.test t00.test > Makefile.am
27 echo TESTS = t00.test >> Makefile.am
28 for s in 0 1 2 3 5 77 78 99 100 126 127; do
29 echo "TESTS += t${s}.test" >> Makefile.am
30 cat > t${s}.test <<END
31 #!/bin/sh
32 printf "%s\\n%s\\n" 'random' 'will exit with status $s'
33 exit $s
34 END
35 done
36 cp t0.test t00.test
38 chmod a+x *.test
40 $ACLOCAL
41 $AUTOCONF
42 $AUTOMAKE -a
44 ./configure
45 run_make -e FAIL check
46 ls -l # For debugging.
48 match_result ()
50 cat "$1.log" # For debugging.
51 test $(wc -l <"$1.log") -eq 3
52 sed -n '$p' "$1.log" | grep "^$2 $1\\.test (exit status: $3)$"
55 match_result t0 PASS 0
56 match_result t00 XPASS 0
57 match_result t1 FAIL 1
58 match_result t2 FAIL 2
59 match_result t3 XFAIL 3
60 match_result t5 FAIL 5
61 match_result t77 SKIP 77
62 match_result t78 FAIL 78
63 match_result t99 ERROR 99
64 match_result t100 FAIL 100
65 match_result t126 FAIL 126
66 match_result t127 FAIL 127