automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] {maint} Improve, extend and tweak tests on Texinfo support.


From: Stefano Lattarini
Subject: Re: [PATCH] {maint} Improve, extend and tweak tests on Texinfo support.
Date: Tue, 4 Jan 2011 15:41:45 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Monday 03 January 2011, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Mon, Jan 03, 2011 at 02:38:48PM CET:
> > Subject: [PATCH] Improve, extend and tweak tests on Texinfo support.
> > 
> > * tests/instdir-texi.test: Add a call to `ls -l' after that to
> > `make', for debugging.  When looking for required tools, do not
> > redirect the output of "$tool --help" to /dev/null, and do not
> > uselessly run it in a subshell.
> > * tests/txinfo.test: Rewritten to run autoconf, ./configure and
> > make.  All checks moved into Makefile.am.
> > * tests/txinfo8.test: Likewise, and modernize the generated
> > configure.in.
> > * tests/txinfo2.test: Moved checks into Makefile.am, and other
> > minor improvements.
> > * tests/txinfo5.test: Enable `errexit' shell flag, and related
> > changes.  Add trailing `:' command.
> > * tests/txinfo6.test: Likewise, and make grepping of generated
> > Makefile.in stricter.
> > * tests/txinfo7.test: Enable `errexit' shell flag, and related
> > changes.  Add trailing `:' command.  Do not add unnecessary stuff
> > to Makefile.am.
> > * tests/txinfo9.test: Verify that more targets which are expected
> > to be generated only once really are.  Make grepping less strict,
> > to avoid exposing too much internal details.  More minor changes.
> > * tests/txinfo16.test: Add trailing `:'.  Prefer cat over echo
> > for appending to configure.in.  Updated/fixed heading comments.
> > * tests/txinfo23.test: Likewise, and extended a little by making
> > it check that no info file is created in the $(srcdir).
> > * tests/txinfo24.test: Likewise.
> > * tests/txinfo25.test: Likewise.
> > * tests/txinfo18.test: Add trailing `:'.  Prefer cat over echo
> > for appending to configure.in.  Also, check that index files are
> > cleaned also by "make clean", not only by "make distclean".
> > * tests/txinfo22.test: Prefer `$me' over hard-coded test name,
> > and added trailing `:' command.  This testcase also used to check
> > that automake ignores in-line comments when using variables, but
> > preserves them in the output; these checks (added in commit
> > "Release-1-7f-4-g9177ef8") do not really pertain to this test,
> > so they have been moved ...
> > * tests/comments-in-var-definition.test: ... into this new test.
> > * tests/txinfo4.test: Escape literal dots in grep regexps.  Add
> > trailing `:' command.
> > * tests/txinfo29.test: Likewise.  Relax grepping of generated
> > Makefile.in w.r.t. whitespaces.  Prefer `cat' over `echo' to
> > append to configure.in.
> > * tests/txinfo3.test: Likewise.
> > * tests/vtexi.test: Improve grepping of Makefile.in (sometimes
> > make it stricter, sometimes laxer).  Move `set -e' setting just
> > after the inclusion of ./defs.  De-uglify a sed command.  Other
> > minor cosmetic improvements.
> > * tests/vtexi2.test: Make grepping of Makefile.in stricter.  Add
> > trailing `:' command.
> > * tests/vtexi3.test: New test on version.texi support.
> > * tests/vtexi4.test: Likewise.
> > * tests/Makefile.am (TESTS): Updated.
> 
> OK with nits addressed.
>
I have a couple of questions below; I'll wait to push until they've
been addressed.

> > --- /dev/null
> > +++ b/tests/comments-in-var-definition.test
> 
> How about s/definition/defn/?  That is still unique, easily understood,
> and a lot shorter.
>
Fine with me (even if I still don't understand this bias against longer
test names ;-)

> > @@ -0,0 +1,47 @@
> 
> > +# Make sure Automake ignores in-line comments when using variables,
> > +# but preserve them in the output.
> 
> preserves
>
Oops.  Fixed.

> > +
> > +. ./defs || Exit 1
> > +
> > +set -e
> > +
> > +# Use a slash in the comment, because automake takes the dirname
> > +# of TEXINFO_TEX to compute $(am__TEXINFO_TEX_DIR).
> > +cat > Makefile.am << 'END'
> > +TEXINFO_TEX = tex/texinfo.tex    # some comment w/ a slash
> > +info_TEXINFOS = main.texi
> > +END
> > +
> > +cat > main.texi << 'END'
> > +\input texinfo
> > address@hidden main.info
> > +END
> > +
> > +mkdir tex
> > +: > tex/texinfo.tex
> > +
> > +$ACLOCAL
> > +$AUTOMAKE
> > +
> > +grep TEX Makefile.in # for debugging
> > +grep '^TEXINFO_TEX *= *tex/texinfo\.tex  *# some comment w/ a slash *$' 
> > Makefile.in
> > +grep '^am__TEXINFO_TEX_DIR *=.*[/ ]tex *$' Makefile.in
> > +$EGREP 'am__TEXINFO_TEX_DIR.*=.*(comment|#)' Makefile.in && Exit 1
> 
> These two lines access internal details that could change.  Acceptable
> if it must be that way but better if we can do without.
>
I added those lines to avoid reducing coverage in the code I moved
from `txinfo22.test' -- which indeed had a check:
  test -d "$(am__TEXINFO_TEX_DIR)"
in its Makefile.am.

Hhmm... but maybe it would be simpler & safer to just add back that check
(and new similar ones) in the Makefile.am of `comments-in-var-defn.test'? 
I think so; here is what I'll squash in if there are no objections:

-*-*-

diff --git a/tests/comments-in-var-defn.test b/tests/comments-in-var-defn.test
index 6d6a3e3..b00ee6b 100755
--- a/tests/comments-in-var-defn.test
+++ b/tests/comments-in-var-defn.test
@@ -21,11 +21,20 @@
 
 set -e
 
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
 # Use a slash in the comment, because automake takes the dirname
 # of TEXINFO_TEX to compute $(am__TEXINFO_TEX_DIR).
 cat > Makefile.am << 'END'
 TEXINFO_TEX = tex/texinfo.tex    # some comment w/ a slash
 info_TEXINFOS = main.texi
+.PHONY: test
+test:
+       test tex/texinfo.tex = $(TEXINFO_TEX)
+       test -d '$(am__TEXINFO_TEX_DIR)'
+       case '$(am__TEXINFO_TEX_DIR)' in tex|./tex) :;; *) exit 1;; esac
 END
 
 cat > main.texi << 'END'
