Subject: Re: bug#8969: improve synchronization between examples in the manual and test cases

From: "Ralf Wildenhues" <[email-masked]>
Date: Wed, 06 Jul 2011 08:40:10 +0200

* Stefano Lattarini wrote on Fri, Jul 01, 2011 at 12:59:53AM CEST:
> Subject: [PATCH] docs, tests: synchronize examples from docs to tests
> 
> * tests/README (Writing test cases): Give suggestions on how to
> keep test cases and examples in the documentation synchronized.
> * doc/automake.texi: Improve or fix existing testcase-referencing
> comments, and add many new ones.
> * HACKING (Administrivia): Suggest to test complex examples and
> idioms from the manual.
> * tests/specflg8.test: Improve synchronization with the example
> in the manual.
> * tests/output11.test:Likewise.
> * tests/txinfo21.test:Likewise.
> * tests/interp.test: Likewise.  Since we are at it, and enable
> the `errexit' shell flag, do related changes, and add trailing
> `:'command.
> * tests/amhello-cflags.test: New test.
> * tests/amhello-cross-compile.test: Likewise.
> * tests/amhello-binpkg.test: Likewise.
> * tests/tests-environment-backcompat: Likewise.
> * tests/parallel-tests-log-compiler-example.test: Likewise.
> * tests/Makefile.am (TESTS): Update.

> --- /dev/null
> +++ b/tests/amhello-binpkg.test
> @@ -0,0 +1,44 @@

> +# Document an example from the manual about the `amhello' package:
> +# using DESDIR to build simple, no-frills binary packages.

(DESTDIR was already fixed IIUC)

> +required=i586-mingw32msvc-gcc
> +. ./defs || Exit 1
> +
> +set -e
> +
> +cp "$testsrcdir"/../doc/amhello-1.0.tar.gz . \
> +  || fatal_ "cannot get amhello tarball"
> +
> +tar zxf amhello-1.0.tar.gz

The z flag is not portable to all tars, the portable spelling is
  gzip -dc amhello-1.0.tar.gz | tar xf -

(several instances).  I'm ok with fixing the manual also, although it's
usually clear for people still having to use those vendor tars (and
inconvenient for the rest).

> +cd amhello-1.0
> +
> +./configure --prefix /usr
> +make
> +make DESTDIR="`pwd`/inst" install
> +cd inst
> +find . -type f -print > ../files.lst
> +tar cvf amhello-1.0-i686.tar.gz `cat ../files.lst` > t
> +LC_ALL=C sort t > tar.got
> +
> +diff - tar.got <<'END'
> +./usr/bin/hello
> +./usr/share/doc/amhello/README
> +END
[...]

Nice patch btw!

Thanks,
Ralf