* 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-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 `+='.
#! /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
. ./defs || Exit 1
+set -e
+
cat > Makefile.am << 'END'
dist_man_MANS = foo.1
nodist_man1_MANS = bar.man
: > foo.1
: > bar.man
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-grep '^MANS ' Makefile.in
+$ACLOCAL
+$AUTOMAKE
+grep '^MANS *=' Makefile.in
+
+:
#! /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
set -e
-echo AC_OUTPUT >> configure.in
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
cat > Makefile.am << 'END'
man_MANS = foo.2
test ! -f ./_inst/man/man2/foo.2
test ! -f ./_inst/man/man4/foo.4
test ! -f ./_inst/man/man4/bar.4
+
+:
#! /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
$AUTOCONF
./configure
DISTCHECK_CONFIGURE_FLAGS=foo=bar $MAKE -e distcheck
+
+:
$(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'
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
$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
:
#! /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
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
--- /dev/null
+#! /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
+
+:
--- /dev/null
+#! /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
+
+:
--- /dev/null
+#! /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
+
+: