summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2010-07-12 17:37:33 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2010-11-08 18:23:10 +0100
commitcdd3cf335605dd91c65c4e6744efe9c94854e9ce (patch)
tree503f87855f44908a7deb92d8c69e31cb81655075
parent551b1133da2b17fb3d2171346fd4af86f05ad5fe (diff)
downloadautomake-cdd3cf335605dd91c65c4e6744efe9c94854e9ce.tar.gz
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.
-rw-r--r--ChangeLog21
-rwxr-xr-xtests/man.test13
-rwxr-xr-xtests/man2.test8
-rwxr-xr-xtests/man3.test4
-rwxr-xr-xtests/man4.test44
-rwxr-xr-xtests/man5.test6
-rwxr-xr-xtests/man6.test99
-rwxr-xr-xtests/man7.test61
-rwxr-xr-xtests/man8.test58
9 files changed, 282 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index a3569580c..e39dc113b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2010-11-08 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ 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 <stefano.lattarini@gmail.com>
Fix a bug in variable concatanation with `+='.
diff --git a/tests/man.test b/tests/man.test
index 93b3bb2c3..1b287a84f 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 0027645de..cafef0236 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 b5afe0ea3..8b9e3eeaa 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 de75f8374..3eff46816 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 437dc3337..f21a09942 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 000000000..94f59ad75
--- /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 000000000..748b8f847
--- /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 000000000..2ef52b4d9
--- /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
+
+: