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