@@ -41,7 +50,9 @@ $AUTOMAKE
 
 grep TEX Makefile.in # for debugging
 grep '^TEXINFO_TEX *= *tex/texinfo\.tex  *# some comment w/ a slash *$' 
Makefile.in
-grep '^am__TEXINFO_TEX_DIR *=.*[/ ]tex *$' Makefile.in
-$EGREP 'am__TEXINFO_TEX_DIR.*=.*(comment|#)' Makefile.in && Exit 1
+
+$AUTOCONF
+./configure
+$MAKE test
 
:

-*-*-

> > --- /dev/null
> > +++ b/tests/vtexi3.test
> 
> > +# Check that vers*.texi files are automatically created and distributed
> > +# if @included into a texi source.  Also check that they correctly contain
> > +# the @values definitions they are advertised to.
> > +# See also the related test `vtexi4.test', which does similar checks, but
> > +# for version.texi only, and requires makeinfo, tex and texi2dvi.
> 
> > +day='([1-9]|1[0-9]|2[0-9]|3[01])'
> > +month='(January|February|March|April|May|June|July|August|September|October|November|December)'
> > +year='20[0-9][0-9]' # hopefully automake will be obsolete in 80 years ;-)
> 
> I do not agree with the tone of the comment, and as punishment will
> require that the code also works later than the mentioned date.
> ;->
> 
Eh eh :-)  (because that's a joke, right?)

> Also, your comment writing style seems to be degrading away from writing
> whole sentences (including leading capitalization and final period)
> again here and below.
>
Yes, I tend to do so for short comments, especially in tests.  If you
would prefer to set a policy mandating that comments are always to be
capitalized correctly and to consist of whole sentences, please just
do so (ideally stating that in HACKING and tests/README ;-) and I'll
follow the new policy as consistently as I can (while I like writing
"casual-style comments" sometimes, I have no strong feeling on the
matter).

For the moment, I've amended the comments in this test for proper
capitalization, punctuation and grammar (see the attached squash-in).

> > +date="$day $month $year"
> > +
> > +do_check ()
> > +{
> > +  # basename of the vers*.texi file
> > +  vfile=$1
> > +  # $(srcdir) of the current build
> > +  srcdir=$2
> > +  # vers*.texi must be created in $(srcdir)
> > +  $MAKE $srcdir/$vfile.texi
> > +  cat $srcdir/$vfile.texi
> > +  # EDITION and VERSION are synonyms, as per documentation
> > +  grep "address@hidden EDITION 7\\.45\\.3a$" $srcdir/$vfile.texi
> > +  grep "address@hidden VERSION 7\\.45\\.3a$" $srcdir/$vfile.texi
> > +  # check that UPDATED seems right, and that UPDATED and UPDATED-MONTH
> > +  # are consistent
> > +  $EGREP "address@hidden UPDATED $date$" $srcdir/$vfile.texi
> > +  vmonth=`grep 'address@hidden UPDATED ' $srcdir/$vfile.texi | awk '{print 
> > $4, $5}'`
> > +  grep "address@hidden UPDATED-MONTH $vmonth$" $srcdir/$vfile.texi
> > +  # check that the vers*.texi file is distributed according
> > +  # to $(DISTFILES)
> > +  $MAKE echo-distfiles # for debugging
> > +  $MAKE -s echo-distfiles | grep "[ /]$vfile\\.texi"
> > +}
> > +
> > +mkdir build
> > +cd build
> > +../configure
> > +
> > +do_check version ..
> > +do_check version-quux ..
> > +do_check vers1a_2b ..
> > +
> > +# The various $(srcdir)/*.info are required for the distribution
> > +# and they must be newer than version.texi, so that make won't try
> > +# to rebuild them.
> > +$sleep
> > +: > ../foobar.info
> > +: > ../quux.info
> > +: > ../zardoz.info
> 
> These commands are not guaranteed to portably update the time stamp of
> the files in question on old systems.
>
:-O

> Hmm, the autoconf.texi blurb on `touch' states that this is no longer
> a practical issue, but IIRC the policy was still enforced in GCC
> sources, making me wonder whether there still are broken systems out
> there ...
> 
> Anyway, you can easily avoid the issue by
>   echo stamp > ...
>
I'd prefer to use `touch' if that's ok with you, since it makes the
purpose of the commands even clearer (and is used in other parts of
the automake testsuite).  Objections?

> > +# check that the vers*.texi files are really distributed.
> > +$MAKE distdir
> > +ls -l $distdir
> > +diff ../version.texi $distdir/version.texi
> > +diff ../version-quux.texi $distdir/version-quux.texi
> > +diff ../version.texi $distdir/vers1a_2b.texi
> > +
> > +:

> > diff --git a/tests/vtexi4.test b/tests/vtexi4.test
> > new file mode 100755
> > index 0000000..1e5e3b0
> > --- /dev/null
> > +++ b/tests/vtexi4.test
> > @@ -0,0 +1,115 @@
> 
> > +# Check that the version.texi file is automatically created and distributed
> > +# if @included into a texi source.  Also check that is correctly defined
> > +# @values definitions it is advertised to.
> > +# See also the related test `vtexi3.test', which does similar checks, but
> > +# for more vers*.texi files, and does not require makeinfo, tex and
> > +# texi2dvi.
> > +
> > +required='makeinfo tex texi2dvi-o'
> > +. ./defs || Exit 1
> > +
> > +set -e
> > +
> > +day=`LC_ALL=C date '+%d'`   || Exit 77
> > +month=`LC_ALL=C date '+%B'` || Exit 77
> > +year=`LC_ALL=C date '+%Y'`  || Exit 77
> 
> Not all shells propagate exit status from commands substitutions in
> assignments (see autoconf.texi Assignments).
Hmpf :-(

Luckily this issue seems of little pratical concern at least: listed
affected shells are just ash 0.2 (!) and QNX 4.25 shell.

> You might want to test for nonempty variable contents here.
>
In fact, to be even more reliable in case of broken/non-POSIX `date'
commands, this is what I'd like to squash in if there are no
objections:

-*-*-

 set -e
 
-day=`LC_ALL=C date '+%d'`   || Exit 77
-month=`LC_ALL=C date '+%B'` || Exit 77
-year=`LC_ALL=C date '+%Y'`  || Exit 77
-
+case `LC_ALL=C date '+%u'` in
+  [1-7]) date_is_posix=:;;
+      *) date_is_posx=false;;
+esac
+$date_is_posix \
+  && day=`LC_ALL=C date '+%d'` && test -n "$day" \
+  && month=`LC_ALL=C date '+%B'` && test -n "$month" \
+  && year=`LC_ALL=C date '+%Y'`&& test -n "$year" \
+  || { echo "$me: 'date' is not POSIX-complaint enough"; Exit 77; }
 day=`echo "$day" | sed 's/^0//'`
 
-*-*-

OK?

> > +day=`echo "$day" | sed 's/^0//'`
> > +
> > +# This test requires a grep the can parse nonprinting characters.
> 
> s/the/that/
>
Oops.  Fixed.

> > +# BSD 'grep' works from a pipe, but not a seekable file.
> > +# GNU or BSD 'grep -a' works on files, but is not portable.
> > +tst=''
> > +case `echo "$tst" | grep .` in
> > +  "$tst") ;;
> > +  *) echo "$me: grep can't parse nonprinting characters" >&2; Exit 77;;
> > +esac
> 
> This kind of test occurs several times in the test suite.  How about a
> $required entry grep-nonprinting to factor the code?  Did you ensure
> that BSD grep skips with the $tst value?
>
No, because I have no access to BSD grep ATM.

Also, BSD grep should *not* skip with the $tst value: that's the reason
we have the apparently useless uses of cat in Makefile.am -- BSD grep
can match nonprinting characters when reading from a pipe (but not when
reading from a seekable file).

Also, thinking over it again, this test doesn't *really* require a grep
that can parse nonprinting characters!  It just requires a grep that can
work on input that is not pure text.  So, what about the following
squash-in?

-*-*-

-# This test requires a grep the can parse nonprinting characters.
-# BSD 'grep' works from a pipe, but not a seekable file.
-# GNU or BSD 'grep -a' works on files, but is not portable.
-tst='^['
-case `echo "$tst" | grep .` in
-  "$tst") ;;
-  *) echo "$me: grep can't parse nonprinting characters" >&2; Exit 77;;
-esac
+# This test requires a grep program that can work on non-text input.
+(echo '^[x^G' | grep x) || {
+  echo "$me: grep doesn't work on input that is not pure text" >&2
+  Exit 77
+}
 
 cat > configure.in << END
 AC_INIT([$me], [123.456])
@@ -58,7 +61,8 @@ cat > Makefile.am << 'END'
 include defs.am
 info_TEXINFOS = foo.texi
 test-grepinfo:
-## Not useless uses of cat; see above comments about grep.
+## Not useless uses of cat: we only tested that grep worked on
+## non-text input when that's given from a pipe.
        cat $(srcdir)/foo.info | grep 'GREPVERSION=$(my_version_rx)='
        cat $(srcdir)/foo.info | grep 'GREPEDITION=$(my_version_rx)='
        cat $(srcdir)/foo.info | grep 'GREPDATE=$(my_date_rx)='

-*-*-

(BTW, sorry for the noise about this).

> Thanks,
> Ralf
> 

Attached are the squashed-in diffs and the amended patch.
I'll wait for an ACK before pushing.

Thanks,
   Stefano

Attachment: squashed-in.diff
Description: Text Data

From 7af9fded42c9f85a1f9cc70b481a5841e12dea20 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 24 Dec 2010 02:56:35 +0100
Subject: [PATCH] Improve, extend and tweak tests on Texinfo support.

* tests/instdir-texi.test: Add a call to `ls -l' after that to
`make', for debugging.  When looking for required tools, do not
redirect the output of "$tool --help" to /dev/null, and do not
uselessly run it in a subshell.
* tests/txinfo.test: Rewritten to run autoconf, ./configure and
make.  All checks moved into Makefile.am.
* tests/txinfo8.test: Likewise, and modernize the generated
configure.in.
* tests/txinfo2.test: Moved checks into Makefile.am, and other
minor improvements.
* tests/txinfo5.test: Enable `errexit' shell flag, and related
changes.  Add trailing `:' command.
* tests/txinfo6.test: Likewise, and make grepping of generated
Makefile.in stricter.
* tests/txinfo7.test: Enable `errexit' shell flag, and related
changes.  Add trailing `:' command.  Do not add unnecessary stuff
to Makefile.am.
* tests/txinfo9.test: Verify that more targets which are expected
to be generated only once really are.  Make grepping less strict,
to avoid exposing too much internal details.  More minor changes.
* tests/txinfo16.test: Add trailing `:'.  Prefer cat over echo
for appending to configure.in.  Updated/fixed heading comments.
* tests/txinfo23.test: Likewise, and extended a little by making
it check that no info file is created in the $(srcdir).
* tests/txinfo24.test: Likewise.
* tests/txinfo25.test: Likewise.
* tests/txinfo18.test: Add trailing `:'.  Prefer cat over echo
for appending to configure.in.  Also, check that index files are
cleaned also by "make clean", not only by "make distclean".
* tests/txinfo22.test: Prefer `$me' over hard-coded test name,
and added trailing `:' command.  This testcase also used to check
that automake ignores in-line comments when using variables, but
preserves them in the output; these checks (added in commit
"Release-1-7f-4-g9177ef8") do not really pertain to this test,
so they have been moved ...
* tests/comments-in-var-defn.test: ... into this new test.
* tests/txinfo4.test: Escape literal dots in grep regexps.  Add
trailing `:' command.
* tests/txinfo29.test: Likewise.  Relax grepping of generated
Makefile.in w.r.t. whitespaces.  Prefer `cat' over `echo' to
append to configure.in.
* tests/txinfo3.test: Likewise.
* tests/vtexi.test: Improve grepping of Makefile.in (sometimes
make it stricter, sometimes laxer).  Move `set -e' setting just
after the inclusion of ./defs.  De-uglify a sed command.  Other
minor cosmetic improvements.
* tests/vtexi2.test: Make grepping of Makefile.in stricter.  Add
trailing `:' command.
* tests/vtexi3.test: New test on version.texi support.
* tests/vtexi4.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog                       |   55 +++++++++++++++++
 tests/Makefile.am               |    3 +
 tests/Makefile.in               |    3 +
 tests/comments-in-var-defn.test |   58 ++++++++++++++++++
 tests/instdir-texi.test         |    9 ++-
 tests/txinfo.test               |   31 +++++++---
 tests/txinfo16.test             |   11 +++-
 tests/txinfo18.test             |   16 +++++-
 tests/txinfo2.test              |   22 ++++---
 tests/txinfo22.test             |   19 +++---
 tests/txinfo23.test             |   14 +++-
 tests/txinfo24.test             |   10 +++-
 tests/txinfo25.test             |   15 ++++-
 tests/txinfo29.test             |   17 +++--
 tests/txinfo3.test              |   14 +++--
 tests/txinfo4.test              |    7 ++-
 tests/txinfo5.test              |   10 +++-
 tests/txinfo6.test              |   13 +++-
 tests/txinfo7.test              |   12 ++--
 tests/txinfo8.test              |   42 ++++++++------
 tests/txinfo9.test              |   22 +++++--
 tests/vtexi.test                |   34 +++++-----
 tests/vtexi2.test               |    6 +-
 tests/vtexi3.test               |  124 +++++++++++++++++++++++++++++++++++++++
 tests/vtexi4.test               |  118 +++++++++++++++++++++++++++++++++++++
 25 files changed, 569 insertions(+), 116 deletions(-)
 create mode 100755 tests/comments-in-var-defn.test
 create mode 100755 tests/vtexi3.test
 create mode 100755 tests/vtexi4.test

diff --git a/ChangeLog b/ChangeLog
index bf44677..366e58f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2011-01-03  Stefano Lattarini  <address@hidden>
+
+       Improve, extend and tweak tests on Texinfo support.
+       * tests/instdir-texi.test: Add a call to `ls -l' after that to
+       `make', for debugging.  When looking for required tools, do not
+       redirect the output of "$tool --help" to /dev/null, and do not
+       uselessly run it in a subshell.
+       * tests/txinfo.test: Rewritten to run autoconf, ./configure and
+       make.  All checks moved into Makefile.am.
+       * tests/txinfo8.test: Likewise, and modernize the generated
+       configure.in.
+       * tests/txinfo2.test: Moved checks into Makefile.am, and other
+       minor improvements.
+       * tests/txinfo5.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.
+       * tests/txinfo6.test: Likewise, and make grepping of generated
+       Makefile.in stricter.
+       * tests/txinfo7.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Do not add unnecessary stuff
+       to Makefile.am.
+       * tests/txinfo9.test: Verify that more targets which are expected
+       to be generated only once really are.  Make grepping less strict,
+       to avoid exposing too much internal details.  More minor changes.
+       * tests/txinfo16.test: Add trailing `:'.  Prefer cat over echo
+       for appending to configure.in.  Updated/fixed heading comments.
+       * tests/txinfo23.test: Likewise, and extended a little by making
+       it check that no info file is created in the $(srcdir).
+       * tests/txinfo24.test: Likewise.
+       * tests/txinfo25.test: Likewise.
+       * tests/txinfo18.test: Add trailing `:'.  Prefer cat over echo
+       for appending to configure.in.  Also, check that index files are
+       cleaned also by "make clean", not only by "make distclean".
+       * tests/txinfo22.test: Prefer `$me' over hard-coded test name,
+       and added trailing `:' command.  This testcase also used to check
+       that automake ignores in-line comments when using variables, but
+       preserves them in the output; these checks (added in commit
+       "Release-1-7f-4-g9177ef8") do not really pertain to this test,
+       so they have been moved ...
+       * tests/comments-in-var-defn.test: ... into this new test.
+       * tests/txinfo4.test: Escape literal dots in grep regexps.  Add
+       trailing `:' command.
+       * tests/txinfo29.test: Likewise.  Relax grepping of generated
+       Makefile.in w.r.t. whitespaces.  Prefer `cat' over `echo' to
+       append to configure.in.
+       * tests/txinfo3.test: Likewise.
+       * tests/vtexi.test: Improve grepping of Makefile.in (sometimes
+       make it stricter, sometimes laxer).  Move `set -e' setting just
+       after the inclusion of ./defs.  De-uglify a sed command.  Other
+       minor cosmetic improvements.
+       * tests/vtexi2.test: Make grepping of Makefile.in stricter.  Add
+       trailing `:' command.
+       * tests/vtexi3.test: New test on version.texi support.
+       * tests/vtexi4.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
 2011-01-02   Stefano Lattarini  <address@hidden>
 
        * NEWS: Fix typo (forgotten word).
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8842be3..ceb503b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -158,6 +158,7 @@ comment8.test \
 comment9.test \
 commen10.test \
 commen11.test \
+comments-in-var-defn.test \
 compile.test \
 compile2.test \
 compile_f90_c_cxx.test \
@@ -786,6 +787,8 @@ version8.test \
 vpath.test \
 vtexi.test \
 vtexi2.test \
+vtexi3.test \
+vtexi4.test \
 warnopts.test \
 werror.test \
 werror2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3bc4415..7ecfcaa 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -425,6 +425,7 @@ comment8.test \
 comment9.test \
 commen10.test \
 commen11.test \
+comments-in-var-defn.test \
 compile.test \
 compile2.test \
 compile_f90_c_cxx.test \
@@ -1053,6 +1054,8 @@ version8.test \
 vpath.test \
 vtexi.test \
 vtexi2.test \
+vtexi3.test \
+vtexi4.test \
 warnopts.test \
 werror.test \
 werror2.test \
diff --git a/tests/comments-in-var-defn.test b/tests/comments-in-var-defn.test
new file mode 100755
index 0000000..b00ee6b
--- /dev/null
+++ b/tests/comments-in-var-defn.test
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure Automake ignores in-line comments when using variables,
+# but preserve them in the output.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+# Use a slash in the comment, because automake takes the dirname
+# of TEXINFO_TEX to compute $(am__TEXINFO_TEX_DIR).
+cat > Makefile.am << 'END'
+TEXINFO_TEX = tex/texinfo.tex    # some comment w/ a slash
+info_TEXINFOS = main.texi
+.PHONY: test
+test:
+       test tex/texinfo.tex = $(TEXINFO_TEX)
+       test -d '$(am__TEXINFO_TEX_DIR)'
+       case '$(am__TEXINFO_TEX_DIR)' in tex|./tex) :;; *) exit 1;; esac
+END
+
+cat > main.texi << 'END'
+\input texinfo
address@hidden main.info
+END
+
+mkdir tex
+: > tex/texinfo.tex
+
+$ACLOCAL
+$AUTOMAKE
+
+grep TEX Makefile.in # for debugging
+grep '^TEXINFO_TEX *= *tex/texinfo\.tex  *# some comment w/ a slash *$' 
Makefile.in
+
+$AUTOCONF
+./configure
+$MAKE test
+
+:
diff --git a/tests/instdir-texi.test b/tests/instdir-texi.test
index 50617c8..8210535 100755
--- a/tests/instdir-texi.test
+++ b/tests/instdir-texi.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,9 +20,8 @@
 required='makeinfo-html tex texi2dvi'
 . ./defs || Exit 1
 
