tests: make 'lzip.test' executable
[automake.git] / tests / vtexi4.test
blob3c8ab41030b41435d0702e18f8bdfb54504deb50
1 #! /bin/sh
2 # Copyright (C) 2011 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 <http://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 `vtexi3.test', which does similar checks, but
21 # for more vers*.texi files, and does not require makeinfo, tex and
22 # texi2dvi.
24 required='makeinfo tex texi2dvi-o'
25 . ./defs || Exit 1
27 set -e
29 case `LC_ALL=C date '+%u'` in
30 [1-7]) date_is_posix=:;;
31 *) date_is_posx=false;;
32 esac
33 $date_is_posix \
34 && day=`LC_ALL=C date '+%d'` && test -n "$day" \
35 && month=`LC_ALL=C date '+%B'` && test -n "$month" \
36 && year=`LC_ALL=C date '+%Y'`&& test -n "$year" \
37 || { echo "$me: 'date' is not POSIX-compliant enough"; Exit 77; }
38 day=`echo "$day" | sed 's/^0//'`
40 # This test requires a grep program that can work on non-text input.
41 (echo '\ex\a' | grep x) || {
42 echo "$me: grep doesn't work on input that is not pure text" >&2
43 Exit 77
46 cat > configure.in << END
47 AC_INIT([$me], [123.456])
48 AM_INIT_AUTOMAKE
49 AC_CONFIG_FILES([Makefile])
50 AC_OUTPUT
51 END
53 cat > defs.am <<END
54 my_date_rx = $day $month $year
55 my_month_rx = $month $year
56 my_version_rx = 123\.456
57 END
59 cat > Makefile.am << 'END'
60 include defs.am
61 info_TEXINFOS = foo.texi
62 test-grepinfo:
63 ## Not useless uses of cat: we only tested that grep worked on
64 ## non-text input when that's given from a pipe.
65 cat $(srcdir)/foo.info | grep 'GREPVERSION=$(my_version_rx)='
66 cat $(srcdir)/foo.info | grep 'GREPEDITION=$(my_version_rx)='
67 cat $(srcdir)/foo.info | grep 'GREPDATE=$(my_date_rx)='
68 cat $(srcdir)/foo.info | grep 'GREPMONTH=$(my_month_rx)='
69 test-distfiles:
70 @echo DISTFILES = $(DISTFILES)
71 echo ' ' $(DISTFILES) ' ' | grep '[ /]version.texi '
72 test-distdir: distdir
73 ls -l $(distdir)
74 diff $(srcdir)/version.texi $(distdir)/version.texi
75 .PHONY: test-grepinfo test-distfiles test-distdir
76 check-local: test-grepinfo test-distfiles test-distdir
77 END
79 cat > foo.texi << 'END'
80 \input texinfo
81 @c %**start of header
82 @setfilename foo.info
83 @settitle Zardoz
84 @c %**end of header
86 @node Top
87 @include version.texi
89 GREPVERSION=@value{VERSION}=
91 GREPEDITION=@value{EDITION}=
93 GREPDATE=@value{UPDATED}=
95 GREPMONTH=@value{UPDATED-MONTH}=
97 @bye
98 END
100 $ACLOCAL
101 $AUTOCONF
102 $AUTOMAKE -a
104 ./configure
105 $MAKE all dvi
107 # debugging & sanity checks
108 ls -l
109 cat version.texi
110 cat foo.info
111 test -f foo.dvi
113 $MAKE test-grepinfo
114 $MAKE test-distfiles
115 $MAKE test-distdir
116 $MAKE distcheck