tests: two minor fixups
[platform/upstream/automake.git] / t / parallel-tests-recheck-pr11791.sh
1 #! /bin/sh
2 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # parallel-tests: "make recheck" and "make -k recheck" in the face of
18 # build failures for the test cases.  See automake bug#11791.
19
20 required='cc native'
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AC_OUTPUT
26 END
27
28 cat > Makefile.am << 'END'
29 TESTS = $(EXTRA_PROGRAMS)
30 EXTRA_PROGRAMS = foo
31 END
32
33 echo 'int main (void) { return 1; }' > foo.c
34
35 $ACLOCAL
36 $AUTOCONF
37 $AUTOMAKE -a
38
39 ./configure
40
41 $MAKE check >stdout && { cat stdout; exit 1; }
42 cat stdout
43 count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
44
45 $sleep # Required to avoid a spurious failure with some FreeBSD makes.
46 st=0; $MAKE -k recheck >stdout || st=$?
47 cat stdout
48 # Don't trust the exit status of "make -k" for non-GNU makes.
49 if using_gmake && test $st -eq 0; then exit 1; fi
50 count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
51
52 # Introduce an error in foo.c, that should cause a compilation failure.
53 $sleep
54 echo choke me >> foo.c
55
56 $MAKE recheck >stdout && { cat stdout; exit 1; }
57 cat stdout
58 # We don't get a change to run the testsuite.
59 $EGREP '(X?PASS|X?FAIL|SKIP|ERROR):' stdout && exit 1
60 # These shouldn't be removed, otherwise the next make recheck will do
61 # nothing.
62 test -f foo.log
63 test -f foo.trs
64
65 $sleep # Required to avoid a spurious failure with some FreeBSD makes.
66 st=0; $MAKE -k recheck >stdout || st=$?
67 cat stdout
68 # Don't trust the exit status of "make -k" for non-GNU makes.
69 if using_gmake && test $st -eq 0; then exit 1; fi
70 # We don't get a change to run the testsuite.
71 $EGREP '(X?PASS|X?FAIL|SKIP|ERROR):' stdout && exit 1
72 test -f foo.log
73 test -f foo.trs
74
75 # "Repair" foo.c, and expect everything to work.
76 $sleep
77 echo 'int main (void) { return 0; }' > foo.c
78
79 $MAKE recheck >stdout || { cat stdout; exit 1; }
80 cat stdout
81 count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
82 test -f foo.log
83 test -f foo.trs
84
85 $MAKE recheck >stdout || { cat stdout; exit 1; }
86 cat stdout
87 count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
88 test -f foo.log
89 test -f foo.trs
90
91 :