Merge branch 'minor'
[automake.git] / t / txinfo-include.sh
blobeef4f927a95bdb6cd60c4b20f74910500cabeb05
1 #! /bin/sh
2 # Copyright (C) 2012-2017 Free Software Foundation, Inc.
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.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Texinfo input files using @include directives. Check both in-tree
18 # and VPATH builds, and both top-level and subdir input.
20 required='makeinfo tex texi2dvi'
21 . test-init.sh
23 echo AC_OUTPUT >> configure.ac
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
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
50 cat > one.texi << 'END'
51 @node one
52 @chapter Chapter one
53 Foo bar, baz.
54 END
56 cat > two.texi << 'END'
57 @node two
58 @chapter Chapter two
59 Blah Blah Blah.
60 END
62 cat > three.texi << 'END'
63 @node three
64 @chapter Chapter two
65 GNU's Not Unix.
66 END
68 mkdir sub
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
87 cat > sub/desc.texi << 'END'
88 @node desc
89 @chapter Description of this program
90 It does something, really.
91 END
93 cat > sub/hist.texi << 'END'
94 @node hist
95 @chapter History of this program
96 It was written somehow.
97 END
99 cat > exp << 'END'
100 ./main.info
101 ./sub/more.info
104 check_info_contents ()
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
114 get_info_names ()
116 find ${1-.} -type f -name '*.info' | LC_ALL=C sort > got
119 check_expected ()
121 cat exp
122 cat got
123 diff exp got
126 $ACLOCAL
127 $AUTOMAKE --add-missing
128 $AUTOCONF
130 ./configure
132 $MAKE info
133 get_info_names
134 check_expected
136 check_info_contents
138 $MAKE dvi
139 test -f main.dvi
140 test -f sub/more.dvi
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
148 mkdir build
149 cd build
150 ../configure
151 $MAKE all dvi
153 get_info_names ..
154 sed 's|^\./|../|' ../exp > exp
155 check_expected
157 test -f main.dvi
158 test -f sub/more.dvi
160 check_info_contents ..
162 $MAKE distcheck