automake: recognize all-numeric MAJ.MIN.MICROa.ALPHA versions better.
[automake.git] / t / txinfo-include.sh
blobdbcd01d267dcaebbeff2ebd815c4b54f8a5e15de
1 #! /bin/sh
2 # Copyright (C) 2012-2024 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 # We avoid apostrophes in the test document since Texinfo
32 # turns them into UTF-8, which is not easy to grep.
34 cat > main.texi << 'END'
35 \input texinfo
36 @setfilename main.info
37 @settitle main
38 @ifnottex
39 @node Top
40 @top GNU dummy.
41 @menu
42 * one:: Chapter one
43 * two:: Chapter two
44 * three:: Chapter three
45 @end menu
46 @end ifnottex
47 @include one.texi
48 @include two.texi
49 @include three.texi
50 @bye
51 END
53 cat > one.texi << 'END'
54 @node one
55 @chapter Chapter one
56 Foo bar, baz.
57 END
59 cat > two.texi << 'END'
60 @node two
61 @chapter Chapter two
62 Blah Blah Blah.
63 END
65 cat > three.texi << 'END'
66 @node three
67 @chapter Chapter three
68 Quux quux quux.
69 END
71 mkdir sub
73 cat > sub/more.texi << 'END'
74 \input texinfo
75 @setfilename more.info
76 @settitle main
77 @ifnottex
78 @node Top
79 @top GNU more.
80 @menu
81 * desc:: Description of this program
82 * hist:: History of this program
83 @end menu
84 @end ifnottex
85 @include desc.texi
86 @include hist.texi
87 @bye
88 END
90 cat > sub/desc.texi << 'END'
91 @node desc
92 @chapter Description of this program
93 It does something, really.
94 END
96 cat > sub/hist.texi << 'END'
97 @node hist
98 @chapter History of this program
99 It was written somehow.
102 cat > exp << 'END'
103 ./main.info
104 ./sub/more.info
107 check_info_contents ()
109 srcdir=${1-.}
110 $FGREP "Foo bar, baz." $srcdir/main.info
111 $FGREP "Blah Blah Blah." $srcdir/main.info
112 $FGREP "Quux quux quux." $srcdir/main.info
113 $FGREP 'It does something, really.' $srcdir/sub/more.info
114 $FGREP 'It was written somehow.' $srcdir/sub/more.info
117 get_info_names ()
119 find ${1-.} -type f -name '*.info' | LC_ALL=C sort > got
122 check_expected ()
124 cat exp
125 cat got
126 diff exp got
129 $ACLOCAL
130 $AUTOMAKE --add-missing
131 $AUTOCONF
133 ./configure
135 $MAKE info
136 get_info_names
137 check_expected
139 check_info_contents
141 $MAKE dvi
142 test -f main.dvi
143 test -f sub/more.dvi
145 $MAKE maintainer-clean
146 test ! -f main.dvi
147 test ! -f sub/more.dvi
148 test ! -f main.info
149 test ! -f sub/more.info
151 mkdir build
152 cd build
153 ../configure
154 $MAKE all dvi
156 get_info_names ..
157 sed 's|^\./|../|' ../exp > exp
158 check_expected
160 test -f main.dvi
161 test -f sub/more.dvi
163 check_info_contents ..
165 $MAKE distcheck