-(dvips --help 2>/dev/null >/dev/null) || Exit 77
-(pdfetex --help 2>/dev/null >/dev/null) ||
-  (pdftex --help 2>/dev/null >/dev/null) || Exit 77
+dvips --help || Exit 77
+pdfetex --help || pdftex --help || Exit 77
 
 set -e
 
@@ -54,6 +53,7 @@ mkdir build
 cd build
 ../configure --prefix="$instdir"
 $MAKE all dvi ps pdf html
+ls -l
 
 infodir= htmldir= dvidir= psdir= pdfdir=
 export infodir htmldir dvidir psdir pdfdir
@@ -67,4 +67,5 @@ $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'rm -f' stdout && Exit 1
 $MAKE -e uninstall DESTDIR="$destdir"
+
 :
diff --git a/tests/txinfo.test b/tests/txinfo.test
index 3f1c533..2e94486 100755
--- a/tests/txinfo.test
+++ b/tests/txinfo.test
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2011 Free
+# Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,22 +15,35 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to ensure texinfo.tex included in distribution.  Bug report by
+# Test to ensure texinfo.tex is included in distribution.  Bug report by
 # Jim Meyering.
 
 . ./defs || Exit 1
 
+set -e
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
-magic:
-       @echo $(DISTFILES)
+.PHONY: test1 test2
+test1:
+       @echo DISTFILES = $(DISTFILES)
+       echo ' ' $(DISTFILES) ' ' | grep '[ /]texinfo\.tex '
+test2: distdir
+       ls -l $(distdir)
+       test -f $(distdir)/texinfo.tex
 END
 
 echo '@setfilename textutils.info' > textutils.texi
 : > texinfo.tex
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE test1 test2
 
