build: fix cleaning of test directories in contrib (and in t/perf)
[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 . ./defs || exit 1
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 $MAKE recheck >stdout && { cat stdout; exit 1; }
63 cat stdout
64 count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
65 grep 'foo\.test' stdout && exit 1
66 grep '^ERROR: bar\.test$' stdout
67 grep '^FAIL: baz\.test$' stdout
68
69 # Ensure that recheck builds check_SCRIPTS, and that
70 # recheck reruns nothing if check has not been run.
71 $MAKE clean
72 $MAKE recheck
73 test -f bla
74 test ! -e foo.log
75 test ! -e bar.log
76 test ! -e baz.log
77 test -f mylog.log
78
79 :