Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / parallel-tests9.test
1 #! /bin/sh
2 # Copyright (C) 2009, 2010  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 # Check parallel-tests features:
18 # - recheck
19
20 parallel_tests=yes
21 . ./defs || Exit 1
22
23 set -e
24
25 cat >> configure.in << 'END'
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am << 'END'
30 TEST_SUITE_LOG = mylog.log
31 TESTS = foo.test bar.test baz.test
32 check_SCRIPTS = bla
33 CLEANFILES = bla
34 bla:
35         echo bla > $@
36 END
37
38 cat >>foo.test <<'END'
39 #! /bin/sh
40 echo "this is $0"
41 test -f bla || exit 1
42 exit 0
43 END
44 cat >>bar.test <<'END'
45 #! /bin/sh
46 echo "this is $0"
47 exit 99
48 END
49 cat >>baz.test <<'END'
50 #! /bin/sh
51 echo "this is $0"
52 exit 1
53 END
54 chmod a+x foo.test bar.test baz.test
55
56 $ACLOCAL
57 $AUTOCONF
58 $AUTOMAKE -a
59
60 ./configure
61 $MAKE check >stdout && { cat stdout; Exit 1; }
62 cat stdout
63
64 $MAKE recheck >stdout && { cat stdout; Exit 1; }
65 cat stdout
66 grep foo.test stdout && Exit 1
67 grep bar.test stdout || Exit 1
68 grep baz.test stdout || Exit 1
69 grep '2 of 2.*failed' stdout
70
71 # If we cannot read the log file, then redo it as well.
72 chmod a-r foo.log
73 if test ! -r foo.log; then
74    $MAKE recheck >stdout && { cat stdout; Exit 1; }
75    cat stdout
76    grep foo.test stdout || Exit 1
77 fi
78
79 # Ensure that recheck builds check_SCRIPTS, and that
80 # recheck reruns nothing if check has not been run.
81 $MAKE clean
82 $MAKE recheck
83 test -f bla
84 test ! -f foo.log
85 test ! -f bar.log
86 test ! -f baz.log
87 test -f mylog.log
88 :