-$FGREP -v @SET_MAKE@ Makefile.in > Makefile.sed
-$MAKE -s -f Makefile.sed SHELL=$SHELL magic | grep 'texinfo\.tex'
+:
diff --git a/tests/txinfo16.test b/tests/txinfo16.test
index 66ed686..4c14aba 100755
--- a/tests/txinfo16.test
+++ b/tests/txinfo16.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2008, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,14 +14,17 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check that info files are not built in $(srcdir).
+# Check that info files are normally built in $(srcdir),
+# not in $(builddir).
 
 required='makeinfo tex texi2dvi'
 . ./defs || Exit 1
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 info_TEXINFOS = main.texi
@@ -86,3 +89,5 @@ $MAKE dvi
 test -f main.dvi
 
 $MAKE distcheck
+
+:
diff --git a/tests/txinfo18.test b/tests/txinfo18.test
index 4df5257..8dc8961 100755
--- a/tests/txinfo18.test
+++ b/tests/txinfo18.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2008, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2008, 2009, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,7 +23,9 @@ required='makeinfo tex texi2dvi'
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 info_TEXINFOS = main.texi
@@ -62,4 +64,14 @@ $AUTOMAKE --add-missing
 $AUTOCONF
 
 ./configure
+
+$MAKE dvi
+ls -l           # for debugging
+test -f main.sa # sanity check
+$MAKE clean
+ls -l           # for debugging
+test x"`echo main.*`" = x"main.texi"
+
 TAR_OPTIONS= $MAKE distcheck
