maint: Update HACKING
[automake.git] / t / txinfo-vtexi4.sh
blob8f9eab4147b08a8d85041e2eda00f6420c27f1e4
1 #! /bin/sh
2 # Copyright (C) 2011-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 # Check that the version.texi file is automatically created and distributed
18 # if @included into a texi source. Also check that is correctly defined
19 # @values definitions it is advertised to.
20 # See also the related test 'txinfo-vtexi4.sh', which does similar checks,
21 # but for more vers*.texi files, and does not require makeinfo, tex and
22 # texi2dvi.
24 required='makeinfo tex texi2dvi grep-nonprint'
25 . test-init.sh
27 test $(LC_ALL=C date '+%u') -gt 0 && test $(LC_ALL=C date '+%u') -lt 8 \
28 && day=$(LC_ALL=C date '+%d') && test -n "$day" \
29 && month=$(LC_ALL=C date '+%B') && test -n "$month" \
30 && year=$(LC_ALL=C date '+%Y') && test -n "$year" \
31 || skip_ "'date' is not POSIX-compliant enough"
32 day=$(echo "$day" | sed 's/^0//')
34 cat > configure.ac << END
35 AC_INIT([$me], [123.456])
36 AM_INIT_AUTOMAKE
37 AC_CONFIG_FILES([Makefile])
38 AC_OUTPUT
39 END
41 cat > defs.am <<END
42 my_date_rx = $day $month $year
43 my_month_rx = $month $year
44 my_version_rx = 123\.456
45 END
47 cat > Makefile.am << 'END'
48 include defs.am
49 info_TEXINFOS = foo.texi
50 test-grepinfo:
51 ## Not useless uses of cat: we only tested that grep works on
52 ## non-text input when that's given from a pipe.
53 cat $(srcdir)/foo.info | grep 'GREPVERSION=$(my_version_rx)='
54 cat $(srcdir)/foo.info | grep 'GREPEDITION=$(my_version_rx)='
55 cat $(srcdir)/foo.info | grep 'GREPDATE=$(my_date_rx)='
56 cat $(srcdir)/foo.info | grep 'GREPMONTH=$(my_month_rx)='
57 test-distfiles:
58 @echo DISTFILES = $(DISTFILES)
59 echo ' ' $(DISTFILES) ' ' | grep '[ /]version.texi '
60 test-distdir: distdir
61 ls -l $(distdir)
62 diff $(srcdir)/version.texi $(distdir)/version.texi
63 .PHONY: test-grepinfo test-distfiles test-distdir
64 check-local: test-grepinfo test-distfiles test-distdir
65 END
67 cat > foo.texi << 'END'
68 \input texinfo
69 @c %**start of header
70 @setfilename foo.info
71 @settitle Zardoz
72 @c %**end of header
74 @node Top
75 @include version.texi
77 GREPVERSION=@value{VERSION}=
79 GREPEDITION=@value{EDITION}=
81 GREPDATE=@value{UPDATED}=
83 GREPMONTH=@value{UPDATED-MONTH}=
85 @bye
86 END
88 $ACLOCAL
89 $AUTOCONF
90 $AUTOMAKE -a
92 ./configure
93 $MAKE all dvi
95 # Debugging & sanity checks.
96 ls -l
97 cat version.texi
98 cat foo.info
99 test -f foo.dvi
101 $MAKE test-grepinfo
102 $MAKE test-distfiles
103 $MAKE test-distdir
104 $MAKE distcheck