dist: deprecated shar and tar+compress formats
[platform/upstream/automake.git] / t / parallel-tests-recheck.sh
1 #! /bin/sh
2 # Copyright (C) 2009-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 # Check parallel-tests features:
18 # - recheck
19
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 AC_OUTPUT
24 END
25
26 cat > Makefile.am << 'END'
27 TEST_SUITE_LOG = mylog.log
28 TESTS = foo.test bar.test baz.test
29 check_SCRIPTS = bla
30 CLEANFILES = bla
31 bla:
32         echo bla > $@
33 END
34
35 cat > foo.test <<'END'
36 #! /bin/sh
37 echo "this is $0"
38 test -f bla || exit 1
39 exit 0
40 END
41 cat > bar.test <<'END'
42 #! /bin/sh
43 echo "this is $0"
44 exit 99
45 END
46 cat > baz.test <<'END'
47 #! /bin/sh
48 echo "this is $0"
49 exit 1
50 END
51 chmod a+x foo.test bar.test baz.test
52
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE -a
56
57 ./configure
58 $MAKE check >stdout && { cat stdout; exit 1; }
59 cat stdout
60 count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
61
62 # Running this two times in a row should produce the same results the
63 # second time.
64 for i in 1 2; do
65   using_gmake || $sleep # Required by BSD make.
66   $MAKE recheck >stdout && { cat stdout; exit 1; }
67   cat stdout
68   count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
69   grep 'foo\.test' stdout && exit 1
70   grep '^ERROR: bar\.test$' stdout
71   grep '^FAIL: baz\.test$' stdout
72 done
73
74 # Ensure that recheck builds check_SCRIPTS, and that
75 # recheck reruns nothing if check has not been run.
76 $MAKE clean
77 $MAKE recheck
78 test -f bla
79 test ! -e foo.log
80 test ! -e bar.log
81 test ! -e baz.log
82 test -f mylog.log
83
84 :