+
+:
diff --git a/tests/txinfo2.test b/tests/txinfo2.test
index 2324f57..f51d0b6 100755
--- a/tests/txinfo2.test
+++ b/tests/txinfo2.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003, 2011 Free Software
+# Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,24 +22,27 @@
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
-magic:
-       @echo $(DISTFILES)
+.PHONY: test
+test:
+       @echo DISTFILES = $(DISTFILES)
+       case '$(DISTFILES)' in *'~'*) exit 1;; *) exit 0;; esac
 END
 
 : > texinfo.tex
 echo '@setfilename textutils.info' > textutils.texi
 : > textutils.info~
 
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
+
 ./configure
-$MAKE magic >stdout
-cat stdout
-grep '~' stdout && Exit 1
-Exit 0
+$MAKE test
+
+:
diff --git a/tests/txinfo22.test b/tests/txinfo22.test
index 3c2265d..7bf553a 100755
--- a/tests/txinfo22.test
+++ b/tests/txinfo22.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2007, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2007, 2008, 2011 Free Software Foundation,
+# Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,28 +16,24 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure the user can override TEXINFO_TEX.
-# Report from Tom Tromey.
-# Also make sure Automake ignores in-line comments when using variables,
-# but preserve them in the output.
 # Also make sure TEXINFO_TEX is not distributed.
+# Report from Tom Tromey.
 
 required='makeinfo tex texi2dvi'
 . ./defs || Exit 1
 
 set -e
 
-cat > configure.in << 'END'
-AC_INIT([txinfo22], [1.0])
+cat > configure.in << END
+AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([aux1])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 END
 
-# Use a slash in the comment, because automake takes the dirname
-# of TEXINFO_TEX to compute $(am__TEXINFO_TEX_DIR)...
 cat > Makefile.am << 'END'
-TEXINFO_TEX = $(srcdir)/tex/texinfo.tex    # some comment w/ a slash
+TEXINFO_TEX = $(srcdir)/tex/texinfo.tex
 info_TEXINFOS = main.texi
 sure_it_exists:
        test -f $(TEXINFO_TEX)
@@ -67,7 +64,9 @@ test ! -f aux1/texinfo.tex
 test -f tex/texinfo.tex
 
 ./configure
+
 $MAKE sure_it_exists
 $MAKE distcheck
-grep 'TEXINFO_TEX = .* # some comment w/ a slash' Makefile
 $MAKE sure_it_is_not_distributed
+
+:
diff --git a/tests/txinfo23.test b/tests/txinfo23.test
index 903e681..660487d 100755
--- a/tests/txinfo23.test
+++ b/tests/txinfo23.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2007, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,15 +14,19 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check for subdir Texinfo in $(srcdir).
+# Check that info files are built in builddir when needed.
+# Test with subdir Texinfo.
 # (Similar to txinfo13.test, plus DISTCLEANFILES.)
