Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / parallel-tests-log-override-recheck.test
1 #! /bin/sh
2 # Copyright (C) 2011 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: runtime redefinition of $(TEST_SUITE_LOG)
18 # for the recheck target.
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 TESTS = foo.test bar.test baz.test
31 END
32
33 cat > foo.test <<'END'
34 #! /bin/sh
35 echo "this is $0"
36 exit 0
37 END
38
39 cat > bar.test <<'END'
40 #! /bin/sh
41 echo "this is $0"
42 exit 99
43 END
44
45 cat > baz.test <<'END'
46 #! /bin/sh
47 echo "this is $0"
48 exit ${BAZ_EXIT_STATUS-1}
49 END
50
51 chmod a+x *.test
52
53 unset BAZ_EXIT_STATUS || :
54
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE -a
58
59 ./configure
60 $MAKE check >stdout && { cat stdout; Exit 1; }
61 cat stdout
62
63 chmod a-rw test-suite.log
64 TEST_SUITE_LOG=my.log $MAKE -e recheck >stdout \
65   && { cat stdout; Exit 1; }
66 cat stdout
67 ls -l
68 grep '^2 of 2 .*failed' stdout
69 for x in stdout my.log; do
70   $FGREP foo.test $x && Exit 1
71   $FGREP bar.test $x
72   $FGREP baz.test $x
73 done
74
75 chmod a-rw my.log
76 BAZ_EXIT_STATUS=0 TEST_SUITE_LOG=my2.log $MAKE -e recheck >stdout \
77   && { cat stdout; Exit 1; }
78 cat stdout
79 ls -l
80 grep '^1 of 2 .*failed' stdout
81 $FGREP foo.test stdout && Exit 1
82 $FGREP bar.test stdout
83 $FGREP baz.test stdout
84 $FGREP foo.test my2.log && Exit 1
85 $FGREP bar.test my2.log
86 $FGREP baz.test my2.log && Exit 1
87
88 chmod u+r test-suite.log my.log
89 $FGREP baz.test test-suite.log
90 $FGREP baz.test my.log
91
92 :