tests: give few aclocal tests more significant names
[automake.git] / t / parallel-tests-dry-run-2.sh
blobd47a76a8c27fd6f3ee8a1da73a06cfa199410f05
1 #! /bin/sh
2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Check interactions between the parallel test harness and "make -n".
18 # See also sister test 'parallel-tests-dry-run-1.sh'.
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_OUTPUT
24 END
26 cat > Makefile.am <<'END'
27 TESTS = foo.test bar.test
28 TEST_LOG_COMPILER = $(SHELL)
29 END
31 $ACLOCAL
32 $AUTOMAKE -a
33 $AUTOCONF
35 ./configure
37 make_n_ ()
39 st=0
40 $MAKE -n "$@" >output 2>&1 || { cat output; ls -l; exit 1; }
41 cat output
42 # Look out for possible errors from common tools used by recipes.
43 $EGREP -i ' (exist|permission|denied|no .*(such|file))' output && exit 1
44 $EGREP '(mv|cp|rm|cat|grep|sed|awk): ' output && exit 1
48 : > output
50 files='foo.log bar.log foo.trs bar.trs'
52 echo 'exit 0' > foo.test
53 echo 'exit 1' > bar.test
55 for target in check recheck test-suite.log; do
56 make_n_ $target
57 test ! -e foo.log
58 test ! -e foo.trs
59 test ! -e bar.log
60 test ! -e bar.trs
61 test ! -e test-suite.log
62 done
64 $MAKE check && exit 1
66 chmod a-w .
68 make_n_ clean
69 test -f foo.log
70 test -f foo.trs
71 test -f foo.log
72 test -f bar.trs
74 cat > foo.test <<END
75 echo this is bad
76 exit 1
77 END
78 echo 'exit 0' > bar.test
80 for target in check recheck test-suite.log; do
81 make_n_ $target
82 grep '^:test-result: *FAIL' bar.trs
83 grep 'this is bad' foo.log test-suite.log && exit 1
84 : For shells with busted 'set -e'.
85 done
87 chmod a-rw $files
88 if test -r foo.log; then
89 : You can still read unreadable files! Skip these checks.
90 else
91 for target in check recheck test-suite.log; do
92 make_n_ $target
93 for f in $files; do
94 test -f $f && test ! -r $f || exit 1
95 done
96 done
98 chmod u+r $files
100 chmod u+w .
101 rm -f foo.log bar.trs
102 chmod a-w .
103 for target in check recheck test-suite.log $files; do
104 make_n_ $target
105 test ! -e foo.log
106 test -f foo.trs
107 test ! -e bar.trs
108 test -f bar.log
109 done