summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/tests/control2
-rwxr-xr-xtests/pretend-pbuilder26
-rwxr-xr-xtests/tests/pbuilder42
3 files changed, 69 insertions, 1 deletions
diff --git a/debian/tests/control b/debian/tests/control
index 81fdeb7..8480655 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -60,7 +60,7 @@ Tests: trustingpolicy-replay
Tests-Directory: tests/tests
Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, dput-ng
-Tests: absurd-gitapply badcommit-rewrite build-modes checkout clone-clogsigpipe clone-gitnosuite clone-nogit debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-correct 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-newrepeat push-nextdgit push-source push-source-with-changes quilt quilt-gbp quilt-gbp-build-modes quilt-singlepatch quilt-splitbrains quilt-useremail rpush sourceonlypolicy tag-updates test-list-uptodate unrepresentable version-opt
+Tests: absurd-gitapply badcommit-rewrite build-modes checkout clone-clogsigpipe clone-gitnosuite clone-nogit debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-correct 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 pbuilder protocol-compat push-buildproductsdir push-newpackage push-newrepeat push-nextdgit push-source push-source-with-changes quilt quilt-gbp quilt-gbp-build-modes quilt-singlepatch quilt-splitbrains quilt-useremail rpush sourceonlypolicy tag-updates test-list-uptodate unrepresentable version-opt
Tests-Directory: tests/tests
Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc
diff --git a/tests/pretend-pbuilder b/tests/pretend-pbuilder
new file mode 100755
index 0000000..8495a2f
--- /dev/null
+++ b/tests/pretend-pbuilder
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Getopt::Long;
+
+my $operation = shift;
+die "pbuilder: you should use me only to build, dgit"
+ unless ($operation eq "build" || $operation eq "b");
+
+my $debbuildopts = undef;
+my $distribution = undef;
+GetOptions('debbuildopts=s' => \$debbuildopts,
+ 'distribution=s' => \$distribution);
+
+# ignore user args; last argument has to be the .dsc filename
+my $dsc = $ARGV[-1];
+die "pbuilder: last argument has wrong file extension"
+ unless ($dsc =~ m/^(.*)_.*\.dsc$/);
+
+system "dpkg-source -x $dsc pbuilder";
+chdir 'pbuilder';
+system <<END
+dpkg-buildpackage --changes-option=-DDistribution=$distribution $debbuildopts
+END
diff --git a/tests/tests/pbuilder b/tests/tests/pbuilder
new file mode 100755
index 0000000..2c9dbae
--- /dev/null
+++ b/tests/tests/pbuilder
@@ -0,0 +1,42 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+suitespecs+=' stable'
+
+t-buildproductsdir-config
+
+t-prep-newpackage example 1.0
+
+cd $p
+
+t-commit "make a commit" 1.1 stable
+
+t-tstunt pbuilder
+
+t-expect-fail "dgit: error: you asked for a builder but your debbuildopts didn't ask for any binaries -- is this really what you meant?" \
+t-dgit -v0 --pbuilder="$troot/pretend-pbuilder" pbuilder -S
+
+t-expect-fail "dgit: error: we must build a .dsc to pass to the builder but your debbuiltopts forbids the building of a source package; cannot continue" \
+t-dgit -v0 --pbuilder="$troot/pretend-pbuilder" pbuilder -b
+
+# it would be nice to try passing -g on the end of the following line
+# to confirm it gets massaged into -A, but the example package is
+# RC-buggy in that it doesn't build with -A ..
+t-dgit -v0 --pbuilder="$troot/pretend-pbuilder" pbuilder
+
+t-dgit -wgf push --new
+
+t-pushed-good master stable
+t-pushed-good-check-changes
+
+# check we actually built binaries
+t-push-included example_1.1_all.deb
+
+# this purpose of this is to check that the _source.changes that was
+# merged is the one that dgit made, not something pbuilder made (this
+# works because the -v$v in the above is handled by dgit and not
+# passed on to pbuilder)
+grep -F "example (1.0)" $changes_filename
+
+t-ok