automake-patches
[Top][All Lists]
Advanced

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

[PATCH] {maint} Improve and extend tests `man*.test'.


From: Stefano Lattarini
Subject: [PATCH] {maint} Improve and extend tests `man*.test'.
Date: Mon, 8 Nov 2010 18:26:22 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Pinging this patch again, following this:
 <http://lists.gnu.org/archive/html/automake-patches/2010-11/msg00003.html>

Since I was at it, I rebased the patch, and squashed in some additional
improvements. The updated patch is attached; here is what I squashed in
(after the rebase):

========================================================================

diff --git a/ChangeLog b/ChangeLog
index 55e5a99..e39dc11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,16 @@
-2010-08-17  Stefano Lattarini  <address@hidden>
+2010-11-08  Stefano Lattarini  <address@hidden>
 
        Improve and extend tests on man pages support.
        * tests/man.test: Enable `errexit' shell flag, and related changes.
        Make grepping of generated Makefile.in slighty stricter.
-       * tests/man3.test: Add trailing `:' command.
+       * tests/man3.test:  Add trailing `:' command.
        * tests/man5.test: Prefer cat + here-doc over echo to append to
        configure.in.
        * tests/man2.test: Likewise, and add trailing `:' command.
        * tests/man4.test: More thorough and consistent checking of make
-       error messages.  Move the checks using the real `help2man' program
-       to ...
+       error messages.  Place fake `help2man' program in a new `bin'
+       directory rather than in `.'.  Move the checks using the real
+       `help2man' program to ...
        * tests/man6.test: ... this new test, and extend them.  This test
        passes with GNU make and Solaris make, still fails with BSD make.
        * tests/man7.test: New test, extracted from old man4.test, which
diff --git a/tests/man.test b/tests/man.test
index 7037330..1b287a8 100755
--- a/tests/man.test
+++ b/tests/man.test
@@ -31,6 +31,6 @@ END
 
 $ACLOCAL
 $AUTOMAKE
-grep '^MANS = ' Makefile.in
+grep '^MANS *=' Makefile.in
 
 :
diff --git a/tests/man4.test b/tests/man4.test
index 643817c..3eff468 100755
--- a/tests/man4.test
+++ b/tests/man4.test
@@ -59,17 +59,17 @@ while test $# -gt 0; do
   shift
 done
 END
-
 cp foo bar
+chmod +x foo bar
 
-cat > help2man <<'END'
+mkdir bin
+cat > bin/help2man <<'END'
 #! /bin/sh
 # fake help2man script that lets `missing' think it is not installed
 exit 127
 END
