tests: expose automake bug#13940
[platform/upstream/automake.git] / t / parallel-tests-dry-run-1.sh
1 #! /bin/sh
2 # Copyright (C) 2012-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 interactions between the parallel test harness and "make -n".
18 # See also sister test 'parallel-tests-dry-run-2.sh'.
19
20 . test-init.sh
21
22 echo AC_OUTPUT >> configure.ac
23
24 cat > Makefile.am <<'END'
25 TESTS = foo.test bar.test
26 $(TESTS):
27 END
28
29 $ACLOCAL
30 $AUTOCONF
31 $AUTOMAKE -a
32
33 ./configure
34
35 # Avoid confusion with test logs.
36 rm -f config.log
37
38 log_files='test-suite.log foo.log bar.log'
39
40 all_exist ()
41 {
42   st=0
43   for i in $*; do
44     test -f $i || { echo File $i not found; st=1; }
45   done
46   test $st -eq 0
47 }
48
49 none_exist ()
50 {
51   st=0
52   for i in $*; do
53     if test -r $i || test -f $i; then
54       echo File $i found
55       st=1
56     fi
57   done
58   test $st -eq 0
59 }
60
61 for targ in check recheck $log_files; do
62   $MAKE -n "$targ"
63   none_exist $log_files
64 done
65
66 touch $log_files
67
68 $MAKE -n mostlyclean
69 all_exist $log_files
70 $MAKE -n clean
71 all_exist $log_files
72
73 cat > foo.test <<'END'
74 #! /bin/sh
75 exit 0
76 END
77
78 cat > bar.test <<'END'
79 #! /bin/sh
80 exit 1
81 END
82
83 chmod a+x foo.test bar.test
84
85 $MAKE check && exit 1
86
87 for targ in recheck clean mostlyclean distclean; do
88   $MAKE -n "$targ"
89   all_exist $log_files
90 done
91
92 :