tests: avoid spurious failures in Linux -> MinGW cross-compilation mode
[platform/upstream/automake.git] / t / txinfo-include.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 # Texinfo input files using @include directives.  Check both in-tree
18 # and VPATH builds, and both top-level and subdir input.
19
20 required='makeinfo tex texi2dvi'
21 . test-init.sh
22
23 echo AC_OUTPUT >> configure.ac
24
25 cat > Makefile.am << 'END'
26 info_TEXINFOS = main.texi sub/more.texi
27 main_TEXINFOS = one.texi two.texi three.texi
28 sub_more_TEXINFOS = sub/desc.texi sub/hist.texi
29 END
30
31 cat > main.texi << 'END'
32 \input texinfo
33 @setfilename main.info
34 @settitle main
35 @ifnottex
36 @node Top
37 @top GNU dummy.
38 @menu
39 * one::   Chapter one
40 * two::   Chapter two
41 * three:: Chapter three
42 @end menu
43 @end ifnottex
44 @include one.texi
45 @include two.texi
46 @include three.texi
47 @bye
48 END
49
50 cat > one.texi << 'END'
51 @node one
52 @chapter Chapter one
53 Foo bar, baz.
54 END
55
56 cat > two.texi << 'END'
57 @node two
58 @chapter Chapter two
59 Blah Blah Blah.
60 END
61
62 cat > three.texi << 'END'
63 @node three
64 @chapter Chapter two
65 GNU's Not Unix.
66 END
67
68 mkdir sub
69
70 cat > sub/more.texi << 'END'
71 \input texinfo
72 @setfilename more.info
73 @settitle main
74 @ifnottex
75 @node Top
76 @top GNU more.
77 @menu
78 * desc:: Description of this program
79 * hist:: History of this program
80 @end menu
81 @end ifnottex
82 @include desc.texi
83 @include hist.texi
84 @bye
85 END
86
87 cat > sub/desc.texi << 'END'
88 @node desc
89 @chapter Description of this program
90 It does something, really.
91 END
92
93 cat > sub/hist.texi << 'END'
94 @node hist
95 @chapter History of this program
96 It was written somehow.
97 END
98
99 cat > exp << 'END'
100 ./main.info
101 ./sub/more.info
102 END
103
104 check_info_contents ()
105 {
106   srcdir=${1-.}
107   $FGREP "Foo bar, baz."                        $srcdir/main.info
108   $FGREP "Blah Blah Blah."                      $srcdir/main.info
109   $FGREP "GNU's Not Unix."                      $srcdir/main.info
110   $FGREP 'It does something, really.'           $srcdir/sub/more.info
111   $FGREP 'It was written somehow.'              $srcdir/sub/more.info
112 }
113
114 get_info_names ()
115 {
116   find ${1-.} -type f -name '*.info' | LC_ALL=C sort > got
117 }
118
119 check_expected ()
120 {
121   cat exp
122   cat got
123   diff exp got
124 }
125
126 $ACLOCAL
127 $AUTOMAKE --add-missing
128 $AUTOCONF
129
130 ./configure
131
132 $MAKE info
133 get_info_names
134 check_expected
135
136 check_info_contents
137
138 $MAKE dvi
139 test -f main.dvi
140 test -f sub/more.dvi
141
142 $MAKE maintainer-clean
143 test ! -f main.dvi
144 test ! -f sub/more.dvi
145 test ! -f main.info
146 test ! -f sub/more.info
147
148 mkdir build
149 cd build
150 ../configure
151 $MAKE all dvi
152
153 get_info_names ..
154 sed 's|^\./|../|' ../exp > exp
155 check_expected
156
157 test -f main.dvi
158 test -f sub/more.dvi
159
160 check_info_contents ..
161
162 $MAKE distcheck
163
164 :