diff options
Diffstat (limited to 'tests')
60 files changed, 679 insertions, 203 deletions
diff --git a/tests/http-static-server b/tests/http-static-server index f2f7cd0..723114e 100755 --- a/tests/http-static-server +++ b/tests/http-static-server @@ -71,10 +71,11 @@ sub handle_request { if (!$self->serve_static($cgi, $::webroot)) { print "HTTP/1.0 404 Not found\r\n"; - print $cgi->header, - $cgi->start_html('Not found'), + print $cgi->header; + print $cgi->start_html('Not found'), $cgi->h1('Not found'), - $cgi->end_html; + $cgi->end_html + if uc $cgi->request_method eq 'GET'; } } @@ -1,7 +1,6 @@ # exec 2>&1 -set -x set -o pipefail . tests/lib-core @@ -25,21 +24,42 @@ END 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. " - set -x + if [ $rc != 0 ] || ! [ "$DGIT_TRAP_QUIET" ]; then + set -x + pwd + fi set +e - pwd [ "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 t-set-intree @@ -165,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 @@ -173,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 @@ -436,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 () { @@ -467,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 () { @@ -604,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 @@ -913,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 } @@ -1323,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 557c051..51beb1f 100644 --- a/tests/lib-baredebian +++ b/tests/lib-baredebian @@ -68,7 +68,8 @@ baredebian-test-core-push () { # (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.p --new push + t-dgit -wn --quilt=$quiltmode --dgit-view-save=split.p --new \ + push-built } baredebian-test-core-postpush () { diff --git a/tests/lib-core b/tests/lib-core index 7fdddb4..d4d0bd5 100644 --- a/tests/lib-core +++ b/tests/lib-core @@ -33,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-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 dc1614c..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 b26fcbe..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 - c0beeb06befcfbdd5952c6925801ac17c172d29e 1412 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 - 673169591a1de79f28da17b08768fd8fb1b1e84721df6f1fd9b4708f33f2c80c 1412 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 - 27324c0ef68306a4fa9c29ab7ade2492 1412 example_1.0-1+absurd.debian.tar.xz + ed26c7be15f59fafbacffb505365731a 1528 example_1.0-1+absurd.debian.tar.xz diff --git a/tests/setup/examplegit b/tests/setup/examplegit index d25ee95..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 } 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-nogit b/tests/tests/clone-nogit index f36a7b6..9dceafc 100755 --- a/tests/tests/clone-nogit +++ b/tests/tests/clone-nogit @@ -19,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/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 af02ac1..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,7 +54,8 @@ 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 @@ -75,23 +79,27 @@ 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 --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 @@ -107,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 --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 a9e54da..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,10 +37,15 @@ 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-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 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/gbp-orig b/tests/tests/gbp-orig index 2ac0073..15516c5 100755 --- a/tests/tests/gbp-orig +++ b/tests/tests/gbp-orig @@ -26,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-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-dgitview b/tests/tests/gdr-import-dgitview index 65c87cd..f761b02 100755 --- a/tests/tests/gdr-import-dgitview +++ b/tests/tests/gdr-import-dgitview @@ -38,6 +38,12 @@ t-ref-head t-git-debrebase --noop-ok convert-from-dgit-view $GDR_DIAGNOSE t-ref-head +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 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/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-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 2649a31..ee51dd7 100755 --- a/tests/tests/manpages-format +++ b/tests/tests/manpages-format @@ -53,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 4aa756b..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 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 e424016..20bf980 100755 --- a/tests/tests/mismatches-contents +++ b/tests/tests/mismatches-contents @@ -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 048dfd2..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 --force-reusing-version +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 4dc597d..e1e53c8 100755 --- a/tests/tests/quilt-gbp +++ b/tests/tests/quilt-gbp @@ -45,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 } @@ -55,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 9c03595..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 --force-reusing-version 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 9d3e45a..3bb683d 100755 --- a/tests/tests/tagupl +++ b/tests/tests/tagupl @@ -103,8 +103,9 @@ expect-email () { } 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 } @@ -177,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/trustingpolicy-replay b/tests/tests/trustingpolicy-replay index a2d280d..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 --force-reusing-version +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 fb1cf61..8f451aa 100755 --- a/tests/tests/unrepresentable +++ b/tests/tests/unrepresentable @@ -10,60 +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 - t-dgit --quilt=nofix -wgf build-source - t-dgit -wgf --dry-run push --new +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 } -badly-1 () { - wrongfn=$1 - wrongmsg=$2 - start -} +quilt_mode=smash +case $DGIT_TEST_TESTNAME in + *-single-dpkg) make_singlepatch ;; + *-single-git) quilt_mode=single ;; + *-*) fail 'unknown test name' ;; + *) ;; +esac -badly-2-raw () { - git commit -m "Commit wrongness $wrongfn ($wrongmsg)" +quilt-fixup () { + t-dgit -wgf --quilt=$quilt_mode quilt-fixup +} +build-source () { + t-dgit --quilt=nofix -wgf build-source +} +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" \ - attempt + run-push } -badly-2 () { - badly-2-raw E:"cannot represent change: $wrongmsg .*: $wrongfn" +good () { + quilt-fixup + build-source + run-push +} + +start () { + path=$1 + git checkout quilt-tip-1.1~0; } +finish () { + case "$DGIT_TEST_TESTNAME" in + *-single-dpkg) expected=${2-$1} ;; + *) expected=$1 ;; + esac -badly-1 orig-symlink 'modified symlink' + case "$expected" in + NOTHING) ;; + *) git commit -m "$expected" ;; + esac + + 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 +} + +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' -badly-1 +start new ln -s hi new git add new -badly-2-raw 'new version is symlink' +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' + +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 |