cosmetics: remove trailing whitespace in some files
[platform/upstream/automake.git] / t / parallel-tests-dry-run-2.sh
1 #! /bin/sh
2 # Copyright (C) 2011-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 interactions between the parallel test harness and "make -n".
18 # See also sister test 'parallel-tests-dry-run-1.test'.
19
20 . ./defs || Exit 1
21
22 cat >> configure.ac << 'END'
23 AC_OUTPUT
24 END
25
26 cat > Makefile.am <<'END'
27 TESTS = foo.test bar.test
28 TEST_LOG_COMPILER = $(SHELL)
29 END
30
31 $ACLOCAL
32 $AUTOMAKE -a
33 $AUTOCONF
34
35 ./configure
36
37 make_n_ ()
38 {
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
45   :
46 }
47
48 : > output
49
50 files='foo.log bar.log foo.trs bar.trs'
51
52 for target in check recheck test-suite.log; do
53   test ! -f foo.log
54   test ! -f foo.trs
55   test ! -f bar.log
56   test ! -f bar.trs
57   test ! -f test-suite.log
58 done
59
60 # Creative quoting below to please maintainer-check.
61 echo exit '0' > foo.test
62 echo exit '1' > bar.test
63
64 $MAKE check && Exit 1
65
66 chmod a-w .
67
68 make_n_ clean
69 test -f foo.log
70 test -f foo.trs
71 test -f foo.log
72 test -f bar.trs
73
74 # Creative quoting below to please maintainer-check.
75 cat > foo.test <<END
76 echo this is bad
77 exit 1
78 END
79 echo exit '0' > bar.test
80
81 for target in check recheck test-suite.log; do
82   make_n_ $target
83   grep '^:test-result: *FAIL' bar.trs
84   grep 'this is bad' foo.log test-suite.log && Exit 1
85   : For shells with busted 'set -e'.
86 done
87
88 chmod a-rw $files
89 if test -r foo.log; then
90   : You can still read unreadable files!  Skip these checks.
91 else
92   for target in check recheck test-suite.log; do
93     make_n_ $target
94     for f in $files; do
95       test -f $f && test ! -r $f || Exit 1
96     done
97   done
98 fi
99 chmod u+r $files
100
101 chmod u+w .
102 rm -f foo.log bar.trs
103 chmod a-w .
104 for target in check recheck test-suite.log $files; do
105   make_n_ $target
106   test ! -f foo.log
107   test -f foo.trs
108   test ! -f bar.trs
109   test -f bar.log
110 done
111
112 :