+# (See also txinfo24.test and txinfo25.test)
 
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 DISTCLEANFILES = subdir/*.info*
@@ -50,7 +54,6 @@ cat > subdir/inc.texi << 'END'
 I'm included.
 END
 
-
 $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
@@ -60,3 +63,6 @@ cd build
 ../configure
 $MAKE distcheck
 test -f subdir/main.info
+test ! -f ../subdir/main.info
+
+:
diff --git a/tests/txinfo24.test b/tests/txinfo24.test
index 4c0bc82..fc9f9d1 100755
--- a/tests/txinfo24.test
+++ b/tests/txinfo24.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,13 +16,16 @@
 
 # Check that info files are built in builddir when needed.
 # (Similar to txinfo16.test, plus CLEANFILES.)
+# (See also txinfo23.test and txinfo25.test)
 
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 CLEANFILES = main.info
@@ -47,6 +50,7 @@ mkdir build
 cd build
 ../configure
 $MAKE
+test ! -f ../main.info
 test -f main.info
 
 cd ..
@@ -77,3 +81,5 @@ $MAKE dvi
 test -f main.dvi
 
 $MAKE distcheck
+
+:
diff --git a/tests/txinfo25.test b/tests/txinfo25.test
index 85007f9..f80b035 100755
--- a/tests/txinfo25.test
+++ b/tests/txinfo25.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,15 +14,20 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Similar to texinfo24.test, but with two info files, only one of
-# which being cleaned.
+# Check that info files are built in builddir and in srcdir can safely
+# co-exist.  This setup is obtained by having two info files, only one
+# of which being cleaned.
+# (Similar to txinfo16.test, plus CLEANFILES.)
+# (See also txinfo23.test and txinfo24.test)
 
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 CLEANFILES = [a-m]*.info
@@ -104,3 +109,5 @@ test -f main.dvi
 test -f other.dvi
 
 $MAKE distcheck
+
+:
diff --git a/tests/txinfo29.test b/tests/txinfo29.test
index 1d4aeff..42dd3ab 100755
--- a/tests/txinfo29.test
+++ b/tests/txinfo29.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ echo '@setfilename baz.info' > bar.texi
 
 $ACLOCAL
 AUTOMAKE_fails --add-missing
-grep '^Makefile.am:1:.*user variable.*INFO_DEPS' stderr
+grep '^Makefile\.am:1:.*user variable.*INFO_DEPS' stderr
 grep 'overrides Automake variable.*INFO_DEPS' stderr
 
 $AUTOMAKE -Wno-override
@@ -38,19 +38,20 @@ $AUTOMAKE -Wno-override
 # There is only one definition of INFO_DEPS
 test 1 = `grep '^INFO_DEPS.*=' Makefile.in | wc -l`
 # and it is the right one.
-grep '^INFO_DEPS = foo.info$' Makefile.in
-
+grep '^INFO_DEPS *= *foo.info *$' Makefile.in
 
 # Likewise with AC_SUBST.
 
 cat > Makefile.am << 'END'
 info_TEXINFOS = bar.texi
 END
-echo 'AC_SUBST([INFO_DEPS])' >>configure.in
+cat >> configure.in << 'END'
+AC_SUBST([INFO_DEPS])
+END
 rm -rf autom4te.cache # Make sure autoconf sees the configure.in update.
 AUTOMAKE_fails
 
-grep '^configure.in:4:.*user variable.*INFO_DEPS' stderr
+grep '^configure\.in:4:.*user variable.*INFO_DEPS' stderr
 grep 'overrides Automake variable.*INFO_DEPS' stderr
 
 $AUTOMAKE -Wno-override
@@ -58,4 +59,6 @@ $AUTOMAKE -Wno-override
 # There is only one definition of INFO_DEPS
 test 1 = `grep '^INFO_DEPS.*=' Makefile.in | wc -l`
 # and it is the right one.
-grep '^INFO_DEPS = @address@hidden' Makefile.in
+grep '^INFO_DEPS *= address@hidden@ *$' Makefile.in
+
+:
diff --git a/tests/txinfo3.test b/tests/txinfo3.test
index dcdfcfa..6af712f 100755
--- a/tests/txinfo3.test
+++ b/tests/txinfo3.test
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2001, 2002, 2003, 2008  Free Software Foundation,
-# Inc.
+# Copyright (C) 1997, 2001, 2002, 2003, 2008, 2011 Free Software
+# Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,7 +22,9 @@ required='makeinfo tex texi2dvi'
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
@@ -45,8 +47,10 @@ grep '^INFO_DEPS.*textutils$' Makefile.in
 
 # We should not use single suffix inference rules (with separate
 # dependencies), this confuses Solaris make.
-grep '^.texi:$' Makefile.in && Exit 1
-grep 'textutils: textutils.texi' Makefile.in
+grep '^\.texi:$' Makefile.in && Exit 1
+grep 'textutils: *textutils\.texi' Makefile.in
 
 ./configure
 $MAKE distcheck
+
+:
diff --git a/tests/txinfo4.test b/tests/txinfo4.test
index 1c6a92f..0c55a1c 100755
--- a/tests/txinfo4.test
+++ b/tests/txinfo4.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1997, 2001, 2002, 2003, 2011 Free Software Foundation,
+# Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,4 +30,6 @@ echo '@setfilename textutils.frob' > textutils.texi
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'textutils.texi:1:.*textutils.frob.*extension' stderr
+grep 'textutils\.texi:1:.*textutils\.frob.*extension' stderr
+
+:
diff --git a/tests/txinfo5.test b/tests/txinfo5.test
index 0bbc7d9..2467113 100755
--- a/tests/txinfo5.test
+++ b/tests/txinfo5.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2008  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2008, 2011 Free Software Foundation,
+# Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,8 +17,11 @@
 
 # Test to make sure that texinfo.tex is not required by --cygnus.
 # Report from Ian Taylor.
+
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AM_MAINTAINER_MODE
 END
@@ -28,5 +32,7 @@ END
 
 echo '@setfilename ian.info' > ian.texi
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE --cygnus
+
+:
diff --git a/tests/txinfo6.test b/tests/txinfo6.test
index ad3704e..f5b8c0b 100755
--- a/tests/txinfo6.test
+++ b/tests/txinfo6.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,8 +15,11 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure `.txi' extension works.
+
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 info_TEXINFOS = foo.txi
 END
@@ -24,7 +27,9 @@ END
 echo '@setfilename foo.info' > foo.txi
 : > texinfo.tex
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
+
+grep '^\.txi\.info: *$' Makefile.in
 
-$FGREP '.txi.info' Makefile.in
+:
diff --git a/tests/txinfo7.test b/tests/txinfo7.test
index 466a216..9a1dd5c 100755
--- a/tests/txinfo7.test
+++ b/tests/txinfo7.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,15 +19,17 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
-magic:
-       @echo $(DISTFILES)
 END
 
 echo '@setfilename textutils.info' > textutils.texi
 
-$ACLOCAL || Exit 1
-$AUTOMAKE -a || Exit 1
+$ACLOCAL
+$AUTOMAKE -a
 
 test -f texinfo.tex
+
+:
diff --git a/tests/txinfo8.test b/tests/txinfo8.test
index 7975b28..8dd24a4 100755
--- a/tests/txinfo8.test
+++ b/tests/txinfo8.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004  Free Software
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -21,32 +21,38 @@
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AC_CONFIG_AUX_DIR(sub)
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile sub/Makefile)
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
+.PHONY: test1 test2
+test1:
+       @echo DISTFILES = $(DISTFILES)
+       echo ' ' $(DISTFILES) ' ' | grep '[ /]auxdir/texinfo\.tex '
+test2: distdir
+       ls -l $(distdir)/*
+       test -f $(distdir)/auxdir/texinfo.tex
 END
 
 echo '@setfilename textutils.info' > textutils.texi
 
-test -d sub || mkdir sub
+mkdir auxdir
 
-cat > sub/Makefile.am << 'END'
-magic:
-       @echo $(DISTFILES)
-END
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
 
-$ACLOCAL || Exit 1
-$AUTOMAKE -a || Exit 1
+test -f auxdir/texinfo.tex
 
-$FGREP -v @SET_MAKE@ sub/Makefile.in > sub/Makefile.sed
-test -f sub/texinfo.tex &&
-$MAKE -s -f sub/Makefile.sed SHELL=$SHELL magic | grep 'texinfo\.tex'
-stat=$?
+./configure
+$MAKE test1 test2
 
-Exit $stat
+:
diff --git a/tests/txinfo9.test b/tests/txinfo9.test
index b9eb7b5..71b5efb 100755
--- a/tests/txinfo9.test
+++ b/tests/txinfo9.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2011 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,12 +14,12 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure we only create dist-info target once.
-# This is just an example -- basically for many targets in texinfos.am
-# we only want them to appear once.
+# Make sure we only create texinfo-related targets once.
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 info_TEXINFOS = maude.texi liver.txi heart.texinfo
 END
@@ -29,7 +29,15 @@ echo '@setfilename liver.info' > liver.txi
 echo '@setfilename heart.info' > heart.texinfo
 : > texinfo.tex
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
+
+# These are just examples -- basically for many targets in texinfos.am
+# we only want them to appear once.  But grepping them all would be
+# overkill.
+for t in info dist-info dvi-am install-html uninstall-pdf-am; do
+  $EGREP "(^| )$t*.:" Makefile.in # help in debugging
+  test `$EGREP -c "(^| )$t(:| *.:)" Makefile.in` -eq 1
+done
 
-test `grep '^dist-info:' Makefile.in | wc -l` -eq 1
+:
diff --git a/tests/vtexi.test b/tests/vtexi.test
index c28a356..e9a4511 100755
--- a/tests/vtexi.test
+++ b/tests/vtexi.test
@@ -1,6 +1,6 @@
 #!/bin/sh
-# Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003
-#   Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2011 Free Software
+# Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,8 +15,13 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# Basic checks and some regressions testing on `version.texi'
+# support for texinfo files.
+
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
 END
@@ -30,9 +35,7 @@ END
 : > mdate-sh
 : > texinfo.tex
 
-set -e
-
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
 
 # Test for bug reported by Jim Meyering:
@@ -41,25 +44,22 @@ $AUTOMAKE
 #   textutils.info: textutils.texi
 # instead of
 #   textutils.info: textutils.texi version.texi
-# (Today this should be `textutils.info: version.texi')
-
-grep 'textutils\.info:.*version\.texi$' Makefile.in
-
+# Today this should be:
+#   $(srcdir)/textutils.info: $(srcdir)/version.texi
+# or:
+#   $(srcdir)/textutils.info: version.texi
+grep '^\$(srcdir)/textutils\.info:.*[ /]version\.texi *$' Makefile.in
 
 # Test for bug reported by Lars Hecking:
 # When running the first version of configure.ac aware automake,
 # @CONFIGURE_AC@ was not properly substituted.
-
 $EGREP 'stamp-vti:.*textutils\.texi( .*)?$' Makefile.in
 $EGREP 'stamp-vti:.*\$\(top_srcdir\)/configure( .*)?$' Makefile.in
 
-
 # Check that the path to mdate-sh is correct.  Over escaping of `$'
 # etc. once led to `\$\(srcdir\)/mdate-sh'.
+# Filter out '$(srcdir)/mdate-sh'; there should be no occurrences
+# of `.../mdate-sh' left then.
+sed 's,\$(srcdir)/mdate-sh,,g' Makefile.in | grep '/mdate-sh' && Exit 1
 
-# Filter out '$(srcdir)/mdate-sh'; output occurrences of `SOMETHING/mdate-sh'
-sed -n 's,\$(srcdir)/mdate-sh,,g;s,.* \([^ ]*/mdate-sh\) .*,\1,gp' Makefile.in|
-# There must remain nothing.
- grep . && Exit 1
-
-Exit 0
+:
diff --git a/tests/vtexi2.test b/tests/vtexi2.test
index e1a1b93..b945aa7 100755
--- a/tests/vtexi2.test
+++ b/tests/vtexi2.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2010 Free Software Foundation,
+# Copyright (C) 1996, 1997, 2001, 2002, 2011 Free Software Foundation,
 # Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -40,4 +40,6 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-grep '^zardoz\.dvi:' Makefile.in