-
-chmod +x foo bar help2man
-PATH=`pwd`$PATH_SEPARATOR$PATH
+chmod +x bin/help2man
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH
 
 grep_error_messages()
 {

========================================================================

Regards,
   Stefano
From cdd3cf335605dd91c65c4e6744efe9c94854e9ce Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 12 Jul 2010 17:37:33 +0200
Subject: [PATCH] Improve and extend tests on man pages support.

* tests/man.test: Enable `errexit' shell flag, and related changes.
Make grepping of generated Makefile.in slighty stricter.
* tests/man3.test:  Add trailing `:' command.
* tests/man5.test: Prefer cat + here-doc over echo to append to
configure.in.
* tests/man2.test: Likewise, and add trailing `:' command.
* tests/man4.test: More thorough and consistent checking of make
error messages.  Place fake `help2man' program in a new `bin'
directory rather than in `.'.  Move the checks using the real
`help2man' program to ...
* tests/man6.test: ... this new test, and extend them.  This test
passes with GNU make and Solaris make, still fails with BSD make.
* tests/man7.test: New test, extracted from old man4.test, which
checks for a bug in maintainer-clean w.r.t. generated manpages.
* tests/man8.test: New test, extracted from old man4.test, which
checks for a bug in distcheck w.r.t. generated manpages.  Passes
with GNU make and Solaris make, still fails with BSD make.
---
 ChangeLog       |   21 ++++++++++++
 tests/man.test  |   13 +++++--
 tests/man2.test |    8 +++-
 tests/man3.test |    4 ++-
 tests/man4.test |   44 ++++++++++++-------------
 tests/man5.test |    6 ++-
 tests/man6.test |   99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/man7.test |   61 ++++++++++++++++++++++++++++++++++
 tests/man8.test |   58 ++++++++++++++++++++++++++++++++
 9 files changed, 282 insertions(+), 32 deletions(-)
 create mode 100755 tests/man6.test
 create mode 100755 tests/man7.test
 create mode 100755 tests/man8.test

diff --git a/ChangeLog b/ChangeLog
index a356958..e39dc11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2010-11-08  Stefano Lattarini  <address@hidden>
+
+       Improve and extend tests on man pages support.
+       * tests/man.test: Enable `errexit' shell flag, and related changes.
+       Make grepping of generated Makefile.in slighty stricter.
+       * tests/man3.test:  Add trailing `:' command.
+       * tests/man5.test: Prefer cat + here-doc over echo to append to
+       configure.in.
+       * tests/man2.test: Likewise, and add trailing `:' command.
+       * tests/man4.test: More thorough and consistent checking of make
+       error messages.  Place fake `help2man' program in a new `bin'
+       directory rather than in `.'.  Move the checks using the real
+       `help2man' program to ...
+       * tests/man6.test: ... this new test, and extend them.  This test
+       passes with GNU make and Solaris make, still fails with BSD make.
+       * tests/man7.test: New test, extracted from old man4.test, which
+       checks for a bug in maintainer-clean w.r.t. generated manpages.
+       * tests/man8.test: New test, extracted from old man4.test, which
+       checks for a bug in distcheck w.r.t. generated manpages.  Passes
+       with GNU make and Solaris make, still fails with BSD make.
+
 2010-11-07  Stefano Lattarini  <address@hidden>
 
        Fix a bug in variable concatanation with `+='.
diff --git a/tests/man.test b/tests/man.test
index 93b3bb2..1b287a8 100755
--- a/tests/man.test
+++ b/tests/man.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2010 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
@@ -18,6 +19,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 dist_man_MANS = foo.1
 nodist_man1_MANS = bar.man
@@ -26,6 +29,8 @@ END
 : > foo.1
 : > bar.man
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-grep '^MANS ' Makefile.in
+$ACLOCAL
+$AUTOMAKE
+grep '^MANS *=' Makefile.in
+
+:
diff --git a/tests/man2.test b/tests/man2.test
index 0027645..cafef02 100755
--- a/tests/man2.test
+++ b/tests/man2.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2010 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,7 +21,9 @@
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 man_MANS = foo.2
@@ -49,3 +51,5 @@ DESTDIR="`pwd`/_inst" $MAKE -e uninstall
 test ! -f ./_inst/man/man2/foo.2
 test ! -f ./_inst/man/man4/foo.4
 test ! -f ./_inst/man/man4/bar.4
+
+:
diff --git a/tests/man3.test b/tests/man3.test
index b5afe0e..8b9e3ee 100755
--- a/tests/man3.test
+++ b/tests/man3.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2010 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
@@ -42,3 +42,5 @@ $AUTOMAKE
 $AUTOCONF
 ./configure
 DISTCHECK_CONFIGURE_FLAGS=foo=bar $MAKE -e distcheck
+
+:
diff --git a/tests/man4.test b/tests/man4.test
index de75f83..3eff468 100755
--- a/tests/man4.test
+++ b/tests/man4.test
@@ -42,9 +42,6 @@ $(srcdir)/foo.1:
        $(HELP2MAN) --output=$@ $(srcdir)/foo
 bar.1:
        $(HELP2MAN) --output=$(srcdir)/bar.1 $(srcdir)/bar
-
-## It is a bug that we need to list $(srcdir)/bar.1 explicitly here.
-MAINTAINERCLEANFILES = $(dist_man_MANS) $(srcdir)/bar.1
 END
 
 cat >>configure.in <<'END'
@@ -62,26 +59,38 @@ while test $# -gt 0; do
   shift
 done
 END
-
 cp foo bar
+chmod +x foo bar
 
-cat > help2man <<'END'
+mkdir bin
+cat > bin/help2man <<'END'
 #! /bin/sh
 # fake help2man script that lets `missing' think it is not installed
 exit 127
 END
+chmod +x bin/help2man
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH
 
-chmod +x foo bar help2man
-save_PATH=$PATH
-PATH=`pwd`$PATH_SEPARATOR$PATH
+grep_error_messages()
+{
+  grep ' man pages contain.*missing help2man.* replacement text' stderr \
+   && grep 'install help2man' stderr \
+   && grep 'regenerate the man pages' stderr \
+   || Exit 1
+}
 
 $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
+
 ./configure
 $MAKE
-$MAKE dist && Exit 1
-$MAKE distcheck && Exit 1
+$MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep_error_messages
+$MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep_error_messages
 $MAKE distclean
 
 mkdir build
@@ -90,20 +99,9 @@ cd build
 $MAKE
 $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep 'install help2man' stderr
+grep_error_messages
 $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep 'install help2man' stderr
-
-rm -f ../help2man
-PATH=$save_PATH
-export PATH
+grep_error_messages
 
-# If help2man is installed, then ensure that the recommendation works.
-if (help2man --version) >/dev/null 2>&1; then
-  $MAKE maintainer-clean
-  ../configure
-  $MAKE
-  $MAKE distcheck
-fi
 :
diff --git a/tests/man5.test b/tests/man5.test
index 437dc33..f21a099 100755
--- a/tests/man5.test
+++ b/tests/man5.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010 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,7 +20,9 @@
 
 set -e
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 man_MANS = foo-1.4.5/foo.2 foo-1.4.5/bar.3 baz-1.4.2
diff --git a/tests/man6.test b/tests/man6.test
new file mode 100755
index 0000000..94f59ad
--- /dev/null
+++ b/tests/man6.test
@@ -0,0 +1,99 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Ensure `make distcheck' passes when help2man generates man pages,
+# even if the `missing' script is involved.
+
+required=help2man
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am << 'END'
+dist_man_MANS = $(srcdir)/foobar.1 bazquux.1 zardoz.1
+dist_bin_SCRIPTS = foobar bazquux zardoz
+$(srcdir)/foobar.1:
+       $(HELP2MAN) --output=$@ $(srcdir)/foobar
+bazquux.1:
+       $(HELP2MAN) --output=$@ $(srcdir)/bazquux
+zardoz.1:
+       $(HELP2MAN) --output=$(srcdir)/zardoz.1 $(srcdir)/zardoz
+END
+
+cat >> configure.in <<'END'
+AM_MISSING_PROG([HELP2MAN], [help2man])
+AC_OUTPUT
+END
+
+cat > foobar <<'END'
+#! /bin/sh
+while test $# -gt 0; do
+  case $1 in
+    -h | --help) echo "usage: $0 [OPTIONS]..."; exit 0;;
+    -v | --version) echo "$0 1.0"; exit 0;;
+  esac
+  shift
+done
+END
+
+cp foobar bazquux
+cp foobar zardoz
+
+chmod +x foobar bazquux zardoz
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+mkdir build
+cd build
+
+../configure
+# sanity check
+grep '^HELP2MAN *=.*/missing --run help2man' Makefile
+
+$MAKE
+$FGREP foobar ../foobar.1
+$FGREP bazquux ./bazquux.1
+$FGREP zardoz ../zardoz.1
+
+$MAKE distdir
+$FGREP foobar  $me-1.0/foobar.1
+$FGREP bazquux $me-1.0/bazquux.1
+$FGREP zardoz  $me-1.0/zardoz.1
+
+$MAKE distcheck
+
+cd ..
+rm -f *.1 # remove leftover generated manpages
+
+./configure
+# sanity check
+grep '^HELP2MAN *=.*/missing --run help2man' Makefile
+
+$MAKE
+$FGREP foobar  foobar.1
+$FGREP bazquux bazquux.1
+$FGREP zardoz  zardoz.1
+
+$MAKE distdir
+$FGREP foobar  $me-1.0/foobar.1
+$FGREP bazquux $me-1.0/bazquux.1
+$FGREP zardoz  $me-1.0/zardoz.1
+
+$MAKE distcheck
+
+:
diff --git a/tests/man7.test b/tests/man7.test
new file mode 100755
index 0000000..748b8f8
--- /dev/null
+++ b/tests/man7.test
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Copyright (C) 2010 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 for a bug in maintainer-clean w.r.t. generated manpages.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am << 'END'
+dist_man_MANS = $(srcdir)/foo.1 bar.1
+$(srcdir)/foo.1 bar.1:
+       : > $@
+MAINTAINERCLEANFILES = $(dist_man_MANS)
+END
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+
+$MAKE
+test -f bar.1
+test -f ../foo.1
+
+$MAKE maintainer-clean
+test ! -f bar.1
+test ! -f ../foo.1
+
+cd ..
+./configure
+
+$MAKE
+test -f bar.1
+test -f foo.1
+
+$MAKE maintainer-clean
+test ! -f bar.1
+test ! -f foo.1
+
+:
diff --git a/tests/man8.test b/tests/man8.test
new file mode 100755
index 0000000..2ef52b4
--- /dev/null
+++ b/tests/man8.test
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2010 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 for a bug in distcheck w.r.t. generated manpages.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am << 'END'
+dist_man_MANS = foo.1
+foo.1:
+       rm -f $(srcdir)/$@  # fails if $(srcdir) is unwritable
+       : > $(srcdir)/$@
+END
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+
+$MAKE
+test -f ../foo.1
+$MAKE distdir
+test -f $me-1.0/foo.1
+$MAKE distcheck
+
+cd ..
+rm -f foo.1
+./configure
+
+$MAKE
+test -f foo.1
+$MAKE distdir
+test -f $me-1.0/foo.1
+$MAKE distcheck
+
+:
-- 
1.7.1


reply via email to

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