am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / txinfo-makeinfo-error-no-clobber.sh
1 #! /bin/sh
2 # Copyright (C) 2003-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 # Make sure info files survive makeinfo errors.
18
19 required=makeinfo
20 . test-init.sh
21
22 echo AC_OUTPUT >> configure.ac
23
24 cat > Makefile.am << 'END'
25 info_TEXINFOS = main.texi sub/main.texi
26 END
27
28 mkdir sub
29
30 cat > main.texi << 'END'
31 \input texinfo
32 @setfilename main.info
33 @settitle main
34 @node Top
35 Hello walls.
36 @bye
37 END
38
39 cp main.texi sub/main.texi
40
41 $ACLOCAL
42 $AUTOMAKE --add-missing
43 $AUTOCONF
44
45 ./configure
46 $MAKE
47
48 # Feign more info files.
49 : > main.info-1
50 : > sub/main.info-1
51
52 # Break main.texi.
53 $sleep
54 cp main.texi main.old
55 cat > main.texi << 'END'
56 \input texinfo
57 @setfilename main.info
58 @settitle main
59 @node Top
60 @unknown_macro{Hello walls.}
61 @bye
62 END
63
64 # makeinfo will bail out, but we should conserve the old info files.
65 $MAKE && exit 1
66 test -f main.info
67 test -f main.info-1
68
69 # Restore main.texi, and break sub/main.texi.
70 cp main.texi sub/main.texi
71 mv main.old main.texi
72 $MAKE && exit 1
73 test -f main.info
74 test ! -e main.info-1
75 test -f sub/main.info
76 test -f sub/main.info-1
77
78 :