chiark / gitweb /
test suite: dpkgsourceignores-docs: Check dgit-maint-merge(7) -i -I rune
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Aug 2017 08:53:58 +0000 (09:53 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Aug 2017 21:41:51 +0000 (22:41 +0100)
Check that the rune we document is the same as dgit actually uses.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/tests/control
dgit-maint-merge.7.pod
tests/tests/dpkgsourceignores-docs [new file with mode: 0755]

index f7f76119980dd2524cc4c659a1b1482e90f7edf7..efeeeed652a82b109f09d3faee3853f0a156e79f 100644 (file)
@@ -34,7 +34,7 @@ Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential
 Restrictions: x-dgit-git-only
 
-Tests: absurd-gitapply badcommit-rewrite build-modes build-modes-asplit build-modes-gbp-asplit clone-clogsigpipe clone-gitnosuite clone-nogit debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp defdistro-rpush defdistro-setup distropatches-reject drs-clone-nogit drs-push-masterupdate drs-push-rejects dsd-clone-nogit dsd-divert fetch-localgitonly fetch-somegit-notlast gbp-orig gitconfig gitworktree import-dsc import-maintmangle import-native import-nonnative import-tarbomb inarchivecopy mismatches-contents mismatches-dscchanges multisuite newtag-clone-nogit oldnewtagalt oldtag-clone-nogit orig-include-exclude orig-include-exclude-chkquery overwrite-chkclog overwrite-junk overwrite-splitbrains overwrite-version protocol-compat push-buildproductsdir push-newpackage push-nextdgit quilt quilt-gbp quilt-gbp-build-modes quilt-singlepatch quilt-splitbrains quilt-useremail rpush tag-updates test-list-uptodate trustingpolicy-replay unrepresentable version-opt
+Tests: absurd-gitapply badcommit-rewrite build-modes build-modes-asplit build-modes-gbp-asplit clone-clogsigpipe clone-gitnosuite clone-nogit debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-docs drs-clone-nogit drs-push-masterupdate drs-push-rejects dsd-clone-nogit dsd-divert fetch-localgitonly fetch-somegit-notlast gbp-orig gitconfig gitworktree import-dsc import-maintmangle import-native import-nonnative import-tarbomb inarchivecopy mismatches-contents mismatches-dscchanges multisuite newtag-clone-nogit oldnewtagalt oldtag-clone-nogit orig-include-exclude orig-include-exclude-chkquery overwrite-chkclog overwrite-junk overwrite-splitbrains overwrite-version protocol-compat push-buildproductsdir push-newpackage push-nextdgit quilt quilt-gbp quilt-gbp-build-modes quilt-singlepatch quilt-splitbrains quilt-useremail rpush tag-updates test-list-uptodate trustingpolicy-replay unrepresentable version-opt
 Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential
 
index 81f4254380737ce8f24310b23547332248f458e0..df1f953cdeb8956cd9e3aecf789a892b454cfac7 100644 (file)
@@ -205,11 +205,15 @@ Then make new upstream tags available:
 
 =back
 
+=for dgit-test dpkg-source-ignores begin
+
 Now you simply need to ensure that your git HEAD is dgit-compatible,
 i.e., it is exactly what you would get if you ran
 B<dpkg-buildpackage -i'\.git/' -I.git -S>
 and then unpacked the resultant source package.
 
+=for dgit-test dpkg-source-ignores end
+
 To achieve this, you might need to delete
 I<debian/source/local-options>.  One way to have dgit check your
 progress is to run B<dgit build-source>.
diff --git a/tests/tests/dpkgsourceignores-docs b/tests/tests/dpkgsourceignores-docs
new file mode 100755 (executable)
index 0000000..397b783
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-restriction-x-dgit-intree-only
+# we need the .pod source, which is not shipped
+
+cd $tmp
+
+: ----- extract args from document -----
+
+perl -ne '
+       BEGIN { print "\n=head1 dgit-test-title\n\n"; }
+       next unless
+               m/^=for dgit-test dpkg-source-ignores begin/..
+               m/^=for dgit-test dpkg-source-ignores end/;
+       next unless m/dpkg-buildpackage.*-i.*-I/;
+       s/\s*dpkg-buildpackage\s+//;
+       s/\s+-S\s*//;
+       print;
+' $root/dgit-maint-merge.7.pod >doc.pod
+
+pod2text doc.pod >doc.txt
+
+perl -ne '
+       next unless m/\S/;
+       next if m/dgit-test-title/;
+       print "for arg in ";
+       print;
+       print " do\n";
+' doc.txt >doc.sh
+
+cat >>doc.sh <<'END'
+       printf "%s\n" "$arg"
+done
+END
+
+chmod +x doc.sh
+./doc.sh >doc.args
+
+: ----- extract args from dgit -----
+
+perl -ne '
+       next unless m/^\s*our\s+\@dpkg_source_ignores\s*=/;
+       print;
+' $root/dgit >dgit.pl
+
+cat >>dgit.pl <<'END'
+       foreach my $arg (@dpkg_source_ignores) {
+               print $arg, "\n" or die $!;
+       }
+END
+
+perl dgit.pl >dgit.args
+
+: ----- compare -----
+
+diff -u dgit.args doc.args
+
+t-ok