+grep '^zardoz\.dvi:.*[ /]version.texi' Makefile.in
+
+:
diff --git a/tests/vtexi3.test b/tests/vtexi3.test
new file mode 100755
index 0000000..34f46c5
--- /dev/null
+++ b/tests/vtexi3.test
@@ -0,0 +1,124 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that vers*.texi files are automatically created and distributed
+# if @included into a texi source.  Also check that they correctly contain
+# the @values definitions they are advertised to.
+# See also the related test `vtexi4.test', which does similar checks, but
+# for version.texi only, and requires makeinfo, tex and texi2dvi.
+
+. ./defs || Exit 1
+
+set -e
+
+distdir=$me-7.45.3a
+
+# This should work without tex, texinfo or makeinfo
+TEX=false TEXI2DVI=false MAKEINFO=false
+export TEX TEXI2DVI MAKEINFO
+
+cat > configure.in << END
+AC_INIT([$me], [7.45.3a])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = foobar.texi quux.texi zardoz.texi
+.PHONY: echo-distfiles
+echo-distfiles:
+       @echo ' ' $(DISTFILES) ' '
+END
+
+cat > foobar.texi << 'END'
address@hidden foobar.info
+random text
address@hidden version.texi
+END
+
+cat > quux.texi << 'END'
address@hidden quux.info
address@hidden version-quux.texi
+random text
+END
+
+cat > zardoz.texi << 'END'
address@hidden zardoz.info
+some randome text
address@hidden vers1a_2b.texi
+more random text
+END
+
+# Required when using Texinfo.
+: > texinfo.tex
+cp "$testsrcdir/../lib/mdate-sh" .
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+day='([1-9]|1[0-9]|2[0-9]|3[01])'
+month='(January|February|March|April|May|June|July|August|September|October|November|December)'
+year='20[0-9][0-9]' # Hopefully automake will be obsolete in 80 years ;-)
+date="$day $month $year"
+
+do_check ()
+{
+  # Basename of the vers*.texi file.
+  vfile=$1
+  # The $(srcdir) of the current build.
+  srcdir=$2
+  # The vers*.texi file must be created in $(srcdir).
+  $MAKE $srcdir/$vfile.texi
+  cat $srcdir/$vfile.texi
+  # EDITION and VERSION are synonyms, as per documentation.
+  grep "address@hidden EDITION 7\\.45\\.3a$" $srcdir/$vfile.texi
+  grep "address@hidden VERSION 7\\.45\\.3a$" $srcdir/$vfile.texi
+  # Check that UPDATED seems right, and that UPDATED and UPDATED-MONTH
+  # are consistent.
+  $EGREP "address@hidden UPDATED $date$" $srcdir/$vfile.texi
+  vmonth=`grep 'address@hidden UPDATED ' $srcdir/$vfile.texi | awk '{print $4, 
$5}'`
+  grep "address@hidden UPDATED-MONTH $vmonth$" $srcdir/$vfile.texi
+  # Check that the vers*.texi file is distributed according
+  # to $(DISTFILES).
+  $MAKE echo-distfiles # For debugging.
+  $MAKE -s echo-distfiles | grep "[ /]$vfile\\.texi"
+}
+
+mkdir build
+cd build
+../configure
+
+do_check version ..
+do_check version-quux ..
+do_check vers1a_2b ..
+
+# The various $(srcdir)/*.info are required for the distribution
+# and they must be newer than version.texi, so that make won't try
+# to rebuild them.
+$sleep
+touch ../foobar.info
+touch ../quux.info
+touch ../zardoz.info
+# Check that the vers*.texi files are really distributed.
+$MAKE distdir
+ls -l $distdir
+diff ../version.texi $distdir/version.texi
+diff ../version-quux.texi $distdir/version-quux.texi
+diff ../version.texi $distdir/vers1a_2b.texi
+
+:
diff --git a/tests/vtexi4.test b/tests/vtexi4.test
new file mode 100755
index 0000000..69dffb5
--- /dev/null
+++ b/tests/vtexi4.test
@@ -0,0 +1,118 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the version.texi file is automatically created and distributed
+# if @included into a texi source.  Also check that is correctly defined
+# @values definitions it is advertised to.
+# See also the related test `vtexi3.test', which does similar checks, but
+# for more vers*.texi files, and does not require makeinfo, tex and
+# texi2dvi.
+
+required='makeinfo tex texi2dvi-o'
+. ./defs || Exit 1
+
+set -e
+
+case `LC_ALL=C date '+%u'` in
+  [1-7]) date_is_posix=:;;
+      *) date_is_posx=false;;
+esac
+$date_is_posix \
+  && day=`LC_ALL=C date '+%d'` && test -n "$day" \
+  && month=`LC_ALL=C date '+%B'` && test -n "$month" \
+  && year=`LC_ALL=C date '+%Y'`&& test -n "$year" \
+  || { echo "$me: 'date' is not POSIX-complaint enough"; Exit 77; }
+day=`echo "$day" | sed 's/^0//'`
+
+# This test requires a grep program that can work on non-text input.
+(echo 'x' | grep x) || {
+  echo "$me: grep doesn't work on input that is not pure text" >&2
+  Exit 77
+}
+
+cat > configure.in << END
+AC_INIT([$me], [123.456])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat > defs.am <<END
+my_date_rx = $day $month $year
+my_month_rx = $month $year
+my_version_rx = 123\.456
+END
+
+cat > Makefile.am << 'END'
+include defs.am
+info_TEXINFOS = foo.texi
+test-grepinfo:
+## Not useless uses of cat: we only tested that grep worked on
+## non-text input when that's given from a pipe.
+       cat $(srcdir)/foo.info | grep 'GREPVERSION=$(my_version_rx)='
+       cat $(srcdir)/foo.info | grep 'GREPEDITION=$(my_version_rx)='
+       cat $(srcdir)/foo.info | grep 'GREPDATE=$(my_date_rx)='
+       cat $(srcdir)/foo.info | grep 'GREPMONTH=$(my_month_rx)='
+test-distfiles:
+       @echo DISTFILES = $(DISTFILES)
+       echo ' ' $(DISTFILES) ' ' | grep '[ /]version.texi '
+test-distdir: distdir
+       ls -l $(distdir)
+       diff $(srcdir)/version.texi $(distdir)/version.texi
+.PHONY: test-grepinfo test-distfiles test-distdir
+check-local: test-grepinfo test-distfiles test-distdir
+END
+
+cat > foo.texi << 'END'
+\input texinfo
address@hidden %**start of header
address@hidden foo.info
address@hidden Zardoz
address@hidden %**end of header
+
address@hidden Top
address@hidden version.texi
+
address@hidden
+
address@hidden
+
address@hidden
+
address@hidden
+
address@hidden
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE all dvi
+
+# debugging & sanity checks
+ls -l
+cat version.texi
+cat foo.info
+test -f foo.dvi
+
+$MAKE test-grepinfo
+$MAKE test-distfiles
+$MAKE test-distdir
+$MAKE distcheck
+
+:
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]