tests: expose automake bug#13940
[platform/upstream/automake.git] / t / subdir-keep-going-pr12554.sh
1 #! /bin/sh
2 # Copyright (C) 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 that the Automake-generated recursive rules are resilient against
18 # false positives in deciding whether make is running with the '-k'
19 # option, and thus whether a failure into one of the $(SUBDIRS) should
20 # still prevent recursion in the following $(SUBDIRS) entries.  See
21 # automake bug#12544.
22
23 . test-init.sh
24
25 echo nil: | $MAKE -I . -f - || skip_ "$MAKE doesn't support the -I option"
26
27 cat >> configure.ac <<'END'
28 AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
29 AC_OUTPUT
30 END
31
32 mkdir k ./--keep-going sub1 sub2
33
34 cat > Makefile.am <<'END'
35 SUBDIRS = sub1 sub2
36 END
37
38 cat > sub1/Makefile.am <<'END'
39 all-local:
40         touch ko
41         false
42 END
43 cat > sub2/Makefile.am <<'END'
44 all-local:
45         test -f ../sub1/ko
46         touch ok
47 END
48
49 $ACLOCAL
50 $AUTOCONF
51 $AUTOMAKE
52 ./configure
53
54 st=0
55 $MAKE -I k -I --keep-going \
56   TESTS='k --keep-going -k' AM_MAKEFLAGS="TESTS='k --keep-going -k'" \
57   || st=$?
58 # Don't trust the exit status of "make -k" for non-GNU make.
59 if using_gmake; then
60   test $st -gt 0 || exit 1
61 fi
62 test ! -r sub2/ok
63
64 # Sanity check.
65 st=0; $MAKE -k || st=$?
66 if { using_gmake && test $st -eq 0; } || test ! -f sub2/ok; then
67   fatal_ '"make -k" not working as expected'
68 fi
69
70 :