Test that manpages format with only expected roff warnings.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
$(INSTALL_DIR) $(DESTDIR)$(bindir) $(DESTDIR)$(infraexamplesdir) \
$(addprefix $(DESTDIR)$(perldir)/, $(dir $(INFRA_PERLMODULES)))
+list-manpages:
+ @echo $(MANPAGES)
+
check installcheck:
clean distclean mostlyclean maintainer-clean:
* Merge the experimental branch containing the fianl
version of the test suite gnupg workarounds.
+ * test suite: Test that manpages format with only expected warnings.
+
--
dgit (5.5+exp9) experimental; urgency=medium
Depends: gnupg, patch, diffutils
Restrictions: hint-testsuite-triggers
+Tests: manpages-format
+Tests-Directory: tests/tests
+Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, man-db, make, groff, git-debrebase
+
Tests: defdistro-mirror mirror mirror-debnewgit mirror-private
Tests-Directory: tests/tests
Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, rsync
: ${DGIT_SSH_DISPATCH_TEST:=$DGIT_TEST_INTREE/infra/dgit-ssh-dispatch}
: ${DGIT_INFRA_PFX:=$DGIT_TEST_INTREE${DGIT_TEST_INTREE:+/infra/}}
: ${DGIT_GITDEBREBASE_TEST:=$DGIT_TEST_INTREE/git-debrebase}
+ : ${DGIT_MANPAGES_SOURCE_DIR:=$DGIT_TEST_INTREE}
export DGIT_TEST DGIT_BADCOMMIT_FIXUP
export DGIT_REPOS_SERVER_TEST DGIT_SSH_DISPATCH_TEST
+ export DGIT_MANPAGES_SOURCE_DIR
export PERLLIB="$DGIT_TEST_INTREE${PERLLIB:+:}${PERLLIB}"
}
--- /dev/null
+#!/bin/bash
+set -e
+autoimport=
+. tests/lib
+
+t-dependencies man-db make groff git-debrebase
+
+cd $root
+
+printenv |grep MAKE ||: |sort
+manpages=$(MAKEFLAGS= MAKELEVEL= make list-manpages)
+
+export MANWIDTH=80
+
+run_man () {
+ if [ "x${DGIT_MANPAGES_SOURCE_DIR}" = x ]; then
+ cmd='man "$@" $section $page'
+ else
+ make $roff >&2
+ cmd='man "$@" -l $roff'
+ fi
+ eval "$cmd 2>&1 >/dev/null |tee $errs >&2"
+}
+
+for roff in $manpages; do
+ >$tmp/$roff.expected
+done
+
+expected () {
+ cat >$tmp/$1.expected
+}
+
+not_egrep_vxPf () {
+ # egrep -vxPf does not work, so we reimplement it
+ perl -ne '
+ BEGIN () {
+ open PATS, shift @ARGV or die $!;
+ $re = join "|", map { chomp; qr{^(?:$_)$} } <PATS>;
+ }
+ next if m{$re};
+ print STDERR "unexpected: $_";
+ $bad = 1;
+ END { die "unexpected, re= $re\n" if $bad; }
+ ' "$@"
+}
+
+expected dgit.1 <<'END'
+.* # table wider than line width
+END
+
+for roff in $manpages; do
+ section=${roff##*.}
+ page=${roff%.*}
+
+ errs=$tmp/$roff.errs
+ run_man >/dev/null
+ perl -0777 -i~ -pe 's/\n[ \t]+/ # /' $errs
+ not_egrep_vxPf $tmp/$roff.expected $errs
+done
+
+t-ok