Merge branch 'maint'
[platform/upstream/automake.git] / t / parallel-tests9.sh
1 #! /bin/sh
2 # Copyright (C) 2009-2012 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 am_parallel_tests=yes
21 . ./defs || Exit 1
22
23 cat >> configure.ac << 'END'
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am << 'END'
28 TEST_SUITE_LOG = mylog.log
29 TESTS = foo.test bar.test baz.test
30 check_SCRIPTS = bla
31 CLEANFILES = bla
32 bla:
33         echo bla > $@
34 END
35
36 cat > foo.test <<'END'
37 #! /bin/sh
38 echo "this is $0"
39 test -f bla || exit 1
40 exit 0
41 END
42 cat > bar.test <<'END'
43 #! /bin/sh
44 echo "this is $0"
45 exit 99
46 END
47 cat > baz.test <<'END'
48 #! /bin/sh
49 echo "this is $0"
50 exit 1
51 END
52 chmod a+x foo.test bar.test baz.test
53
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE -a
57
58 ./configure
59 $MAKE check >stdout && { cat stdout; Exit 1; }
60 cat stdout
61 count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
62
63 $MAKE recheck >stdout && { cat stdout; Exit 1; }
64 cat stdout
65 count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
66 grep 'foo\.test' stdout && Exit 1
67 grep '^ERROR: bar\.test$' stdout
68 grep '^FAIL: baz\.test$' stdout
69
70 # Ensure that recheck builds check_SCRIPTS, and that
71 # recheck reruns nothing if check has not been run.
72 $MAKE clean
73 $MAKE recheck
74 test -f bla
75 test ! -f foo.log
76 test ! -f bar.log
77 test ! -f baz.log
78 test -f mylog.log
79
80 :