diff options
Diffstat (limited to 'tests')
103 files changed, 1364 insertions, 356 deletions
diff --git a/tests/enumerate-tests b/tests/enumerate-tests index 8ee34be..9b9271c 100755 --- a/tests/enumerate-tests +++ b/tests/enumerate-tests @@ -42,21 +42,30 @@ finish- () { test-begin-gencontrol () { restrictions='' - dependencies='dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, faketime' + dependencies='dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, faketime, liburi-perl' +} + +gencontrol-add-things () { + local varname=$1; shift + local delim=$1; shift + local thing + eval ' + for thing in "$@"; do + case " $'$varname$delim '" in + *" "$thing"'$delim' "*) continue ;; + esac + '$varname'+="${'$varname':+'$delim' }$thing" + done + ' } restriction-gencontrol () { if [ $r = x-dgit-out-of-tree-only ]; then return; fi - restrictions+=" $r" + gencontrol-add-things restrictions '' "$r" } gencontrol-add-deps () { - for dep in "$@"; do - case " $dependencies," in - *" "$dep","*) continue ;; - esac - dependencies+="${dependencies:+, }$dep" - done + gencontrol-add-things dependencies , "$@" } dependencies-gencontrol () { @@ -89,7 +98,7 @@ test-done-gencontrol () { } ' case "$restrictions" in - ?*) echo "Restrictions:$restrictions" ;; + ?*) echo "Restrictions: $restrictions" ;; esac ) key=$(printf "%s" "$stanza" | sha256sum) @@ -132,6 +141,10 @@ allsedderies () { for import in $(seddery 's/^t-setup-import //p'); do allsedderies tests/setup/$import done + if egrep -q '^t-alt-test *$' <$tf; then + local leaf=${tf#tests/tests/} + allsedderies tests/tests/"${leaf#*-}" + fi } for t in $(run-parts --list tests/tests); do diff --git a/tests/git-srcs/pari-extra_3-1.git.tar b/tests/git-srcs/pari-extra_3-1.git.tar Binary files differindex 1673c72..7380353 100644 --- a/tests/git-srcs/pari-extra_3-1.git.tar +++ b/tests/git-srcs/pari-extra_3-1.git.tar diff --git a/tests/http-static-server b/tests/http-static-server new file mode 100755 index 0000000..723114e --- /dev/null +++ b/tests/http-static-server @@ -0,0 +1,97 @@ +#!/usr/bin/perl -w +# +# This file is part of the dgit test suite. +# +# Copyright (C)2004-2015 Best Practical Solutions, LLC +# Copyright (C)2019 Ian Jackson +# +# 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 3 of the License, 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. +# +# +# invocation protocol: +# +# http-static-server >port-file tests/tmp/$thing/aq +# +# Will write the allocated port number to port-file. +# Then we fork and the parent exits 0. +# If port-file is unlinked, we exit. + +use strict; +use IO::Handle; + +our ($webroot) = @ARGV; +our $port = ''; + +# HTTP::Server::Simple handles requests in the main process so it +# must redirect and close STDOUT. So transplant STDOUT to CHECK. +open CHECK, ">& STDOUT" or die $!; +open STDOUT, ">/dev/null" or die $!; + +sub stat_type_check () { + die "[$port, $webroot] stdout not ta plain file" + unless -f _; +} + +stat CHECK or die $!; +stat_type_check(); + +sub start_polling_fstat () { + our $polling_pid = $$; + $SIG{ALRM} = sub { + return unless $$ = $polling_pid; + stat CHECK or die $!; + my $nlink = (stat _)[3]; + exit 0 unless $nlink; + stat_type_check(); # doesn't seem possible to fail but check anyway + alarm(1); + }; + alarm(1); +} + +package ServerClass; + +use strict; +use Socket qw(AF_INET SOCK_STREAM); +use Socket qw(AF_INET SOCK_STREAM unpack_sockaddr_in); +use IO::Handle; + +use base qw(HTTP::Server::Simple::CGI); +use HTTP::Server::Simple::Static; + +sub handle_request { + my ($self, $cgi) = @_; + + if (!$self->serve_static($cgi, $::webroot)) { + print "HTTP/1.0 404 Not found\r\n"; + print $cgi->header; + print $cgi->start_html('Not found'), + $cgi->h1('Not found'), + $cgi->end_html + if uc $cgi->request_method eq 'GET'; + } +} + +sub port () { return 0; } + +sub after_setup_listener () { + my $sn = getsockname HTTP::Server::Simple::HTTPDaemon or die $!; + ($main::port,) = unpack_sockaddr_in $sn; + print main::CHECK $port, "\n" or die $!; + flush main::CHECK or die $!; + my $c = fork // die $!; + exit 0 if $c; + ::main::start_polling_fstat(); +} + +package main; + +our $server = ServerClass->new(); +$server->run(); @@ -1,7 +1,6 @@ # exec 2>&1 -set -x set -o pipefail . tests/lib-core @@ -22,7 +21,44 @@ END exit 16 } -trap 'test $? = 0 || t-report-failure' EXIT +trap ' + rc=$? + set +x + redirected_log="$DGIT_TEST_REDIRECTED_LOG" + if [ "$redirected_log" ]; then + exec 2>&5 >&2 + unset DGIT_TEST_REDIRECTED_LOG + cat -- "$redirected_log" ||: + fi + test $rc = 0 || echo " +%%%%%%%%%%%%%%%%%%%% EXITING $rc %%%%%%%%%%%%%%%%%%%% + + Most relevant logs are just before assignment rc=$rc + Will now do cleanup etc. +" + if [ $rc != 0 ] || ! [ "$DGIT_TRAP_QUIET" ]; then + set -x + pwd + fi + set +e + [ "x$DGIT_TEST_KEEP_MUSTCLEAN" != x ] || \ + [ "x$DGIT_TEST_TMP" = x ] || rm -rf $DGIT_TEST_TMP/must-clean + set -e + test $rc = 0 || t-report-failure +' EXIT + +if [ "$AUTOPKGTEST_ARTIFACTS" ] && ! [ "$DGIT_TEST_REDIRECTED_LOG" ] \ + && ! [ "$DGIT_TEST_DIRECT_LOG" ]; then + # When running under real autopkgtest, don't spew our megabytes of + # logs unconditionally. Redirect them to a file, and print them + # only on failure. On success, t-save-artifacts comppresses them. + exec 5>&2 + export DGIT_TEST_REDIRECTED_LOG="$AUTOPKGTEST_ARTIFACTS"/"${0##*/}.log" + exec >"$DGIT_TEST_REDIRECTED_LOG" + exec 2>&1 +fi + +set -x t-filter-out-git-hyphen-dir @@ -42,6 +78,10 @@ export GIT_AUTHOR_DATE='1530000000 +0100' export LC_CTYPE=C.UTF-8 unset CDPATH +# We use git-filter-branch in various tests. +# Nowadays it has a warning with associated sleep. +export FILTER_BRANCH_SQUELCH_WARNING=1 + root=`pwd` troot=$root/tests testname="${DGIT_TEST_TESTNAME-${0##*/}}" @@ -74,6 +114,11 @@ export DEBCHANGE_VENDOR=dpkg unset VISUAL unset GIT_EDITOR +mkdir -p $tmp/must-clean +# must-clean is usually removed after each test, on success or failure. +# But this must not be relied on for correctness, only for garbage +# collection etc. + mkdir -p $tmp/incoming cat <<END >$tmp/dput.cf [test-dummy] @@ -140,6 +185,7 @@ t-expect-push-fail () { t-reporefs pre-push t-expect-fail "$mpat" "$@" + cp $tmp/t.output $tmp/t.push-output t-reporefs post-push diff $tmp/show-refs.{pre,post}-push @@ -148,6 +194,23 @@ t-expect-push-fail () { eval "$t_expect_push_fail_hook" } +t-expect-push-fail-retriably () { + t-expect-push-fail "$@" + grep 'You can retry the push, after fixing the problem, if you like' \ + $tmp/t.push-output +} + +t-expect-push-fail-tainted () { + # t-expect-push-fail-local-and-remote $m $push_args... + # Message is implicitly prefixed with 'E:^' + # to avoid spotting them in protocol debug output etc. + # Same message is expected from the remote. + local m="$1"; shift + + t-expect-push-fail-retriably "E:^$m" "$@" + t-expect-push-fail "E:^remote: $m" "$@" --force-push-tainted +} + t-git-objects-not-present () { # t-git-objects-not-present GITDIR|'' OBJID [...] # specifying '' means the repo for package $p @@ -350,7 +413,8 @@ t-archive () { v=$2 local dscf=${p}_$2.dsc rm -f $tmp/mirror/pool/main/${p}_* - ln -s $troot/pkg-srcs/${p}_${2%-*}* $tmp/mirror/pool/main/ + ${t_archive_ln_s-ln -s} \ + $troot/pkg-srcs/${p}_${2%-*}* $tmp/mirror/pool/main/ t-archive-query $suite rm -rf $tmp/extract mkdir $tmp/extract @@ -410,6 +474,8 @@ t-git-fsck () { 0) fail "unexpected messages from git-fsck" ;; *) fail "grep of git-fsck failed" ;; esac + + t-output "" git log --all --grep '^\[dgit .*INTERNAL.*]' } t-check-only-bpd () { @@ -441,8 +507,22 @@ t-save-artifacts () { artifacts="$AUTOPKGTEST_ARTIFACTS" if [ x"$artifacts" = x ]; then return; fi if [ x"tmp" = x ]; then return; fi + # Empirically in a non-autopkgtest run with AUTOPKGTEST_ARTIFACTS + # this `-1` flag to gzip decreased the runtime from 585s (2558s CPU) + # to 609s (2730s CPU), a decrease of 5-7%. It increased the + # total size of the artifacts from 24220k to 26092k, ie +8%, + # but in a real autopkgtest run there are many bigger things + # alongside AUTOPKGTEST_ARTIFACTS put there by autopkgtest itself. GZIP=-1v tar -C "$tmp" -zc -f "$artifacts/${0##*/}.tar.gz" \ --exclude=\*.tar . + local logfile="$DGIT_TEST_REDIRECTED_LOG" + if [ "$logfile" ]; then + unset DGIT_TEST_REDIRECTED_LOG + set +x + DGIT_TRAP_QUIET=1 + exec >&5 2>&1 + gzip -f -- "$logfile" + fi } t-rm-dput-dropping () { @@ -464,6 +544,19 @@ t-dgit () { ' } +t-non-dgit-upload () { + t-dgit -wgf build-source + + cd .. + c=${p}_${v}_source.changes + debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c + dput -c $tmp/dput.cf test-dummy $c + + t-archive-process-incoming sid + t-git-next-date + cd $p +} + t-dgit-manpage () { local section=$1 local page=$2 @@ -565,6 +658,7 @@ t-setup-import () { simport="$1"; shift if [ -e "$simport" ]; then exit 0; fi env - "$@" \ + env -u DGIT_TEST_REDIRECTED_LOG \ "tests/setup/$setupname" ' x "$root" "$setupname" "$simport" fi @@ -573,6 +667,8 @@ t-setup-import () { (set -e; cd $tmp; tar xf "$simport.tar") fi + mkdir -p $tmp/must-clean + . "$simport" } @@ -777,11 +873,12 @@ t-splitbrain-pushed-good-start () { t-refs-same-start t-ref-same refs/heads/split.p - case "$(t-git-get-ref refs/heads/split.b)" in + local split_b=$(t-git-get-ref refs/heads/split.b) + case "$split_b" in "$t_ref_val") ;; "$(git rev-parse refs/heads/split.p^0)") ;; "$(git rev-parse refs/heads/split.p^1)") ;; - *) fail 'bad b/p' ;; + *) fail "bad b/p (b=$split_b)" ;; esac t-pushed-good-core @@ -871,7 +968,7 @@ t-commit-build-push-expect-log () { t-commit "$msg" t-dgit build LC_MESSAGES=C \ - t-dgit push --new 2>&1 |tee $tmp/push.log + t-dgit push-built --new 2>&1 |tee $tmp/push.log t-grep-mpat "$mpat" $tmp/push.log } @@ -1027,7 +1124,6 @@ t-git-pseudo-merge () { } t-gbp-example-prep-no-ff () { - t-tstunt-parsechangelog t-archive example 1.0-1 t-git-none t-worktree 1.0 @@ -1089,7 +1185,7 @@ t-merge-conflicted-stripping-conflict-markers () { t-commit () { local msg=$1 v=${2:-${majorv:-1}.$revision} - $troot/tstunt/debchange \ + t-debchange \ --force-distribution -v$v --distribution ${3:-unstable} "$1" git add debian/changelog debcommit @@ -1107,10 +1203,14 @@ t-dch-commit-r () { } t-dch-commit () { - $troot/tstunt/debchange "$@" + t-debchange "$@" git commit -m "dch $*" debian/changelog } +t-debchange () { + DEBEMAIL=dgit-tests@example.org $troot/tstunt/debchange "$@" +} + t-git-config () { git config --global "$@" } @@ -1187,7 +1287,7 @@ t-debpolicy () { t-dsd t-policy dgit-repos-policy-debian - mkdir $tmp/git + mkdir -p $tmp/git t-policy-admin create-db } @@ -1236,7 +1336,6 @@ t-tagupl-test () { cd ../$p t-dgit fetch - t-pushed-good master } t-buildproductsdir-config () { @@ -1279,6 +1378,7 @@ t-alt-test () { } t-git-config dgit.default.old-dsc-distro test-dummy +t-git-config dgit-distro.test-dummy.policy-query-supported-ssh true for import in ${autoimport-gnupg}; do case "$0" in diff --git a/tests/lib-baredebian b/tests/lib-baredebian index 3ef6569..51beb1f 100644 --- a/tests/lib-baredebian +++ b/tests/lib-baredebian @@ -23,7 +23,7 @@ baredebian-test-minimum () { t-dgit -wn --dgit-view-save=split.f1 --$quiltmode quilt-fixup } -baredebian-test-core () { +baredebian-test-core-prepush () { tar --strip-components=1 -axf ../$origbase.tar.* for comp in $xorigcomps; do mkdir $comp @@ -56,14 +56,23 @@ baredebian-test-core () { git add debian/patches/. t-commit 'extra patch made with quilt' 1.0-2 + t-refs-same-start + t-ref-head + t-dgit -wn --quilt=$quiltmode --dgit-view-save=split.b quilt-fixup + t-ref-head +} + +baredebian-test-core-push () { dpkg-buildpackage -uc -us --build=source # ^ Do this by hand here not because we expect users to do this # (rather than dgit build), but so that we can check that our # output is the same as users are used to. - t-dgit -wn --quilt=$quiltmode --dgit-view-save=split.b quilt-fixup - t-dgit -wn --quilt=$quiltmode --dgit-view-save=split.p --new push + t-dgit -wn --quilt=$quiltmode --dgit-view-save=split.p --new \ + push-built +} +baredebian-test-core-postpush () { git merge-base --is-ancestor HEAD split.p if [ "$uvtag" ]; then git merge-base --is-ancestor $uvtag split.p @@ -86,6 +95,12 @@ baredebian-test-core () { t-splitbrain-pushed-good-end-made-dep14 } +baredebian-test-core () { + baredebian-test-core-prepush + baredebian-test-core-push + baredebian-test-core-postpush +} + baredebian-test () { baredebian-test-vars baredebian-test-minimum diff --git a/tests/lib-build-modes b/tests/lib-build-modes index 27c5b06..a4482be 100644 --- a/tests/lib-build-modes +++ b/tests/lib-build-modes @@ -44,6 +44,7 @@ bm-prep () { bm-gbp-example-acts () { t-gbp-example-prep + t-tstunt-parsechangelog git checkout -b for-build-modes qc/quilt-tip-2 # build-modes cannot cope with branches containing / diff --git a/tests/lib-core b/tests/lib-core index bdf3a6c..d4d0bd5 100644 --- a/tests/lib-core +++ b/tests/lib-core @@ -11,13 +11,16 @@ t-set-intree () { : ${DGIT_BADCOMMIT_FIXUP:=$DGIT_TEST_INTREE/dgit-badcommit-fixup} : ${DGIT_REPOS_SERVER_TEST:=$DGIT_TEST_INTREE/infra/dgit-repos-server} : ${DGIT_SSH_DISPATCH_TEST:=$DGIT_TEST_INTREE/infra/dgit-ssh-dispatch} +: ${DGIT_MIRROR_SSH_WRAP_TEST:=$DGIT_TEST_INTREE/infra/dgit-mirror-ssh-wrap} : ${DGIT_DEBPUSH_TEST:=$DGIT_TEST_INTREE/git-debpush} : ${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} + : ${DEBPUSH_GIT_PLAYTREE_SETUP:=$DGIT_TEST_INTREE/git-playtree-setup} export DGIT_TEST DGIT_BADCOMMIT_FIXUP export DGIT_REPOS_SERVER_TEST DGIT_SSH_DISPATCH_TEST - export DGIT_MANPAGES_SOURCE_DIR + export DGIT_MIRROR_SSH_WRAP_TEST + export DGIT_MANPAGES_SOURCE_DIR DEBPUSH_GIT_PLAYTREE_SETUP export PERLLIB="$DGIT_TEST_INTREE${PERLLIB:+:}${PERLLIB}" } @@ -30,6 +33,7 @@ t-set-using-tmp () { git config --global user.email 'dgit-test@debian.example.net' git config --global user.name "$DEBFULLNAME" git config --global protocol.ext.allow always + git config --global dgit.default.push-subcmd reject } t-filter-out-git-hyphen-dir () { diff --git a/tests/lib-gdr b/tests/lib-gdr index cda11df..bf94fba 100644 --- a/tests/lib-gdr +++ b/tests/lib-gdr @@ -260,17 +260,7 @@ t-nmu-upload-2 () { t-nmu-upload-3 () { t-dch-commit-r - - t-dgit -wgf build-source - - cd .. - c=${p}_${v}_source.changes - debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c - dput -c $tmp/dput.cf test-dummy $c - - t-archive-process-incoming sid - t-git-next-date - cd $p + t-non-dgit-upload git checkout master } diff --git a/tests/lib-orig-include-exclude b/tests/lib-orig-include-exclude index 104cf0b..4372f36 100644 --- a/tests/lib-orig-include-exclude +++ b/tests/lib-orig-include-exclude @@ -29,7 +29,7 @@ test-push-1 () { test-push-2 () { $test_push_2_hook - t-dgit $ch "$@" push + t-dgit $ch "$@" push-built } test-push-1 1.0-2 --ch:-sa diff --git a/tests/pkg-srcs/example_1.0-1+absurd.debian.tar.xz b/tests/pkg-srcs/example_1.0-1+absurd.debian.tar.xz Binary files differindex 9a2dd12..5f9ae71 100644 --- a/tests/pkg-srcs/example_1.0-1+absurd.debian.tar.xz +++ b/tests/pkg-srcs/example_1.0-1+absurd.debian.tar.xz diff --git a/tests/pkg-srcs/example_1.0-1+absurd.dsc b/tests/pkg-srcs/example_1.0-1+absurd.dsc index 1ab743d..cc7f80b 100644 --- a/tests/pkg-srcs/example_1.0-1+absurd.dsc +++ b/tests/pkg-srcs/example_1.0-1+absurd.dsc @@ -11,12 +11,12 @@ Package-List: Checksums-Sha1: 2bc730f941db49de57e9678fb0b07bd95507bb44 236 example_1.0.orig-docs.tar.gz 4bff9170ce9b10cb59937195c5ae2c73719fe150 373 example_1.0.orig.tar.gz - dafb6f0db0580179ff246dba1dc2892246e84a2c 1416 example_1.0-1+absurd.debian.tar.xz + 6ee4c2149fecb1924ffde88c034deefe6a4cee9d 1528 example_1.0-1+absurd.debian.tar.xz Checksums-Sha256: ad9671f6b25cdd9f0573f803f702448a45a45183db1d79701aa760bccbeed29c 236 example_1.0.orig-docs.tar.gz a3ef7c951152f3ec754f96fd483457aa88ba06df3084e6f1cc7c25b669567c17 373 example_1.0.orig.tar.gz - 4003c34398894e46823bb3fda69f4351dbd5649e321259cde266a135f0428c51 1416 example_1.0-1+absurd.debian.tar.xz + 79702097c21c31773f7fa3b5d0f4e535e6d6a66952075185b81915bfb27a62a8 1528 example_1.0-1+absurd.debian.tar.xz Files: cb0cb5487b1e5bcb82547396b4fe93e5 236 example_1.0.orig-docs.tar.gz 599f47808a7754c66aea3cda1b3208d6 373 example_1.0.orig.tar.gz - 0e88c1ed094f09ee7bf57607132d55ee 1416 example_1.0-1+absurd.debian.tar.xz + ed26c7be15f59fafbacffb505365731a 1528 example_1.0-1+absurd.debian.tar.xz diff --git a/tests/pkg-srcs/example_1.0-1+brokenmeta.debian.tar.xz b/tests/pkg-srcs/example_1.0-1+brokenmeta.debian.tar.xz Binary files differnew file mode 100644 index 0000000..504bbb6 --- /dev/null +++ b/tests/pkg-srcs/example_1.0-1+brokenmeta.debian.tar.xz diff --git a/tests/pkg-srcs/example_1.0-1+brokenmeta.dsc b/tests/pkg-srcs/example_1.0-1+brokenmeta.dsc new file mode 100644 index 0000000..59d25ce --- /dev/null +++ b/tests/pkg-srcs/example_1.0-1+brokenmeta.dsc @@ -0,0 +1,22 @@ +Format: 3.0 (quilt) +Source: example +Binary: example +Architecture: all +Version: 1.0-1+brokenmeta +Maintainer: Ian Jackson <ijackson@chiark.greenend.org.uk> +Standards-Version: 3.9.4.0 +Build-Depends: debhelper (>= 8) +Package-List: + example deb devel extra arch=all +Checksums-Sha1: + 2bc730f941db49de57e9678fb0b07bd95507bb44 236 example_1.0.orig-docs.tar.gz + 4bff9170ce9b10cb59937195c5ae2c73719fe150 373 example_1.0.orig.tar.gz + 0b7117415e1b3c2e3a9084ef07872c95085ec0aa 1304 example_1.0-1+brokenmeta.debian.tar.xz +Checksums-Sha256: + ad9671f6b25cdd9f0573f803f702448a45a45183db1d79701aa760bccbeed29c 236 example_1.0.orig-docs.tar.gz + a3ef7c951152f3ec754f96fd483457aa88ba06df3084e6f1cc7c25b669567c17 373 example_1.0.orig.tar.gz + 9383ffabb2a169c252529f2dea098c55d0956fdadba34a8617bfbff47091ac7f 1304 example_1.0-1+brokenmeta.debian.tar.xz +Files: + cb0cb5487b1e5bcb82547396b4fe93e5 236 example_1.0.orig-docs.tar.gz + 599f47808a7754c66aea3cda1b3208d6 373 example_1.0.orig.tar.gz + 48308be2bfae98f989e724fb3c52b397 1304 example_1.0-1+brokenmeta.debian.tar.xz diff --git a/tests/pkg-srcs/example_1.0-1.100.debian.tar.xz b/tests/pkg-srcs/example_1.0-1.100.debian.tar.xz Binary files differindex ea8ec34..e193d4d 100644 --- a/tests/pkg-srcs/example_1.0-1.100.debian.tar.xz +++ b/tests/pkg-srcs/example_1.0-1.100.debian.tar.xz diff --git a/tests/pkg-srcs/example_1.0-1.100.dsc b/tests/pkg-srcs/example_1.0-1.100.dsc index 5b075b5..8c7c417 100644 --- a/tests/pkg-srcs/example_1.0-1.100.dsc +++ b/tests/pkg-srcs/example_1.0-1.100.dsc @@ -11,12 +11,12 @@ Package-List: Checksums-Sha1: 2bc730f941db49de57e9678fb0b07bd95507bb44 236 example_1.0.orig-docs.tar.gz 4bff9170ce9b10cb59937195c5ae2c73719fe150 373 example_1.0.orig.tar.gz - 86c31eba5e08c1765f8e557b97e59d7e1fd9c208 2108 example_1.0-1.100.debian.tar.xz + 94dbd51291d7534a9e50a2cebfb1f484999e877b 2156 example_1.0-1.100.debian.tar.xz Checksums-Sha256: ad9671f6b25cdd9f0573f803f702448a45a45183db1d79701aa760bccbeed29c 236 example_1.0.orig-docs.tar.gz a3ef7c951152f3ec754f96fd483457aa88ba06df3084e6f1cc7c25b669567c17 373 example_1.0.orig.tar.gz - 163f1a753f0ea382148df8d9553240d503781badf03c600946f1400534da1349 2108 example_1.0-1.100.debian.tar.xz + 1d76c05cc52b1bc517defb336b7d1e8e59651fc19cd6e303b88be45558adca08 2156 example_1.0-1.100.debian.tar.xz Files: cb0cb5487b1e5bcb82547396b4fe93e5 236 example_1.0.orig-docs.tar.gz 599f47808a7754c66aea3cda1b3208d6 373 example_1.0.orig.tar.gz - 4b7f5d286eff2608107c77c96584a01a 2108 example_1.0-1.100.debian.tar.xz + 7f30fd213f0e30613615b2c196c48635 2156 example_1.0-1.100.debian.tar.xz diff --git a/tests/pkg-srcs/example_1.0-1.debian.tar.xz b/tests/pkg-srcs/example_1.0-1.debian.tar.xz Binary files differindex 84ca563..4ff8b74 100644 --- a/tests/pkg-srcs/example_1.0-1.debian.tar.xz +++ b/tests/pkg-srcs/example_1.0-1.debian.tar.xz diff --git a/tests/pkg-srcs/example_1.0-1.dsc b/tests/pkg-srcs/example_1.0-1.dsc index bb65f6e..84f0f2e 100644 --- a/tests/pkg-srcs/example_1.0-1.dsc +++ b/tests/pkg-srcs/example_1.0-1.dsc @@ -11,12 +11,12 @@ Package-List: Checksums-Sha1: 2bc730f941db49de57e9678fb0b07bd95507bb44 236 example_1.0.orig-docs.tar.gz 4bff9170ce9b10cb59937195c5ae2c73719fe150 373 example_1.0.orig.tar.gz - f2398be1e588e10d11b20ee9bc5ca0eb16e4c158 1304 example_1.0-1.debian.tar.xz + 8d131c4fd924859e3462e48a33f669da15684992 1300 example_1.0-1.debian.tar.xz Checksums-Sha256: ad9671f6b25cdd9f0573f803f702448a45a45183db1d79701aa760bccbeed29c 236 example_1.0.orig-docs.tar.gz a3ef7c951152f3ec754f96fd483457aa88ba06df3084e6f1cc7c25b669567c17 373 example_1.0.orig.tar.gz - fd97c0fb879bfa8084f24a0d0f808a56beb533f17d92c808dc293ff297007925 1304 example_1.0-1.debian.tar.xz + 1bc840ae1b76b95ab375c962508a3b14f6958f9766e67c0ef06f5e7dd249d1c7 1300 example_1.0-1.debian.tar.xz Files: cb0cb5487b1e5bcb82547396b4fe93e5 236 example_1.0.orig-docs.tar.gz 599f47808a7754c66aea3cda1b3208d6 373 example_1.0.orig.tar.gz - fd7840d249ee3dba5bdc3dcde7217bbe 1304 example_1.0-1.debian.tar.xz + 593103737fe55b5fafcdc0eda5e7f761 1300 example_1.0-1.debian.tar.xz diff --git a/tests/pkg-srcs/pari-extra_3-1.diff.gz b/tests/pkg-srcs/pari-extra_3-1.diff.gz Binary files differindex 81f7f2e..3c3d568 100644 --- a/tests/pkg-srcs/pari-extra_3-1.diff.gz +++ b/tests/pkg-srcs/pari-extra_3-1.diff.gz diff --git a/tests/pkg-srcs/pari-extra_3-1.dsc b/tests/pkg-srcs/pari-extra_3-1.dsc index 8d67ed0..110dbb6 100644 --- a/tests/pkg-srcs/pari-extra_3-1.dsc +++ b/tests/pkg-srcs/pari-extra_3-1.dsc @@ -1,6 +1,3 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - Format: 1.0 Source: pari-extra Binary: pari-extra @@ -9,22 +6,14 @@ Version: 3-1 Maintainer: Bill Allombert <ballombe@debian.org> Standards-Version: 3.9.2.0 Build-Depends: debhelper (>= 5) -Package-List: - pari-extra deb math optional -Checksums-Sha1: +Package-List: + pari-extra deb math optional arch=all +Checksums-Sha1: ff281e103ab11681324b0c694dd3514d78436c51 121 pari-extra_3.orig.tar.gz - 080078dbc51e4194d209cb5abe57e2b25705fcaa 2358 pari-extra_3-1.diff.gz -Checksums-Sha256: + ca13e48c1b8e063bd33a8c897c44b2fa54c7b607 2357 pari-extra_3-1.diff.gz +Checksums-Sha256: ac1ef39f9da80b582d1c0b2adfb09b041e3860ed20ddcf57a0e922e3305239df 121 pari-extra_3.orig.tar.gz - bf4672acd5302b9eebee2f3bf5269022279e531204d7172b8761bb10fae3517a 2358 pari-extra_3-1.diff.gz -Files: + 90b5f4bdda25d1bf39530cc14310f51d88c8696eef2589f4a7f5991596fe7b1d 2357 pari-extra_3-1.diff.gz +Files: 76bcf03be979d3331f9051aa88439b8b 121 pari-extra_3.orig.tar.gz - 02a39965adb84da9b3e6b5c5a0a4c378 2358 pari-extra_3-1.diff.gz - ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.10 (GNU/Linux) - -iEYEARECAAYFAk5CvdoACgkQeDPs8bVESBX0mACeK3Yf9y22T2b6tw8eVQ8XSYxH -ix4AoJJ3jrGJ4HXJNv/wbvmvBkkybvYJ -=hkic ------END PGP SIGNATURE----- + 264a508299ea6d57c6a386e26d9d6f49 2357 pari-extra_3-1.diff.gz diff --git a/tests/pkg-srcs/pari-extra_3-2~dummy1.diff.gz b/tests/pkg-srcs/pari-extra_3-2~dummy1.diff.gz Binary files differindex f5dff2b..a793172 100644 --- a/tests/pkg-srcs/pari-extra_3-2~dummy1.diff.gz +++ b/tests/pkg-srcs/pari-extra_3-2~dummy1.diff.gz diff --git a/tests/pkg-srcs/pari-extra_3-2~dummy1.dsc b/tests/pkg-srcs/pari-extra_3-2~dummy1.dsc index 1042f09..a55a751 100644 --- a/tests/pkg-srcs/pari-extra_3-2~dummy1.dsc +++ b/tests/pkg-srcs/pari-extra_3-2~dummy1.dsc @@ -6,14 +6,14 @@ Version: 3-2~dummy1 Maintainer: Bill Allombert <ballombe@debian.org> Standards-Version: 3.9.2.0 Build-Depends: debhelper (>= 5), package-does-not-exist -Package-List: - pari-extra deb math optional -Checksums-Sha1: +Package-List: + pari-extra deb math optional arch=all +Checksums-Sha1: ff281e103ab11681324b0c694dd3514d78436c51 121 pari-extra_3.orig.tar.gz - 810c43d186ad2552d65949acf4a065fcfc823636 2484 pari-extra_3-2~dummy1.diff.gz -Checksums-Sha256: + 335afa3b9e4b671a67d00e699be080df44fe08fa 2486 pari-extra_3-2~dummy1.diff.gz +Checksums-Sha256: ac1ef39f9da80b582d1c0b2adfb09b041e3860ed20ddcf57a0e922e3305239df 121 pari-extra_3.orig.tar.gz - 41f47f24df7f50555f43549bd8377cce046750d29f69903e04b7fbfe396a0a73 2484 pari-extra_3-2~dummy1.diff.gz -Files: + 2365210b7a21a28659747188464ae1b5869accc714212f6d5d0c6632899c2ca0 2486 pari-extra_3-2~dummy1.diff.gz +Files: 76bcf03be979d3331f9051aa88439b8b 121 pari-extra_3.orig.tar.gz - eff09e2ace409a150646c4994f17f800 2484 pari-extra_3-2~dummy1.diff.gz + 5a4ffde2059a1c4c7280bf63ca99991d 2486 pari-extra_3-2~dummy1.diff.gz diff --git a/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.debian.tar.gz b/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.debian.tar.gz Binary files differdeleted file mode 100644 index 633e6db..0000000 --- a/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.debian.tar.gz +++ /dev/null diff --git a/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.debian.tar.xz b/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.debian.tar.xz Binary files differnew file mode 100644 index 0000000..30a8787 --- /dev/null +++ b/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.debian.tar.xz diff --git a/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.dsc b/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.dsc index 4f2e290..f840718 100644 --- a/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.dsc +++ b/tests/pkg-srcs/ruby-rails-3.2_3.2.6-1.dsc @@ -1,6 +1,3 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - Format: 3.0 (quilt) Source: ruby-rails-3.2 Binary: ruby-rails-3.2, rails3 @@ -8,30 +5,21 @@ Architecture: all Version: 3.2.6-1 Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers@lists.alioth.debian.org> Uploaders: Antonio Terceiro <terceiro@debian.org> -Dm-Upload-Allowed: yes Homepage: http://www.rubyonrails.org Standards-Version: 3.9.3 Vcs-Browser: http://git.debian.org/?p=pkg-ruby-extras/ruby-rails.git;a=summary Vcs-Git: git://git.debian.org/pkg-ruby-extras/ruby-rails-3.2.git Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.3.0~) -Package-List: - rails3 deb ruby optional - ruby-rails-3.2 deb ruby optional -Checksums-Sha1: +Package-List: + rails3 deb ruby optional arch=all + ruby-rails-3.2 deb ruby optional arch=all +Checksums-Sha1: f36c3866b22de8ff6875fdbbfbcfb8d18e1f5a89 953 ruby-rails-3.2_3.2.6.orig.tar.gz - 7208250afe7083e258d1fa36cc3a60527608df11 2297 ruby-rails-3.2_3.2.6-1.debian.tar.gz -Checksums-Sha256: + 5a6ca14c46eb4b9297f024675d43002751d560e7 2252 ruby-rails-3.2_3.2.6-1.debian.tar.xz +Checksums-Sha256: 207cfb1ef70aa9458c776deeda8e38ac977cbc852209828793b27d55bebc7bea 953 ruby-rails-3.2_3.2.6.orig.tar.gz - 55decdcdc8248a4153fb7e5688ffdc3c3a2661a95f3870edba3e1eaf40907088 2297 ruby-rails-3.2_3.2.6-1.debian.tar.gz -Files: + ab65b0fe41fff9abb87b538b5d526c2b47af27f784cf4cf2e8c01e399cde7b00 2252 ruby-rails-3.2_3.2.6-1.debian.tar.xz +Files: 05a3954762c2a2101a10dd2efddf7000 953 ruby-rails-3.2_3.2.6.orig.tar.gz - 87bdb28ef5053d825bda80e959e2fd1c 2297 ruby-rails-3.2_3.2.6-1.debian.tar.gz + e1c519bb58a39d01f4dc6828985057fe 2252 ruby-rails-3.2_3.2.6-1.debian.tar.xz Ruby-Versions: all - ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.12 (GNU/Linux) - -iEYEARECAAYFAk/nrgIACgkQDOM8kQ+cso9TjgCfcDl8MvUtKVZP6bPP9IrO93hP -TnAAn1aA67N088u6u/S2VA8UhYjNXhpO -=7sbS ------END PGP SIGNATURE----- diff --git a/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.debian.tar.gz b/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.debian.tar.gz Binary files differdeleted file mode 100644 index c376961..0000000 --- a/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.debian.tar.gz +++ /dev/null diff --git a/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.debian.tar.xz b/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.debian.tar.xz Binary files differnew file mode 100644 index 0000000..8ac2131 --- /dev/null +++ b/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.debian.tar.xz diff --git a/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.dsc b/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.dsc index e0161cd..820022d 100644 --- a/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.dsc +++ b/tests/pkg-srcs/sunxi-tools_1.2-2.~~dgittest.dsc @@ -9,14 +9,14 @@ Standards-Version: 3.9.5 Vcs-Browser: http://git.debian.org/?p=collab-maint/sunxi-tools.git Vcs-Git: git://git.debian.org/collab-maint/sunxi-tools.git Build-Depends: debhelper (>= 9), pkg-config, libusb-1.0-0-dev, u-boot-tools -Package-List: - sunxi-tools deb utils optional -Checksums-Sha1: +Package-List: + sunxi-tools deb utils optional arch=any +Checksums-Sha1: 2457216dbbf5552c413753f7211f7be3db6aff54 35076 sunxi-tools_1.2.orig.tar.gz - 6f30698cd897b350a4f92b2b5dded69adca6f82e 5182 sunxi-tools_1.2-2.~~dgittest.debian.tar.gz -Checksums-Sha256: + 491322a7e377365cf53104b5dda6a30ede0c01f7 4892 sunxi-tools_1.2-2.~~dgittest.debian.tar.xz +Checksums-Sha256: 03a63203ff79389e728d88ad705e546aa6362a6d08b9901392acb8639998ef95 35076 sunxi-tools_1.2.orig.tar.gz - 0a513f3254d245b59aaffbeb5c43159a6461617c1f6f3c6824646c4259cda406 5182 sunxi-tools_1.2-2.~~dgittest.debian.tar.gz -Files: + 33b627e8958f1bc6d2a9bf1d1a042ac808924d860c09272989067fd57b9fb8e6 4892 sunxi-tools_1.2-2.~~dgittest.debian.tar.xz +Files: dbc55f60559f9db497559176c3c753dd 35076 sunxi-tools_1.2.orig.tar.gz - a6ec0eb0d897b0121dc978fc00db2ea6 5182 sunxi-tools_1.2-2.~~dgittest.debian.tar.gz + 528d6bb421ba55aa1cec176298f8f14c 4892 sunxi-tools_1.2-2.~~dgittest.debian.tar.xz diff --git a/tests/run-all b/tests/run-all index 736e0fe..f827059 100755 --- a/tests/run-all +++ b/tests/run-all @@ -18,7 +18,7 @@ while [ $# != 0 ]; do done ncpus=$(nproc || echo 1) -jcpus=-j$(( ncpus * 134 / 100 )) +jcpus=-j$(( ncpus * 167 / 100 )) if [ "x$DGIT_TESTS_TMPDIR" != x ]; then tmpdir="$PWD" diff --git a/tests/setup/examplegit b/tests/setup/examplegit index 88f6178..2d4ce4f 100755 --- a/tests/setup/examplegit +++ b/tests/setup/examplegit @@ -16,7 +16,7 @@ push-to () { t-refs-same-start t-ref-head t-dgit build - t-dgit push --new $2 + t-dgit push-built --new $2 t-pushed-good $1 $2 t-archive-process-incoming $2 } @@ -50,4 +50,6 @@ push-to master sid git clean -xdff -t-setup-done 'p v suitespecs majorv revision' "aq git mirror $p" +t-setup-done 'v suitespecs majorv revision' "aq git mirror $p" " + t-select-package $p +" diff --git a/tests/setup/gbp b/tests/setup/gbp new file mode 100755 index 0000000..d8675fe --- /dev/null +++ b/tests/setup/gbp @@ -0,0 +1,48 @@ +#!/bin/bash +set -e +. tests/lib + +t-archive-none example +t-git-none +t-worktree 1.0 + +cd $p + +: '----- construct an unpatched branch with patches -----' + +git checkout patch-queue/quilt-tip +gbp pq export +: 'now on quilt-tip' +git add debian/patches +git commit -m 'Commit patch queue' + +: '----- construct an upstream branch -----' + +git checkout --orphan upstream +git reset --hard +git clean -xdf + +tar --strip-components=1 -xf $troot/pkg-srcs/${p}_1.0.orig.tar.gz + +mkdir docs +cd docs +tar --strip-components=1 -xf $troot/pkg-srcs/${p}_1.0.orig-docs.tar.gz +cd .. + +git add -Af . +git commit -m 'Import 1.0' +git tag upstream/1.0 + +git checkout quilt-tip +t-git-pseudo-merge -m 'gbp-orig pseudomerge' upstream + +v=1.0-1 + +git checkout -B master + +cd .. + +t-setup-done 'v' "$(echo $p*) git mirror aq" ' + t-select-package example + t-git-next-date +' diff --git a/tests/setup/http-git-check b/tests/setup/http-git-check new file mode 100755 index 0000000..0e3b7c2 --- /dev/null +++ b/tests/setup/http-git-check @@ -0,0 +1,15 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies libhttp-server-simple-static-perl + +t-setup-done '' --files-from=/dev/null ' + $troot/http-static-server >$tmp/must-clean/git-check.port $tmp/git + read <$tmp/must-clean/git-check.port git_check_port + + t-git-config --global dgit-distro.test-dummy.git-check url + t-git-config --global dgit-distro.test-dummy.git-check-suffix .git/HEAD + t-git-config --global dgit-distro.test-dummy.git-check-url \ + http://127.0.0.1:$git_check_port +' diff --git a/tests/tests/alternating-dgit b/tests/tests/alternating-dgit new file mode 100755 index 0000000..c2ada5c --- /dev/null +++ b/tests/tests/alternating-dgit @@ -0,0 +1,25 @@ +#!/bin/bash +set -e +. tests/lib + +t-setup-import examplegit +t-setup-import http-git-check + +cd $p + +git checkout -b nondgit +t-commit 'non-dgit upload' +t-non-dgit-upload + +cd .. + +t-dgit clone $p ./$p.2 +cd $p.2 + +t-commit 'now a dgit upload again' + +t-dgit -wgf push-source +t-refs-same-start +t-pushed-good dgit/sid + +t-ok diff --git a/tests/tests/badcommit-rewrite b/tests/tests/badcommit-rewrite deleted file mode 100755 index 3e2f37e..0000000 --- a/tests/tests/badcommit-rewrite +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -set -e -. tests/lib - -t-setup-import examplegit -t-tstunt-parsechangelog - -cd $tmp/git/$p.git -git config core.sharedRepository true -chmod -R g+w objects -umask 022 - -cd $tmp/example - -suite=stable - -t-commit 'No changes, just send to stable' '' stable - -t-make-badcommit -git reset --hard $badcommit - -t-dgit -wgf build -t-dgit push --overwrite=1.2 stable -t-archive-process-incoming stable - -rstable=refs/remotes/dgit/dgit/stable - -t-dgit fetch stable -t-has-parent-or-is $rstable $badcommit - -fixup=${DGIT_BADCOMMIT_FIXUP-dgit-badcommit-fixup} - -cd $tmp/git/$p.git -git gc --aggressive --prune=all -rmdir objects/* ||: - -$fixup --real - -cd $tmp/$p -git symbolic-ref HEAD >../sym.before -git rev-parse HEAD >../ref.before - -$fixup --real - -git symbolic-ref HEAD >../sym.after -git rev-parse HEAD >../ref.after -diff ../sym.before ../sym.after -set +e; diff ../ref.before ../ref.after; rc=$?; set -e; test $rc = 1 - -t-dgit fetch stable - -t-expect-fail "child $rstable lacks parent $badcommit" \ -t-has-parent-or-is $rstable $badcommit - -check_shared () { - find "$1" -perm -200 \! -perm -020 -ls |tee $tmp/badperm - test -f $tmp/badperm -a ! -s $tmp/badperm -} - -check_shared $tmp/git/$p.git/objects - -t-ok diff --git a/tests/tests/clone-gitnosuite b/tests/tests/clone-gitnosuite index 83c996d..b85efdb 100755 --- a/tests/tests/clone-gitnosuite +++ b/tests/tests/clone-gitnosuite @@ -2,6 +2,8 @@ set -e . tests/lib +t-setup-import http-git-check + t-archive pari-extra 3-1 t-git-none cp -a $tmp/git/_template $dgitrepo diff --git a/tests/tests/clone-nogit b/tests/tests/clone-nogit index e99dac3..9dceafc 100755 --- a/tests/tests/clone-nogit +++ b/tests/tests/clone-nogit @@ -2,6 +2,8 @@ set -e . tests/lib +t-setup-import http-git-check + t-archive pari-extra 3-1 t-git-none @@ -17,8 +19,7 @@ debcommit -a t-refs-same-start t-ref-head -t-dgit --dpkg-buildpackage:-d build -t-dgit push +t-dgit push-source t-pushed-good dgit/sid diff --git a/tests/tests/clone-skew b/tests/tests/clone-skew new file mode 100755 index 0000000..dd51acd --- /dev/null +++ b/tests/tests/clone-skew @@ -0,0 +1,35 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies libhttp-server-simple-static-perl + +$troot/http-static-server >$tmp/must-clean/mirror.port $tmp/mirror +read <$tmp/must-clean/mirror.port mirror_port + +t-git-config --global dgit-distro.test-dummy.mirror \ + http://127.0.0.1:$mirror_port/ + +t_archive_ln_s=cp + +t-archive example 1.0-1 +t-git-none + +perl -i -ne ' + print or die $!; + s/1.0-1/1.0-1+0.1/g; + s/ \w/ sprintf " %x", $& ^ 1 /e; + print or die $!; +' $tmp/aq/package.sid.$p +t-aq-archive-updated sid $p + +LC_MESSAGES=C \ +t-dgit clone $p 2>&1 |tee got.message + +grep 'Warning: archive skew detected.' got.message +egrep 'We were able to obtain only *1.0-1$' got.message + +cd $p +t-cloned-fetched-good + +t-ok diff --git a/tests/tests/debpolicy-dbretry b/tests/tests/debpolicy-dbretry index a9f2334..421dee2 100755 --- a/tests/tests/debpolicy-dbretry +++ b/tests/tests/debpolicy-dbretry @@ -20,7 +20,7 @@ git reset --hard HEAD~ t-commit 'Make something to autotaint' t-dgit build -t-dgit push --new +t-dgit push-built --new autotaint=`t-git-get-ref "refs/tags/$tagpfx/$v"` @@ -55,7 +55,7 @@ DGIT_RPD_TEST_DBLOOP_HOOK=' '\'' and die "$? $!"; } ' \ -t-dgit push --deliberately-not-fast-forward +t-dgit push-built --deliberately-not-fast-forward exec 3>&- wait $sqlite3_pid diff --git a/tests/tests/debpolicy-newreject b/tests/tests/debpolicy-newreject index 1fa6751..bc084ae 100755 --- a/tests/tests/debpolicy-newreject +++ b/tests/tests/debpolicy-newreject @@ -12,6 +12,8 @@ revision=1 git tag start t-dgit setup-mergechangelogs +git config dgit.default.push-subcmd built + echo FORBIDDEN >debian/some-file git add debian/some-file t-commit 'Commit a forbidden thing' @@ -25,7 +27,8 @@ t-git-objects-not-present "" $bad ' t-dgit build -t-expect-push-fail 'forbidden for testing' \ +t-expect-push-fail-tainted \ + 'Reason: forbidden for testing' \ t-dgit push --new t-git-dir-check enoent @@ -51,13 +54,15 @@ t-git-dir-check enoent t-commit 'should require --deliberately...questionable' t-dgit build -t-expect-push-fail E:"tag $tagpfx/${vanished//./\\.} referred to this object.*all previously pushed versions were found to have been removed" \ +t-expect-push-fail-tainted \ + "Reason: tag $tagpfx/${vanished//./\\.} referred to this object.*all previously pushed versions were found to have been removed" \ t-dgit push --new t-git-dir-check enoent vanished=$v -t-dgit push --new --deliberately-include-questionable-history +t-dgit push --new --deliberately-include-questionable-history \ + --force-reusing-version t-git-dir-check secret t-policy-periodic @@ -74,27 +79,32 @@ git reset --hard start t-commit 'should require --deliberately..not-ff' t-dgit build -t-expect-push-fail "HEAD is not a descendant of the archive's version" \ +# Rewound, without passing the option +t-expect-push-fail-retriably \ + E:"^dgit: error: .* HEAD is not a descendant of the archive's version" \ t-dgit push +# Rewound, passing stunt option to defeat local checks +# so we check that remote check is effective. t-expect-push-fail \ - "Package is in NEW and has not been accepted or rejected yet" \ + E:"^remote: Package is in NEW and has not been accepted or rejected yet" \ t-dgit --deliberately-TEST-dgit-only-not-fast-forward push -t-dgit --deliberately-not-fast-forward push +t-dgit --deliberately-not-fast-forward --force-reusing-version push cd $dgitrepo -t-expect-push-fail "Not a valid object name" \ +t-expect-fail "Not a valid object name" \ git cat-file -p $oldobj cd $tmp/$p t-commit 'Still not accepted, will override taint' t-dgit build -t-expect-push-fail \ +t-expect-push-fail-tainted \ "Package is in NEW and has not been accepted or rejected yet" \ t-dgit push -t-dgit push --deliberately-include-questionable-history +t-dgit push --deliberately-include-questionable-history \ + --force-reusing-version t-archive-process-incoming sid @@ -105,17 +115,30 @@ t-dgit push git checkout -b stoats $tagpfx/$vanished t-commit 'Simulate accidentally building on rejected version' t-dgit build -t-expect-push-fail "HEAD is not a descendant of the archive's version" \ +t-expect-push-fail \ + E:"^dgit: error:.* HEAD is not a descendant of the archive's version" \ t-dgit push : "check that uploader can't force it now" -t-expect-push-fail "not fast forward on dgit branch" \ -t-dgit --deliberately-not-fast-forward push +t-expect-push-fail \ + E:"^remote: .*: reject: not fast forward on dgit branch" \ +t-dgit --deliberately-not-fast-forward push \ + --deliberately-include-questionable-history \ + --force-push-tainted +# Ideally ^ this would be detected locally first, in which case we would +# use t-expect-push-fail-tainted or something like it. But it isn't. t-dgit pull t-dgit build -t-expect-push-fail \ +t-expect-push-fail-tainted \ 'Reason: rewound suite sid; --deliberately-not-fast-forward specified' \ -t-dgit push +t-dgit --force-reusing-version push + +: "override the previous taint check" +t-dgit --force-reusing-version push-source \ + --deliberately-include-questionable-history + +t-commit 'Check taint is truly gone' +t-dgit push-source t-ok diff --git a/tests/tests/debpolicy-taintrm b/tests/tests/debpolicy-taintrm index 8655fb5..eccc290 100755 --- a/tests/tests/debpolicy-taintrm +++ b/tests/tests/debpolicy-taintrm @@ -17,6 +17,12 @@ t-dgit setup-mergechangelogs t-dgit push-source --new +t-commit 'edit after first push' + +t-expect-push-fail-tainted \ + 'Package is in NEW and has not been accepted or rejected yet' \ +t-dgit push-source --new + : cut rm $tmp/incoming/* @@ -31,11 +37,17 @@ t-commit 'edit after cut' : push, needs --deliberately -t-expect-push-fail \ - 'all previously pushed versions were found to have been removed from NEW' \ +t-expect-push-fail-tainted \ + 'Reason:.* all previously pushed versions were found to have been removed from NEW' \ t-dgit push-source --new -t-dgit push-source --new --deliberately-include-questionable-history +t-expect-push-fail-tainted \ + 'Reason:.* all previously pushed versions were found to have been removed from NEW' \ +t-dgit push-source --new --deliberately-not-fast-forward \ + --force-reusing-version + +t-dgit push-source --new --deliberately-include-questionable-history \ + --force-reusing-version t-archive-process-incoming new diff --git a/tests/tests/distropatches-reject b/tests/tests/distropatches-reject index 75f43db..58c62ce 100755 --- a/tests/tests/distropatches-reject +++ b/tests/tests/distropatches-reject @@ -9,7 +9,7 @@ cp $troot/pkg-srcs/${p}_3.2.6.orig.tar.gz . t-worktree test cd $p -t-dgit --quilt=smash -wgf quilt-fixup +t-dgit --quilt=try-linear -wgf quilt-fixup build () { t-dgit -wg --dpkg-buildpackage:-d build @@ -64,9 +64,9 @@ build DEB_VENDOR=test-dummy-aside \ expect-fail-distro-series DEB_VENDOR \ -t-dgit push +t-dgit push-built -t-dgit push +t-dgit push-built cd .. perl -i~ -pe 's/^Dgit:.*\n//' incoming/${p}_${v}.dsc diff --git a/tests/tests/dpkgsourceignores-correct b/tests/tests/dpkgsourceignores-correct index 33de95e..f3d70fa 100755 --- a/tests/tests/dpkgsourceignores-correct +++ b/tests/tests/dpkgsourceignores-correct @@ -48,6 +48,6 @@ git add . git commit -m 'want these' t-dgit --quilt=smash -wgf build-source -t-dgit -wgf push +t-dgit --force-uploading-old-version -wgf push-built t-ok diff --git a/tests/tests/drs-push-masterupdate b/tests/tests/drs-push-masterupdate index 8457b59..7135467 100755 --- a/tests/tests/drs-push-masterupdate +++ b/tests/tests/drs-push-masterupdate @@ -13,7 +13,7 @@ git tag common-ancestor revision=1 t-dgit build -t-dgit push --new +t-dgit push-built --new push_and_check () { git push $dgitrepo $1 @@ -24,7 +24,7 @@ push_and_check () { git checkout master t-commit 'Empty update' t-dgit build - t-dgit push --new + t-dgit push-built --new t-pushed-good master } diff --git a/tests/tests/drs-push-rejects b/tests/tests/drs-push-rejects index f102d95..72db5a9 100755 --- a/tests/tests/drs-push-rejects +++ b/tests/tests/drs-push-rejects @@ -76,7 +76,7 @@ for h in object type tag; do rc=$? set -e - if [ $rc = 128 ] && grep 'fatal: corrupt tag' badtag.err; then + if [ $rc = 128 ] && egrep 'fatal: corrupt tag|error: object fails fsck: missing.*Entry: invalid format' badtag.err; then continue elif [ $rc != 0 ]; then cat badtag.err @@ -144,11 +144,23 @@ mktag mustfail 'tag name in tag is wrong' \ refs/tags/$tagpfx/wombat:refs/tags/$tagpfx/$version $push_spec1 -t-make-badcommit -git checkout -b broken $badcommit -prep unstable sid -mktag -mustfail "corrupted object $badcommit" $push_spec +set +e +badcommit=$( + set -e + LC_MESSAGES=C t-make-badcommit 2>badcommit.err + echo "$badcommit" +) +rc=$? +set -e +if [ $rc = 0 ]; then + git checkout -b broken $badcommit + prep unstable sid + mktag + mustfail "corrupted object $badcommit" $push_spec +elif [ $rc = 128 ] && egrep 'error: object fails fsck: missingCommitter: invalid format' badcommit.err; then :; else + cat badcommit.err + fail "could not bad commit" +fi git checkout dgit/sid prep unstable sid diff --git a/tests/tests/fetch-somegit-notlast b/tests/tests/fetch-somegit-notlast index 63abe8a..4e42aa3 100755 --- a/tests/tests/fetch-somegit-notlast +++ b/tests/tests/fetch-somegit-notlast @@ -10,6 +10,6 @@ t-dgit clone $p cd $p t-cloned-fetched-good -t-has-ancestor debian/3-1 +t-has-ancestor test-dummy/3-1 t-ok diff --git a/tests/tests/forcesplit-overwrite b/tests/tests/forcesplit-overwrite index 9600d3a..5826287 100755 --- a/tests/tests/forcesplit-overwrite +++ b/tests/tests/forcesplit-overwrite @@ -7,8 +7,7 @@ set -e t-setup-import examplegit -t-select-package example -cd example +cd $p suite=stable diff --git a/tests/tests/ftpmasterapi-http b/tests/tests/ftpmasterapi-http new file mode 100755 index 0000000..818a974 --- /dev/null +++ b/tests/tests/ftpmasterapi-http @@ -0,0 +1,19 @@ +#!/bin/bash +set -e +. tests/lib + +t-archive-none example + +t-dependencies libhttp-server-simple-static-perl + +$troot/http-static-server >$tmp/must-clean/api.port $tmp/aq + +read <$tmp/must-clean/api.port api_port + +t-git-config --global dgit-distro.test-dummy.archive-query ftpmasterapi: +t-git-config --global dgit-distro.test-dummy.archive-query-url \ + http://127.0.0.1:$api_port/ + +t-dgit archive-api-query suites + +t-ok diff --git a/tests/tests/gbp-orig b/tests/tests/gbp-orig index 9a4937c..15516c5 100755 --- a/tests/tests/gbp-orig +++ b/tests/tests/gbp-orig @@ -2,49 +2,19 @@ set -e . tests/lib -t-tstunt-parsechangelog -t-tstunt-debuild -t-tstunt-lintian - -t-archive-none example -t-git-none -t-worktree 1.0 +t-setup-import gbp cd $p -: '----- construct an unpatched branch with patches -----' - -git checkout patch-queue/quilt-tip -gbp pq export -: 'now on quilt-tip' -git add debian/patches -git commit -m 'Commit patch queue' - -: '----- construct an upstream branch -----' - -git checkout --orphan upstream -git reset --hard -git clean -xdf - -tar --strip-components=1 -xf $troot/pkg-srcs/${p}_1.0.orig.tar.gz - -mkdir docs -cd docs -tar --strip-components=1 -xf $troot/pkg-srcs/${p}_1.0.orig-docs.tar.gz -cd .. - -git add -Af . -git commit -m 'Import 1.0' -git tag upstream/1.0 - -git checkout quilt-tip -t-git-pseudo-merge -m 'gbp-orig pseudomerge' upstream +t-tstunt-parsechangelog +t-tstunt-debuild +t-tstunt-lintian -v=1.0-1 +git config --global diff.noprefix true : '----- let gbp build a .orig for comparison -----' -gbp buildpackage --git-ignore-branch --git-no-sign-tags -us -uc +gbp buildpackage --git-no-sign-tags -us -uc mkdir ../gbp-output mv ../*1.0* ../gbp-output/. @@ -56,7 +26,7 @@ t-dgit -wgf --dgit-view-save=split.b gbp-build --git-ignore-branch t-dgit -wgf --quilt=gbp clean # gbp leaves dirty trees :-/ -t-dgit -wgf --dgit-view-save=split.p --quilt=gbp push --new +t-dgit -wgf --dgit-view-save=split.p --quilt=gbp push-built --new t-gbp-pushed-good diff --git a/tests/tests/gdr-edits b/tests/tests/gdr-edits index 0bdf15f..c37e9c9 100755 --- a/tests/tests/gdr-edits +++ b/tests/tests/gdr-edits @@ -7,6 +7,8 @@ t-dependencies GDR t-tstunt-parsechangelog t-setup-import gdr-convert-gbp +git config --global init.defaultBranch trunk + cd $p v=2.0-3 @@ -27,6 +29,9 @@ t-gdr-good laundered t-dgit push-source t-gdr-good pushed-interop +t-expect-fail E:'add a new changelog stanza.*and try again' \ +t-dgit push-source + git branch before-noop t-git-next-date diff --git a/tests/tests/gdr-fresh b/tests/tests/gdr-fresh index 169181c..642aacc 100755 --- a/tests/tests/gdr-fresh +++ b/tests/tests/gdr-fresh @@ -25,21 +25,22 @@ git commit -m 'initial debianisation' t-make-orig example 1.0 -dgit-quilt-fixup-uses-gdr () { +dgit-quilt-fixup-uses-dgit-linear () { t-git-next-date DGIT_TEST_DEBUG=-DD t-dgit quilt-fixup 2>&1 |tee ../fixup.out - grep '^branch_is_gdr .* YES$' ../fixup.out + grep '^branch_is_gdr .* unmarked BreakwaterStart NO$' ../fixup.out + + t-dgit --quilt=nofix quilt-fixup } -dgit-quilt-fixup-uses-gdr +dgit-quilt-fixup-uses-dgit-linear git checkout --detach patch-queue/quilt-tip git rebase master git push . HEAD:master git checkout master -dgit-quilt-fixup-uses-gdr -t-gdr-made-patches +dgit-quilt-fixup-uses-dgit-linear t-ok diff --git a/tests/tests/gdr-import-dgit b/tests/tests/gdr-import-dgit index e58ff32..1050f72 100755 --- a/tests/tests/gdr-import-dgit +++ b/tests/tests/gdr-import-dgit @@ -6,6 +6,7 @@ t-dependencies GDR t-tstunt-parsechangelog t-setup-import gdr-convert-gbp +t-setup-import http-git-check cd $p diff --git a/tests/tests/gdr-import-dgitview b/tests/tests/gdr-import-dgitview index 18d06f5..f761b02 100755 --- a/tests/tests/gdr-import-dgitview +++ b/tests/tests/gdr-import-dgitview @@ -25,20 +25,26 @@ grep 'bare dgit dsc import with no prior history' ../bare-output git branch before t-expect-fail E:'Could not find or construct a suitable upstream commit' \ -t-git-debrebase convert-from-dgit-view --no-origs +t-git-debrebase convert-from-dgit-view $GDR_DIAGNOSE --no-origs -t-git-debrebase convert-from-dgit-view +t-git-debrebase convert-from-dgit-view $GDR_DIAGNOSE t-gdr-good laundered t-expect-fail E:'already seems to be in git-debrebase format' \ -t-git-debrebase convert-from-dgit-view +t-git-debrebase convert-from-dgit-view $GDR_DIAGNOSE t-refs-same-start t-ref-head -t-git-debrebase --noop-ok convert-from-dgit-view +t-git-debrebase --noop-ok convert-from-dgit-view $GDR_DIAGNOSE t-ref-head -t-git-debrebase -falready-converted convert-from-dgit-view \ +t-expect-fail E:'Output of conversion does not match input' \ +t-git-debrebase -falready-converted convert-from-dgit-view $GDR_DIAGNOSE \ + --always-convert-anyway + +t-git-debrebase make-patches + +t-git-debrebase -falready-converted convert-from-dgit-view $GDR_DIAGNOSE \ --always-convert-anyway t-expect-fail E:'ref varies' t-ref-head t-gdr-good laundered diff --git a/tests/tests/gdr-import-nostitch b/tests/tests/gdr-import-nostitch index c32b71e..3833c2e 100755 --- a/tests/tests/gdr-import-nostitch +++ b/tests/tests/gdr-import-nostitch @@ -25,6 +25,6 @@ t-git-debrebase -fupstream-has-debian -funused-patches -fseries-comments \ convert-from-gbp \ 2>&1 | tee ../convert-msg -grep -e 'dgit --overwrite will be needed' ../convert-msg >/dev/null +grep -e 'dgit --trust-changelog will be needed' ../convert-msg >/dev/null t-ok diff --git a/tests/tests/gdr-merge-conflicts b/tests/tests/gdr-merge-conflicts index 5a3f243..05b5480 100755 --- a/tests/tests/gdr-merge-conflicts +++ b/tests/tests/gdr-merge-conflicts @@ -63,8 +63,8 @@ git merge --no-edit -s ours other # we have to do a little dance to make this not a pseudomerge t-git-next-date -dch -a 'Merge, only conflict was in debian/changelog' -t-dch-r-rune dch +t-debchange -a 'Merge, only conflict was in debian/changelog' +t-dch-r-rune t-debchange git commit -a --amend --no-edit wreckage-before diff --git a/tests/tests/gitworktree b/tests/tests/gitworktree index e675a0a..e8963b7 100755 --- a/tests/tests/gitworktree +++ b/tests/tests/gitworktree @@ -22,8 +22,6 @@ git add modification git commit -m 'want this' t-dgit -wgf quilt-fixup -t-dgit -wgf --quilt=nofix build - -t-dgit -wgf push +t-dgit -wgf --quilt=nofix push-source --force-uploading-old-version t-ok diff --git a/tests/tests/i18n-messages b/tests/tests/i18n-messages index f2aaa87..babcff1 100755 --- a/tests/tests/i18n-messages +++ b/tests/tests/i18n-messages @@ -3,7 +3,7 @@ set -e autoimport= . tests/lib -t-dependencies NO-DGIT GDR +t-dependencies NO-DGIT GDR locales-all t-restrict x-dgit-out-of-tree-only # We don't run this test in-tree because: # 1. The .mo files that we would use might need to be built @@ -31,6 +31,7 @@ git checkout master anchor=$(t-git-debrebase anchor) +expect_fail_lcmessages=C.UTF-8 t-expect-fail F:'old anchor is recognised' \ t-git-debrebase --anchor=$anchor new-upstream 2.1 diff --git a/tests/tests/import-dsc b/tests/tests/import-dsc index 4a8d876..768bd8c 100755 --- a/tests/tests/import-dsc +++ b/tests/tests/import-dsc @@ -64,6 +64,10 @@ t-dgit import-dsc $dsc2 ..$branch t-dgit import-dsc $dsc2 +$branch check-imported $dsc2 +dsc3=$troot/pkg-srcs/example_1.0-1+brokenmeta.dsc +t-dgit import-dsc $dsc3 +$branch +check-imported $dsc3 + cd .. mkdir $p.2 cd $p.2 diff --git a/tests/tests/import-linkorigs b/tests/tests/import-linkorigs index 815f960..ff0d816 100755 --- a/tests/tests/import-linkorigs +++ b/tests/tests/import-linkorigs @@ -3,6 +3,8 @@ set -e . tests/lib . $troot/lib-import-chk +t-dependencies xz-utils + t-tstunt-parsechangelog t-archive-none example @@ -58,3 +60,17 @@ for bpdhow in none rel abs; do cd ../.. done done + +rm -rf dupes +cp -a rel-rel dupes +cd dupes +orig=${p}_${v%-*}.orig.tar +zcat bpd/$orig.gz | xz -1 >$orig.xz +cd $p + +ls -al ../bpd + +t-expect-fail 'Duplicate/inconsistent orig tarballs' \ +t-dgit build-source + +t-ok diff --git a/tests/tests/import-pushold b/tests/tests/import-pushold new file mode 100755 index 0000000..ed73fa3 --- /dev/null +++ b/tests/tests/import-pushold @@ -0,0 +1,37 @@ +#!/bin/bash +set -e +. tests/lib + +t-tstunt-parsechangelog + +p=example +old=1.0-1 +current=1.0-1.100 + +t-archive $p $current +t-git-none + +mkdir $p +cd $p +git init +t-dgit import-dsc $troot/pkg-srcs/${p}_${old}.dsc main +git checkout main + +t-dgit fetch + +: "attempt push of old" + +t-expect-fail 'trying to push an old version' \ +t-dgit push-source --deliberately-not-fast-forward --overwrite + +: "attempt push of current" + +t-dgit checkout sid + +t-expect-fail 'trying to push an old version' \ +t-dgit push-source --deliberately-not-fast-forward --overwrite + +t-dgit push-source --force-uploading-old-version +t-pushed-good dgit/sid + +t-ok diff --git a/tests/tests/import-r1clog b/tests/tests/import-r1clog new file mode 100755 index 0000000..80044aa --- /dev/null +++ b/tests/tests/import-r1clog @@ -0,0 +1,94 @@ +#!/bin/bash +set -e +. tests/lib + +p=sunxi-tools +v_upstr=1.2 +v_base=$v_upstr-2 +v_input=$v_base.~~dgittest + +dpkg-source -x $troot/pkg-srcs/${p}_${v_input}.dsc unmang + +mkdir $p +cd $p +git init +cd .. + +perl-i-clog () { + perl -i "$@" debian/changelog +} + +mangle-start () { + mang=$1 + v="$v_base.$mang" + cp -al unmang $mang + cd $mang + perl-i-clog -pe 's{\~\~dgittest}{'$mang'} if $.==1' + cat >>debian/changelog <<'END' + +sunxi-tools (1.0-1) unstable; urgency=medium + + * Lies for dgit testing + + -- Example <example@example.org> Sat, 12 Jul 2011 20:51:56 +0100 +END +} +mangle-import () { + rm -f debian/*~ + dpkg-source -b . + cd ../$p + t-dgit import-dsc ../${p}_${v}.dsc $mang + git checkout $mang +} +mangle-done () { + cd .. +} + +mangle-start good +mangle-import + +: ---------- 'check that if all is well we make right author line' ---------- + +perl -ne <debian/changelog ' + next unless m{^'$p' \('$v_upstr'-1\) }...m{^\S}; + next unless m{^ -- (.*) (.*) ([-+]\d+)}; + $time_t = `date -d "$2 $3" +%s`; + chomp $time_t; + $authline = "$1 $time_t $3"; + print "author $authline\n"; + print "committer $authline\n"; + exit 0; +' >../headlines-exp +ch=$(git log -P --grep '^\[dgit import orig ' --pretty='format:%H') +git cat-file commit $ch | +perl -ne 'next if m/^$/..0; print if m/^(?:author|committer) /' \ + >../headlines-got-orig +diff ../headlines-exp ../headlines-got-orig + +mangle-done + +: ---------- 'test missing finalisation data in -1' ---------- + +mangle-start missingdate +perl-i-clog -pe '$_="" if m{^ -- .* Sat, 12 Jul 2014 20:51:56}' +mangle-import +mangle-done + +: ---------- 'test garbage before -1' ---------- + +mangle-start garbage +perl-i-clog -ne '$_ = "GARBAGE\n" if (m{^\S} && $. != 1) .. 0; print;' +mangle-import +mangle-done + +: ---------- 'test malformed authline' ---------- + +mangle-start bademail +# This causes the output syntax check in clogp_authline to trip; +# (that's the one which is intended to stop us feeding bad data to git). +perl-i-clog -pe ' + next unless m{^ -- .* Sat, 12 Jul 2014 20:51:56.*}; + s{^([^<]+) }{ -- cause <things to choke> }; +' +mangle-import +mangle-done diff --git a/tests/tests/manpages-format b/tests/tests/manpages-format index ce9d4dc..ee51dd7 100755 --- a/tests/tests/manpages-format +++ b/tests/tests/manpages-format @@ -22,14 +22,18 @@ run_man () { eval "$cmd 2>&1 >/dev/null |tee $errs" } +cat >$tmp/always-expected <<'END' +ERROR.* +END + for roff in $manpages; do for fmt in txt ps; do - >$tmp/$roff.$fmt-expected + cat $tmp/always-expected >$tmp/$roff.$fmt-expected done done expected () { - cat >$tmp/$2.$1-expected + cat >>$tmp/$2.$1-expected } not_egrep_vxPf () { @@ -49,7 +53,6 @@ not_egrep_vxPf () { } expected txt dgit.1 <<'END' -.* # table wider than line width END prep () { diff --git a/tests/tests/mirror b/tests/tests/mirror index 4947688..cedaf56 100755 --- a/tests/tests/mirror +++ b/tests/tests/mirror @@ -17,7 +17,7 @@ t-mirror-setup cd $p revision=1 t-dgit build -t-dgit push --new +t-dgit push-built --new t-check-mirrored @@ -31,7 +31,9 @@ set -ex : $sentinel cat >&2 $sentinel shift # eat HOST -sh -c "\$*" +export SSH_ORIGINAL_COMMAND="\$*" +exec \${DGIT_MIRROR_SSH_WRAP_TEST-dgit-mirror-ssh-wrap} \ + '$tmp/git-mirror/' .git -- END chmod +x $tmp/stunt-ssh diff --git a/tests/tests/mirror-debnewgit b/tests/tests/mirror-debnewgit index 59b96ef..3015d0e 100755 --- a/tests/tests/mirror-debnewgit +++ b/tests/tests/mirror-debnewgit @@ -20,7 +20,7 @@ t-cloned-fetched-good t-commit 'test commit' 3-2 t-dgit build -t-dgit push +t-dgit push-built t-check-mirrored t-ok diff --git a/tests/tests/mirror-private b/tests/tests/mirror-private index 1e885ae..eaf3dad 100755 --- a/tests/tests/mirror-private +++ b/tests/tests/mirror-private @@ -17,8 +17,7 @@ revision=1 t-reporefs master -t-dgit build -t-dgit push --new +t-dgit push-source --new t-check-not-mirrored t-files-notexist $reposmirror/$p.* diff --git a/tests/tests/mismatches-contents b/tests/tests/mismatches-contents index ea0d724..20bf980 100755 --- a/tests/tests/mismatches-contents +++ b/tests/tests/mismatches-contents @@ -11,7 +11,7 @@ ln -s $troot/pkg-srcs/${p}_${v%-*}.orig.tar.* . cd $p v=1.0-1 -dch -v $v -D unstable -m 'Make a revision' +t-debchange -v $v -D unstable -m 'Make a revision' echo foo >us-file git add us-file debian/changelog git commit -m "Commit $v" @@ -19,6 +19,6 @@ git commit -m "Commit $v" t-dgit build-source t-expect-fail 'debian/TRASH' \ -t-dgit push --new +t-dgit push-built --new t-ok diff --git a/tests/tests/mismatches-dscchanges b/tests/tests/mismatches-dscchanges index 85c7086..e73385e 100755 --- a/tests/tests/mismatches-dscchanges +++ b/tests/tests/mismatches-dscchanges @@ -19,7 +19,7 @@ check () { ../*.$fext t-expect-fail "$emsgpat" \ - t-dgit -wgf push --new + t-dgit -wgf push-built --new } check dsc E:'dpkg-source.*error.*checksum' @@ -29,6 +29,6 @@ check changes E:'dgit.*hash or size.*varies' t-dgit -wgf build-source -t-dgit -wgf push --new +t-dgit -wgf push-built --new t-ok diff --git a/tests/tests/overwrite-chkclog b/tests/tests/overwrite-chkclog index fee2181..9e2cf88 100755 --- a/tests/tests/overwrite-chkclog +++ b/tests/tests/overwrite-chkclog @@ -13,7 +13,7 @@ t-commit 'No changes, just send to stable' '' stable t-dgit -wgf build t-expect-fail 'Perhaps debian/changelog does not mention' \ -t-dgit push --overwrite stable +t-dgit push-built --trust-changelog stable t-dgit setup-mergechangelogs @@ -30,7 +30,7 @@ git commit -m 'UNRELEASED changelog' t-dgit -wgf build t-expect-fail E:'Distribution.*is UNRELEASED' \ -t-dgit push --overwrite stable +t-dgit push-built --trust-changelog stable git revert --no-edit 'HEAD^{/UNRELEASED changelog}' @@ -41,10 +41,10 @@ git add debian/changelog git commit -m 'Break changelog' t-expect-fail 'Perhaps debian/changelog does not mention' \ -t-dgit push --overwrite stable +t-dgit push-built --trust-changelog stable git revert --no-edit 'HEAD^{/Break changelog}' -t-dgit push --overwrite stable +t-dgit push-built --overwrite stable t-ok diff --git a/tests/tests/overwrite-junk b/tests/tests/overwrite-junk index e11d1f8..978da28 100755 --- a/tests/tests/overwrite-junk +++ b/tests/tests/overwrite-junk @@ -17,6 +17,6 @@ t-dgit -wgf build cd $tmp/git/$p.git; git tag -f $tagpfx/1.2 $tagpfx/1.1 ) -t-dgit push --overwrite=1.2 stable +t-dgit push-built --overwrite=1.2 stable t-ok diff --git a/tests/tests/overwrite-splitbrains b/tests/tests/overwrite-splitbrains index 815c207..4d50918 100755 --- a/tests/tests/overwrite-splitbrains +++ b/tests/tests/overwrite-splitbrains @@ -13,13 +13,13 @@ t-dgit fetch t-refs-same-start t-ref-head -t-expect-fail 'maybe --overwrite is needed' \ -t-dgit --quilt=gbp --dgit-view-save=split.p push +t-expect-fail 'maybe --trust-changelog is needed' \ +t-dgit --quilt=gbp --dgit-view-save=split.p push-built t-refs-same-start t-ref-head -t-dgit --quilt=gbp --dgit-view-save=split.p --overwrite push +t-dgit --quilt=gbp --dgit-view-save=split.p --trust-changelog push-built t-gbp-pushed-good diff --git a/tests/tests/overwrite-version b/tests/tests/overwrite-version index 34301ac..9925098 100755 --- a/tests/tests/overwrite-version +++ b/tests/tests/overwrite-version @@ -13,8 +13,8 @@ t-commit 'No changes, just send to stable' '' stable t-dgit -wgf build t-expect-fail 'HEAD is not a descendant' \ -t-dgit push stable +t-dgit push-built stable -t-dgit push --overwrite=1.2 stable +t-dgit push-built --overwrite=1.2 stable t-ok diff --git a/tests/tests/pbuilder b/tests/tests/pbuilder index 56eed0b..418c4a4 100755 --- a/tests/tests/pbuilder +++ b/tests/tests/pbuilder @@ -25,7 +25,7 @@ t-dgit -v0 --pbuilder="$troot/pretend-pbuilder" pbuilder -b # RC-buggy in that it doesn't build with -A .. t-dgit -v0 --pbuilder="$troot/pretend-pbuilder" --pbuilder!:--no-source-only-changes pbuilder -t-dgit -wgf push --new +t-dgit -wgf push-built --new t-pushed-good master stable t-pushed-good-check-changes diff --git a/tests/tests/push-buildproductsdir b/tests/tests/push-buildproductsdir index cc1c5e2..ee4b344 100755 --- a/tests/tests/push-buildproductsdir +++ b/tests/tests/push-buildproductsdir @@ -25,7 +25,7 @@ mv $p*_* bpd/ mv bpd/*orig* . cd $p -t-dgit --build-products-dir=../bpd push +t-dgit --build-products-dir=../bpd push-built t-pushed-good dgit/sid diff --git a/tests/tests/push-newpackage b/tests/tests/push-newpackage index 79355e3..ac3aaef 100755 --- a/tests/tests/push-newpackage +++ b/tests/tests/push-newpackage @@ -9,21 +9,21 @@ t-refs-same-start t-ref-head t-expect-push-fail 'package appears to be new in this suite' \ -t-dgit push +t-dgit push-built t-dgit build git checkout bogus set +e -(set -e; DGIT_TEST_DEBUG=' ' t-dgit push --new) +(set -e; DGIT_TEST_DEBUG=' ' t-dgit push-built --new) rc=$? set -e if [ $rc = 0 ]; then fail "push succeeded when tree mismatch"; fi git checkout master -t-dgit push --new +t-dgit push-built --new t-pushed-good master diff --git a/tests/tests/push-newrepeat b/tests/tests/push-newrepeat index 87fcb35..88f4462 100755 --- a/tests/tests/push-newrepeat +++ b/tests/tests/push-newrepeat @@ -14,8 +14,8 @@ t-dgit --quilt=smash build-source t-expect-fail E:'Push failed, while updating the remote git repository' \ t-dgit -cdgit-distro.test-dummy.git-url=file:///dev/enoent/fail \ - push --new + push-built --new -t-dgit push --new +t-dgit push-built --new --force-reusing-version t-ok diff --git a/tests/tests/push-nextdgit b/tests/tests/push-nextdgit index d0436ab..4494231 100755 --- a/tests/tests/push-nextdgit +++ b/tests/tests/push-nextdgit @@ -18,7 +18,7 @@ t-refs-same-start t-ref-head t-dgit --dpkg-buildpackage:-d build -t-dgit push +t-dgit push-source t-pushed-good dgit/sid diff --git a/tests/tests/push-source b/tests/tests/push-source index 79c4636..888b84a 100755 --- a/tests/tests/push-source +++ b/tests/tests/push-source @@ -8,11 +8,12 @@ t-buildproductsdir-config t-prep-newpackage example 1.0 cd $p +git config --global dgit.default.push-subcmd source t-refs-same-start t-ref-head -t-dgit push-source --new +t-dgit push --new t-pushed-good master t-push-was-source-only diff --git a/tests/tests/quilt b/tests/tests/quilt index f26f744..06b646c 100755 --- a/tests/tests/quilt +++ b/tests/tests/quilt @@ -25,7 +25,7 @@ iteration () { t-refs-same-start t-dgit --dpkg-buildpackage:-d build - t-dgit push + t-dgit push-built t-pushed-good dgit/sid } diff --git a/tests/tests/quilt-colour b/tests/tests/quilt-colour new file mode 100755 index 0000000..724f561 --- /dev/null +++ b/tests/tests/quilt-colour @@ -0,0 +1,19 @@ +#!/bin/bash +set -e +. tests/lib + +t-archive ruby-rails-3.2 3.2.6-1 +t-git-none + +t-dgit clone $p +cd $p + +echo 'added line' >>metadata.yml +git add metadata.yml +git commit -m metadata + +git config --global color.ui always + +t-dgit -wgf build-source + +t-ok diff --git a/tests/tests/quilt-gbp b/tests/tests/quilt-gbp index e502f6b..e1e53c8 100755 --- a/tests/tests/quilt-gbp +++ b/tests/tests/quilt-gbp @@ -22,6 +22,8 @@ t-tstunt-parsechangelog t-gbp-example-prep +git config --global init.defaultBranch trunk + t-expect-fail 'quilt fixup cannot be linear' \ t-dgit build-source @@ -43,7 +45,7 @@ test-push-1 () { } test-push-2 () { - t-dgit --quilt=gbp --dgit-view-save=split.p push + t-dgit --quilt=gbp --dgit-view-save=split.p push-built t-gbp-pushed-good } @@ -53,7 +55,7 @@ test-push-1 t-dgit --quilt=gbp --clean=git --dgit-view-save=split.b build-source t-expect-fail "HEAD specifies a different tree to $p" \ - t-dgit push + t-dgit push-built test-push-2 diff --git a/tests/tests/quilt-include-binaries b/tests/tests/quilt-include-binaries new file mode 100755 index 0000000..74a0de9 --- /dev/null +++ b/tests/tests/quilt-include-binaries @@ -0,0 +1,130 @@ +#!/bin/bash +set -e +. tests/lib +t-tstunt-parsechangelog + +p=example + +mkdir example +cd example +git init + +r=1 +v0=1.0-$r +t-dgit import-dsc $troot/pkg-srcs/${p}_${v0}.dsc +import + +git reset --hard import + +cat >debian/source/include-binaries <<END +# comment + +enoent/file +bins/file +debian/binfile + +../bin-in-parent +$tmp/bin-with-abs +debian/../../bin-tricky-in-parent +.git/index +bins/bin-via-link +$tmp/ +.. +debian/../.. +END + +for f in bin-in-parent bin-with-abs bin-tricky-in-parent bin-via-link; do + echo SHOULD-NOT-APPEAR-$f >../$f +done + +git add debian/source/include-binaries +git commit -m 'specify include binaries' + +t-prep () { + local m=$1 + git checkout -B work master + t-git-next-date + r=$(( $r + 1 )) + v=1.0-$r + t-dch-commit -v$v -m "$1" +} + +t-make-some-bin () { + local file="$1" + perl -e ' + use autodie; + print pack "H*", "d41d8cd98f00b204e9800998ecf8427e"; + print "\n'"$file $r"'\n"; + ' >"$file" +} + +t-try-build-source () { + LC_MESSAGES=C LANGUAGE=C \ + t-dgit --quilt=nofix --since-version=$v0 "$@" build-source +} + +t-roundtrips-1 () { + t-try-build-source "$@" 2>&1 | tee ../build-source-out.$r + t-dgit import-dsc ../${p}_${v}.dsc +reimport + set +e + git --no-pager grep SHOULD-NOT-APPEAR reimport -- + rc=$? + set -e + test $rc = 1 + git diff --exit-code work reimport -- +} + +t-roundtrips () { + t-roundtrips-1 + t-roundtrips-1 --include-dirty +} + +t-prep 'straightforward' + +mkdir bins +t-make-some-bin bins/file +git add bins/file +git commit -m 'add bin' + +t-roundtrips + +for wrongness in \ + "forbidden path component '..'" \ + "path starts with '.git'" \ +; do + grep "$wrongness" ../build-source-out.$r +done + +t-prep 'bin via link' + +linktarget="$tmp" +: 'make a new orig, gnagh' +mkdir ../repack +cd ../repack +tar axf $troot/pkg-srcs/${p}_1.0.orig.tar.gz +ln -s "$linktarget" example/bins +tar zcf ../${p}_1.1.orig.tar.gz example +cd ../example +cp ../${p}_1.{0,1}.orig-docs.tar.gz + +v=1.1-$r +t-dch-commit -v$v -m 'update upstream' + +ln -s "$linktarget" bins +git add bins +git commit -m 'add bins' + +t-roundtrips + +t-prep 'ignored weird file' + +mkdir bins +mkfifo bins/file + +t-roundtrips-1 -wdn + +grep "'bins/file' not a plain file or directory" ../build-source-out.$r + +t-expect-fail E:'dpkg-source: error: *new version is named pipe' \ +t-try-build-source -wdn --ignore-dirty + +t-ok diff --git a/tests/tests/quilt-singlepatch b/tests/tests/quilt-singlepatch index 320a31c..68982a2 100755 --- a/tests/tests/quilt-singlepatch +++ b/tests/tests/quilt-singlepatch @@ -24,7 +24,7 @@ t-ref-head t-dgit -wgf build-source -t-dgit push +t-dgit push-built t-pushed-good dgit/sid diff <<END - debian/patches/series @@ -40,6 +40,6 @@ git apply --reverse debian/patches/debian-changes git commit -a -m 'go back to plain upstream' t-dgit -wgf build-source -t-dgit --damp-run push +t-dgit --damp-run --force-reusing-version push-built t-ok diff --git a/tests/tests/quilt-splitbrains b/tests/tests/quilt-splitbrains index f8d8091..4c683c0 100755 --- a/tests/tests/quilt-splitbrains +++ b/tests/tests/quilt-splitbrains @@ -26,7 +26,9 @@ want-success () { t-dgit "$@" --quilt=$qmode --dgit-view-save=split.b build-source - t-dgit "$@" --quilt=$qmode --dgit-view-save=split.p push + $want_success_pre_push_hook + + t-dgit "$@" --quilt=$qmode --dgit-view-save=split.p push-built t-$qmode-pushed-good $suite } @@ -77,7 +79,10 @@ t-dgit -wgf --quilt=gbp build-source t-expect-fail 'This might be a patches-unapplied branch' \ t-dgit -wgf build-source +# Check that push-built regenerates the cache if necessary +want_success_pre_push_hook='git update-ref -d refs/dgit-intern/quilt-cache' want-success unapplied -wgf +want_success_pre_push_hook='' echo "===== making fully-applied tree suitable for --quilt-check =====" @@ -101,7 +106,7 @@ t-dgit --quilt=unapplied build-source t-dgit --quilt=nofix build-source t-refs-same-start t-ref-head -t-dgit --quilt=nofix push +t-dgit --quilt=nofix push-built t-pushed-good-core diff --git a/tests/tests/rpush b/tests/tests/rpush index 71bbe2b..3378da9 100755 --- a/tests/tests/rpush +++ b/tests/tests/rpush @@ -17,13 +17,32 @@ debcommit -a t-refs-same-start t-ref-head -t-dgit --dpkg-buildpackage:-d build +t-dgit-rpush () { + t-dgit "$@" --ssh=$troot/ssh rpush somehost:$tmp/$p +} mkdir $tmp/empty cd $tmp/empty -#t-dgit --ssh=$troot/ssh rpush somehost:$troot/$p -#echo $? -t-dgit --ssh=$troot/ssh rpush somehost:$tmp/$p + +t-expect-fail F:'error: looked for .dsc' \ +t-dgit-rpush -cdgit.default.rpush-subcmd=built + +t-expect-fail F:'error: looked for .dsc' \ +t-dgit-rpush -cdgit.default.push-subcmd=built + +cd $tmp/$p + +t-dgit --dpkg-buildpackage:-d build + +cd $tmp/empty + +t-expect-fail F:'dgit rpush, but dgit.default.[r]push-subcmd set to reject' \ +t-dgit-rpush -cdgit.default.rpush-subcmd=reject + +t-expect-fail F:'dgit rpush, but dgit.default.[r]push-subcmd set to reject' \ +t-dgit-rpush + +t-dgit-rpush -cdgit.default.rpush-subcmd=built cd $tmp/$p t-pushed-good dgit/sid diff --git a/tests/tests/rpush-quilt b/tests/tests/rpush-quilt index bb49fc6..aca403a 100755 --- a/tests/tests/rpush-quilt +++ b/tests/tests/rpush-quilt @@ -11,7 +11,7 @@ t-dgit -wgf --quilt=gbp --dgit-view-save=split.b build-source mkdir $tmp/empty cd $tmp/empty t-dgit --quilt=gbp --dgit-view-save=split.p \ - --ssh=$troot/ssh rpush somehost:$tmp/$p + --ssh=$troot/ssh rpush-built somehost:$tmp/$p cd $tmp/$p t-gbp-pushed-good diff --git a/tests/tests/rpush-source b/tests/tests/rpush-source new file mode 100755 index 0000000..465cf1c --- /dev/null +++ b/tests/tests/rpush-source @@ -0,0 +1,27 @@ +#!/bin/bash +set -e +. tests/lib + +t-archive pari-extra 3-1 +t-git pari-extra 3-1 + +t-dgit clone $p + +cd $p +t-cloned-fetched-good + +v=3-2~dummy1 +t-apply-diff 3-1 $v +debcommit -a + +t-refs-same-start +t-ref-head + +mkdir $tmp/empty +cd $tmp/empty +t-dgit --ssh=$troot/ssh rpush-source somehost:$tmp/$p + +cd $tmp/$p +t-pushed-good dgit/sid + +t-ok diff --git a/tests/tests/sbuild-gitish b/tests/tests/sbuild-gitish index da90b6f..6b4d812 100755 --- a/tests/tests/sbuild-gitish +++ b/tests/tests/sbuild-gitish @@ -17,6 +17,7 @@ buildrune=$( next if !m/\S/ .. 0; s/^ +\%//; $fixchr += s/(\s-c\s*)jessie(\s|$)/$1'"$schroot"'$2/; + s/^\s*sbuild/$& -v/m; print or die $!; END { $fixchr == 1 or die $fixchr; } ' diff --git a/tests/tests/sourceonlypolicy b/tests/tests/sourceonlypolicy index b0569c3..ec365a6 100755 --- a/tests/tests/sourceonlypolicy +++ b/tests/tests/sourceonlypolicy @@ -29,7 +29,7 @@ t-commit 'Now with binaries' t-dgit -wgf build t-expect-fail E:'uploading binaries.*source only' \ -dgit-with-policy always push --new +dgit-with-policy always push-built --new t-commit 'Source-only not NEW' diff --git a/tests/tests/tag-updates b/tests/tests/tag-updates index 824fd1e..7a17a8b 100755 --- a/tests/tests/tag-updates +++ b/tests/tests/tag-updates @@ -7,8 +7,7 @@ t-prep-newpackage example 1.0 cd $p revision=1 -t-dgit build -t-dgit push --new +t-dgit push-source --new tagref=`t-v-tag` tagname=${tn#refs/tags} diff --git a/tests/tests/tagupl b/tests/tests/tagupl index c626c08..3bb683d 100755 --- a/tests/tests/tagupl +++ b/tests/tests/tagupl @@ -23,12 +23,30 @@ git tag $upstreamtag git checkout -B master quilt-tip-2 +echo foo >bar +git add bar +git commit -m"corrupt the upstream source to test upstream-nonidentical check" + t-tagupl-settings tagname=test-dummy/$v +t-expect-fail "the upstream source in tag $upstreamtag is not identical to the upstream source in refs/heads/master" \ +t-tagupl-test --quilt=gbp --upstream=$upstreamtag + +git reset --hard HEAD~1 + +t-expect-fail "upstream tag $upstreamtag is not an ancestor of refs/heads/master" \ t-tagupl-test --quilt=gbp --upstream=$upstreamtag +t-expect-fail "upstream tag $upstreamtag is not an ancestor of refs/heads/master" \ +t-tagupl-test --quilt=gbp --force=suite --force=no-such-force-option --upstream=$upstreamtag + +t-tagupl-test --quilt=gbp --force=suite --force=no-such-force-option-1 \ + --force=upstream-nonancestor,no-such-force-option-2 \ + --upstream=$upstreamtag +t-pushed-good master + # todo: test each miss/rejection ident=ok @@ -62,30 +80,32 @@ with-mangled () { perl <../basetag >../badtag-$ident -pe "$perl" git tag -u Senatus -f -s -m "$(cat ../badtag-$ident)" "$tagname" + LC_MESSAGES=C \ t-tagupl-run-drs $tmp/$p } expect-quit () { next-mangle "$1" local perl=$2 - local mstring=$3 + local mregexp=$3 with-mangled "$perl" - grep ": $mstring" ../tagupl/overall.log + egrep ": $mregexp" ../tagupl/overall.log } expect-email () { next-mangle "$1" local perl=$2 - local mstring=$3 + local mregexp=$3 with-mangled "$perl" - grep 'Was not successful' ../sendmail.log - grep "$mstring" ../sendmail.log - grep ": failed, emailed" ../tagupl/overall.log + egrep 'Was not successful' ../sendmail.log + egrep "$mregexp" ../sendmail.log + egrep ": failed, emailed" ../tagupl/overall.log } raw-mangled () { - git update-ref refs/tags/$tagname \ - $(git hash-object -w -t tag ../tagobj-$ident) + local tagobj + tagobj=$(git hash-object -w -t tag ../tagobj-$ident) + git update-ref refs/tags/$tagname "$tagobj" t-tagupl-run-drs $tmp/$p } @@ -119,7 +139,7 @@ expect-email bupstag1 's/ upstream-tag=/$&:/' \ "failed command: git check-ref-format" expect-email bupstag2 's/ upstream-tag=/$&x/' \ - "Couldn't find remote ref refs/tags/xUPSTREAM" + "[Cc]ouldn't find remote ref refs/tags/xUPSTREAM" expect-email wrongver '' 'mismatch: changelog Version' @@ -158,8 +178,16 @@ perl -pe <../raw-base ' ' >../tagobj-$ident echo >>../tagobj-$ident cat ../basetag >>../tagobj-$ident -raw-mangled -grep 'failed to fish tagger out of tag' ../tagupl/overall.log +set +e +(set -e; LC_MESSAGES=C raw-mangled 2>../mktag.err) +rc=$? +set -e +if [ $rc = 0 ]; then + grep 'failed to fish tagger out of tag' ../tagupl/overall.log +elif [ $rc = 128 ] && egrep 'error: object fails fsck: badTimezone: invalid author/committer line - bad time zone' ../mktag.err; then : +else + fatal 'failed to make raw-mangled' +fi cd .. rm -rf $p diff --git a/tests/tests/tagupl-baredebian b/tests/tests/tagupl-baredebian new file mode 100755 index 0000000..b485abb --- /dev/null +++ b/tests/tests/tagupl-baredebian @@ -0,0 +1,38 @@ +#!/bin/bash +set -e +. tests/lib +. $troot/lib-baredebian + +t-dependencies quilt git-debpush + +t-debpolicy + +t-setup-import baredebian + +cd $p + +baredebian-test-vars +t-tagupl-settings + +baredebian-test-minimum +baredebian-test-core-prepush + + +sed -i '15icorruption' debian/patches/0002-Edit-the-.c-file.patch +git add debian/patches/0002-Edit-the-.c-file.patch +git commit -m"corrupt a quilt patch to test the patches-applicable check" + +tagname=test-dummy/$v + +t-expect-fail "'git apply' failed to apply patch 0002-Edit-the-.c-file.patch ('patches-applicable' check)" \ +t-tagupl-test --baredebian + +git reset --hard HEAD~1 + +t-tagupl-test --baredebian + +git branch split.p dgit/dgit/sid # we didn't generate this here + +baredebian-test-core-postpush + +t-ok diff --git a/tests/tests/tagupl-gbp b/tests/tests/tagupl-gbp new file mode 100755 index 0000000..a4ecb09 --- /dev/null +++ b/tests/tests/tagupl-gbp @@ -0,0 +1,28 @@ +#!/bin/bash +set -e +. tests/lib +. $troot/lib-baredebian + +t-dependencies git-debpush DEBORIG + +t-setup-import gbp + +t-debpolicy + +cd $p + +git deborig + +t-dgit -wgf --quilt=gbp --dgit-view-save=split.b quilt-fixup + +t-tagupl-settings + +tagname=test-dummy/$v + +t-tagupl-test --gbp + +git branch split.p dgit/dgit/sid # we didn't generate this here + +t-gbp-pushed-good sid + +t-ok diff --git a/tests/tests/tagupl-native b/tests/tests/tagupl-native index 694d879..e8a25c7 100755 --- a/tests/tests/tagupl-native +++ b/tests/tests/tagupl-native @@ -25,5 +25,6 @@ git commit -m 'convert to 1.0 native' tagname=test-dummy/$v t-tagupl-test +t-pushed-good master t-ok diff --git a/tests/tests/trustingpolicy-replay b/tests/tests/trustingpolicy-replay index 2a1012b..f96165f 100755 --- a/tests/tests/trustingpolicy-replay +++ b/tests/tests/trustingpolicy-replay @@ -16,18 +16,15 @@ cd $p revision=1 git tag start -t-dgit build -t-dgit push --new +t-dgit push-source --new t-rm-dput-dropping t-commit 'Prep v1.1 which will be rewound' -t-dgit build -t-dgit push +t-dgit push-source git checkout $tagpfx/1.0 -t-dgit build -t-dgit push --deliberately-fresh-repo +t-dgit push-source --deliberately-fresh-repo --force-reusing-version remote="`git config dgit-distro.test-dummy.git-url`/$p.git" @@ -53,7 +50,8 @@ prepare-replay () { t-commit "request with $delib that we will replay" t-dgit build t-expect-push-fail 'system: No such file or directory' \ - t-dgit push $delib + t-dgit -cdgit-distro.test-dummy.policy-query-supported-ssh=false \ + push-source $delib t-policy dgit-repos-policy-trusting @@ -79,8 +77,7 @@ attempt-replay 'does not declare previously heads/for-testing' prepare-replay --deliberately-not-fast-forward t-commit 'later version to stop not fast forward rewinding' -t-dgit build -t-dgit push +t-dgit push-source attempt-replay "does not declare previously tags/$tagpfx/$v" diff --git a/tests/tests/unrepresentable b/tests/tests/unrepresentable index e4b0da8..8f451aa 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -10,58 +10,131 @@ ln -s $troot/pkg-srcs/${p}_${v%-*}.orig.tar.* . cd $p -start () { git checkout quilt-tip-1.1~0; } -attempt () { t-dgit -wgf --quilt=smash quilt-fixup; } -good () { - attempt +make_singlepatch () { + git checkout quilt-tip-1.1 + echo >debian/source/options single-debian-patch + git add debian/source/options + git commit -m single-debian-patch debian/source/options +} + +quilt_mode=smash +case $DGIT_TEST_TESTNAME in + *-single-dpkg) make_singlepatch ;; + *-single-git) quilt_mode=single ;; + *-*) fail 'unknown test name' ;; + *) ;; +esac + +quilt-fixup () { + t-dgit -wgf --quilt=$quilt_mode quilt-fixup +} +build-source () { t-dgit --quilt=nofix -wgf build-source - t-dgit -wgf --dry-run push --new +} +run-push () { + t-dgit -wgf --dry-run push-built --new +} +badly-raw () { + wrongmsg=$1 + t-expect-fail "$1" \ + quilt-fixup +} +badly-late-raw () { + quilt-fixup + build-source + t-expect-fail "$1" \ + run-push +} +good () { + quilt-fixup + build-source + run-push } -badly-1 () { - wrongfn=$1 - wrongmsg=$2 - start +start () { + path=$1 + git checkout quilt-tip-1.1~0; } +finish () { + case "$DGIT_TEST_TESTNAME" in + *-single-dpkg) expected=${2-$1} ;; + *) expected=$1 ;; + esac + + case "$expected" in + NOTHING) ;; + *) git commit -m "$expected" ;; + esac -badly-2 () { - git commit -m "Commit wrongness $wrongfn ($wrongmsg)" - t-expect-fail E:"cannot represent change: $wrongmsg .*: $wrongfn" \ - attempt + case "$expected" in + GOOD:*|NOTHING) + good + ;; + + EP:*) + wrongmsg="${expected#*:}" + badly-raw E:"cannot represent change: $wrongmsg .*: $path" + ;; + + LATE-EP:*) + # quilt-fixup and dpkg-source succeeded, but dgit push failed. + # This is rather a poor outcome. + case "$DGIT_TEST_TESTNAME" in + *-single-dpkg) ;; + *) fail 'push failure, other than with single-debina-patch' ;; + esac + + wrongmsg="${expected#*:}" + badly-late-raw "E:$wrongmsg.*: $path" + ;; + + E:* | [^A-Z]*) + badly-raw "$expected" + ;; + + *) fail 'bad pattern' ;; + + esac } -badly-1 orig-symlink 'modified symlink' +start orig-symlink ln -sf NEWTARGET orig-symlink git add orig-symlink -badly-2 +finish EP:'modified symlink' 'new version is symlink' -badly-1 orig-symlink 'deletion of symlink' +start orig-symlink git rm -f orig-symlink -badly-2 +finish EP:'deletion of symlink' LATE-EP:'Mode change from 20000 to 000000' + +start new + ln -s hi new + git add new +finish EP:'creation .* symlink' 'new version is symlink' -start +start src.c git rm src.c - git commit -m deleted -good +finish GOOD:deleted -start +start orig-exec git rm orig-exec +finish GOOD:'deleted exec' + +start orig-unwriteable git rm -f orig-unwriteable - git commit -m 'deleted funny' -good +finish GOOD:'deleted unwritable' -badly-1 src.c 'mode or type changed' +start src.c chmod +x src.c git add src.c -badly-2 +finish GOOD:chmod LATE-EP:'Mode change from 644 to 755' -badly-1 new 'creation with non-default mode' - echo hi >new - chmod 755 new - git add new -badly-2 +start newx + echo hi >newx + chmod 755 newx + git add newx +finish GOOD:add-755 LATE-EP:'Mode change from 644 to 755' -start -good +start nothing +finish NOTHING NOTHING t-ok diff --git a/tests/tests/unrepresentable-single-dpkg b/tests/tests/unrepresentable-single-dpkg new file mode 100755 index 0000000..f1ac270 --- /dev/null +++ b/tests/tests/unrepresentable-single-dpkg @@ -0,0 +1,4 @@ +#!/bin/bash +set -e +. tests/lib +t-chain-test unrepresentable diff --git a/tests/tests/unrepresentable-single-git b/tests/tests/unrepresentable-single-git new file mode 100755 index 0000000..f1ac270 --- /dev/null +++ b/tests/tests/unrepresentable-single-git @@ -0,0 +1,4 @@ +#!/bin/bash +set -e +. tests/lib +t-chain-test unrepresentable diff --git a/tests/tests/version-opt b/tests/tests/version-opt index 2933912..fff9a4d 100755 --- a/tests/tests/version-opt +++ b/tests/tests/version-opt @@ -13,8 +13,7 @@ revision=1 git tag start t-dgit setup-mergechangelogs -t-dgit build-source -t-dgit push --new --overwrite +t-dgit push-source --new --overwrite t-archive-process-incoming sid diff --git a/tests/update-dh-compat b/tests/update-dh-compat new file mode 100755 index 0000000..6c35c6c --- /dev/null +++ b/tests/update-dh-compat @@ -0,0 +1,120 @@ +#!/bin/bash +# dgit +# Integration between git and Debian-style archives +# +# Copyright (C)2013-2021 Ian Jackson +# Copyright (C)2017-2019 Sean Whitton +# Copyright (C)2019 Matthew Vernon / Genome Research Limited +# +# 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 3 of the License, 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/>. + +set -e + +# This ad-hoc script was wrtten to deal with #1002927. + +export FILTER_BRANCH_SQUELCH_WARNING=1 +toplevel=$PWD + +cd_fresh_d () { + cd "$toplevel" + rm -rf d + mkdir d + cd d +} + +adjust="$toplevel"/tests/update-dh-compat-adjust +adjust () { "$adjust"; } + +git_filter_strip_origs () { + git for-each-ref refs/original \ + --format '%(refname)' | + xargs -rn1 git update-ref -d +} + +adjust_git_filter () { + # this is the dgit origin commit; this check may stop + # us rewriting our normal dgit tree + set +e + git cat-file -e 06fb75074c0bebccdcf86385b8d248fd127ed66d + rc=$? + set -e + test $rc = 1 + + git_filter_strip_origs + + git filter-branch \ + --tree-filter "$adjust" \ + --tag-name-filter cat \ + -- --all + + git_filter_strip_origs + + git gc --aggressive --prune=all +} + +cd "$toplevel" + +for f in tests/pkg-srcs/*.dsc; do + cd_fresh_d + + dpkg-source -x ../$f p + cd p + adjust + dpkg-source -b . + cd .. + dcmd rm ../$f + dcmd mv *.dsc ../tests/pkg-srcs/ + + cd .. +done + +cd "$toplevel" + +for f in tests/git-srcs/*.tar; do + cd_fresh_d + + tar xf ../$f + + p=$(echo *) + cd $p + adjust_git_filter + cd .. + tar cf ../$f $p + + cd .. +done + +cd "$toplevel" + +for f in tests/worktrees/*.tar; do + cd_fresh_d + + tar xf ../$f + + p=$(echo *) + cd $p + adjust_git_filter + adjust + cd .. + + tar cf ../$f $p + + cd .. +done + +cd "$toplevel" + +rm -rf d + +echo ok. diff --git a/tests/update-dh-compat-adjust b/tests/update-dh-compat-adjust new file mode 100755 index 0000000..54305a1 --- /dev/null +++ b/tests/update-dh-compat-adjust @@ -0,0 +1,26 @@ +#!/bin/sh +# dgit +# Integration between git and Debian-style archives +# +# Copyright (C)2013-2021 Ian Jackson +# Copyright (C)2017-2019 Sean Whitton +# Copyright (C)2019 Matthew Vernon / Genome Research Limited +# +# 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 3 of the License, 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/>. + +# See update-dh-compat +# This ad-hoc script was wrtten to deal with #1002927. + +set -e +perl -i -pe 's/^5$/12/' debian/compat diff --git a/tests/worktrees/example_1.0.tar b/tests/worktrees/example_1.0.tar Binary files differindex 11f694f..658cddc 100644 --- a/tests/worktrees/example_1.0.tar +++ b/tests/worktrees/example_1.0.tar diff --git a/tests/worktrees/example_1.1.tar b/tests/worktrees/example_1.1.tar Binary files differindex f58c41a..2c257a3 100644 --- a/tests/worktrees/example_1.1.tar +++ b/tests/worktrees/example_1.1.tar diff --git a/tests/worktrees/pari-extra_3-1.tar b/tests/worktrees/pari-extra_3-1.tar Binary files differindex 56b797d..201f6f5 100644 --- a/tests/worktrees/pari-extra_3-1.tar +++ b/tests/worktrees/pari-extra_3-1.tar diff --git a/tests/worktrees/pari-extra_drs.tar b/tests/worktrees/pari-extra_drs.tar Binary files differindex 94c8455..987b595 100644 --- a/tests/worktrees/pari-extra_drs.tar +++ b/tests/worktrees/pari-extra_drs.tar diff --git a/tests/worktrees/ruby-rails-3.2_test.tar b/tests/worktrees/ruby-rails-3.2_test.tar Binary files differindex 6b0a824..eda72b2 100644 --- a/tests/worktrees/ruby-rails-3.2_test.tar +++ b/tests/worktrees/ruby-rails-3.2_test.tar |