diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2018-06-28 11:52:54 +0100 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2018-06-28 11:52:54 +0100 |
commit | 4613f20fafd20f738291b355aced2bb4798ca2b1 (patch) | |
tree | e7d9bf11336468eda8076d71240368608cffea0e /tests/tests | |
parent | 36454d4896b806632a7b8b8f08e1b5ec16a1cc4e (diff) | |
parent | 152ccd540c3f7809d8235d0907eb0142aed792f4 (diff) |
Merge tag 'debian/5.2' into wip/stretch-bpo
dgit release 5.2 for unstable (sid) [dgit]
[dgit distro=debian]
# gpg: Signature made Sun 24 Jun 2018 23:36:20 BST
# gpg: using RSA key 559AE46C2D6B6D3265E7CBA1E3E3392348B50D39
# gpg: Can't check signature: No public key
Diffstat (limited to 'tests/tests')
-rwxr-xr-x | tests/tests/gdr-diverge-nmu | 61 | ||||
-rwxr-xr-x | tests/tests/gdr-diverge-nmu-dgit | 55 | ||||
-rwxr-xr-x | tests/tests/gdr-edits | 40 | ||||
-rwxr-xr-x | tests/tests/gdr-import-dgit | 68 | ||||
-rwxr-xr-x | tests/tests/gdr-makepatches7 | 37 | ||||
-rwxr-xr-x | tests/tests/gdr-newupstream | 65 | ||||
-rwxr-xr-x | tests/tests/gdr-subcommands | 226 | ||||
-rwxr-xr-x | tests/tests/gdr-viagit | 40 | ||||
-rwxr-xr-x | tests/tests/gitattributes | 48 | ||||
-rwxr-xr-x | tests/tests/hint-testsuite-triggers | 10 | ||||
-rwxr-xr-x | tests/tests/quilt-singlepatch | 6 | ||||
-rwxr-xr-x | tests/tests/version-opt | 2 |
12 files changed, 649 insertions, 9 deletions
diff --git a/tests/tests/gdr-diverge-nmu b/tests/tests/gdr-diverge-nmu new file mode 100755 index 0000000..15bf901 --- /dev/null +++ b/tests/tests/gdr-diverge-nmu @@ -0,0 +1,61 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies GDR + +t-setup-import gdr-convert-gbp + +cd $p + +t-dgit setup-mergechangelogs + +: 'maintainer' + +v=2.0-3 +t-maintainer-commit-some-changes + +t-git-next-date + +: 'non-dgit upload (but we prepare it with dgit anyway)' + +t-git-next-date +git checkout origin/master + +v=2.0-2+nmu1 +t-nmu-upload-1 nmu +gbp pq import +t-nmu-upload-2 +t-nmu-commit-an-upstream-change +t-nmu-upload-3 + +: 'ad hocery' + +t-git-next-date +git checkout master +t-nmu-causes-ff-fail + +git cherry-pick 'dgit/dgit/sid^{/UPSTREAM NMU}' + +t-expect-fail 'Automatic merge failed; fix conflicts' \ +git merge --squash -m 'Incorporate NMU' dgit/dgit/sid + +git rm -rf debian/patches +git commit -m 'Incorporate NMU' + +git merge -s ours -m 'Declare incorporate NMU' dgit/dgit/sid + +: 'right, how are we' + +t-git-next-date + +t-git-debrebase +t-gdr-good laundered + +t-git-debrebase stitch +t-gdr-good stitched + + +t-nmu-reconciled-good patch-queue/nmu + +t-ok diff --git a/tests/tests/gdr-diverge-nmu-dgit b/tests/tests/gdr-diverge-nmu-dgit new file mode 100755 index 0000000..4b5907a --- /dev/null +++ b/tests/tests/gdr-diverge-nmu-dgit @@ -0,0 +1,55 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies GDR + +t-setup-import gdr-convert-gbp + +cd $p + +t-dgit setup-mergechangelogs + +: 'maintainer' + +git checkout master + +v=2.0-3 +t-maintainer-commit-some-changes + +t-git-next-date + +: 'nmu' + +git checkout -b nmu origin/master~0 + +t-git-next-date + +v=2.0-2+nmu1 +t-nmu-commit-an-upstream-change +t-dch-commit -v$v -m finalise +t-dch-commit -r sid + +t-dgit -wgf push-source + +t-archive-process-incoming sid + +: 'rebase nmu onto our branch' + +t-git-next-date +git checkout master +t-nmu-causes-ff-fail + +git checkout dgit/dgit/sid # detach + +t-expect-fail 'E:CONFLICT.*Commit Debian 3\.0 \(quilt\) metadata' \ +git rebase master +git rebase --skip + +git push . HEAD:master +git checkout master + + +t-nmu-reconciled-good nmu + +t-ok diff --git a/tests/tests/gdr-edits b/tests/tests/gdr-edits new file mode 100755 index 0000000..6c77184 --- /dev/null +++ b/tests/tests/gdr-edits @@ -0,0 +1,40 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies GDR + +t-setup-import gdr-convert-gbp + +cd $p + +v=2.0-3 +t-dch-commit -v $v -m testing + +t-git-debrebase analyse |tee ../anal.1 +cat ../anal.1 + +t-some-changes edits + +t-dch-commit -r sid + +git tag t.before + +t-git-debrebase +t-gdr-good laundered + +t-dgit push-source +t-gdr-good pushed-interop + +git branch before-noop + +t-git-next-date +t-git-debrebase +t-git-debrebase stitch +t-gdr-good pushed-interop + +t-refs-same-start +t-ref-same refs/heads/before-noop +t-ref-head + +t-ok diff --git a/tests/tests/gdr-import-dgit b/tests/tests/gdr-import-dgit new file mode 100755 index 0000000..19918d8 --- /dev/null +++ b/tests/tests/gdr-import-dgit @@ -0,0 +1,68 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies GDR + +t-setup-import gdr-convert-gbp + +cd $p + +: 'non-dgit upload (but we prepare it with dgit anyway)' + +v=2.0-2+nmu1 +t-nmu-upload-1 nmu +gbp pq import +t-nmu-upload-2 +t-some-changes $numbranch +t-nmu-upload-3 + +: 'done the nmu, switching back to the maintainer hat' + +nmu-fold () { + t-git-next-date + t-dgit fetch + t-git-next-date + git merge --ff-only dgit/dgit/sid + + git diff --exit-code patch-queue/$nmubranch + + git branch unlaundered.$nmubranch + + t-git-debrebase + t-gdr-good laundered + + t-git-debrebase stitch + t-gdr-good stitched +} + +nmu-fold + +v=2.0-3 +t-dch-commit -v $v -m "incorporate nmu" +t-dch-commit -r sid +t-dgit -wgf push-source + +: 'now test a new upstream' + +t-make-new-upstream-tarball 2.1 + +git checkout master +v=2.1-0+nmu1 +t-nmu-upload-1 nmu2 + +gbp import-orig --upstream-version=2.1 --debian-branch=nmu2 ../$ust +t-dch-commit -v $v -m "new upstream $v" +gbp pq import + +#t-dgit -wgf build-source + +t-nmu-upload-2 +t-some-changes $numbranch +t-nmu-upload-3 + +: 'done the nmu, back to the maintainer' + +nmu-fold + +t-ok diff --git a/tests/tests/gdr-makepatches7 b/tests/tests/gdr-makepatches7 new file mode 100755 index 0000000..9c39710 --- /dev/null +++ b/tests/tests/gdr-makepatches7 @@ -0,0 +1,37 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies GDR + +t-setup-import gdr-convert-gbp + +cd $p + +t-some-changes for-rebase-fixup m + +t-git-debrebase +t-git-debrebase make-patches + +t-some-changes for-dgit-fixup m + +t-git-debrebase + +t-expect-fail 'dgit: failed command: test-suite-break-git-debrebase' \ +t-dgit -wgf --git-debrebase=test-suite-break-git-debrebase quilt-fixup + +t-dgit -wgf --git-debrebase=true quilt-fixup + +t-some-changes for-make-patches-fails-then-dgit-fixup m + +t-expect-fail 'Patch export produced patch amendments' \ +t-git-debrebase make-patches + +t-dgit -wgf quilt-fixup + +t-refs-same-start +t-ref-head +t-dgit -wg quilt-fixup +t-ref-head + +t-ok diff --git a/tests/tests/gdr-newupstream b/tests/tests/gdr-newupstream new file mode 100755 index 0000000..536f49c --- /dev/null +++ b/tests/tests/gdr-newupstream @@ -0,0 +1,65 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies NO-DGIT GDR + +t-setup-import gdr-convert-gbp-noarchive + +cd $p + +: 'upstream hat' + +new-upstream () { + uv=$1 + t-git-next-date + git checkout make-upstream + git reset --hard upstream + t-make-new-upstream-tarball $uv + git push . make-upstream:upstream + git checkout master + t-git-next-date +} + +new-upstream 2.1 + +: 'maintainer hat' + +git branch startpoint +v=2.1-1 + +git checkout master + +t-expect-fail F:'Could not determine appropriate upstream commitish' \ +t-git-debrebase new-upstream $v + +git tag v2.1 upstream + +t-git-debrebase new-upstream $v +t-gdr-good laundered + +t-git-debrebase stitch +t-gdr-good stitched + +git branch ordinary + +: 'with --anchor' + +git reset --hard startpoint + +t-git-debrebase analyse >../anal.anch +anchor=$(perl <../anal.anch -ne ' + next unless m/^(\w+) Anchor\s/; + print $1,"\n"; + exit; +') + +t-git-debrebase --anchor=$anchor -fanchor-treated new-upstream $v upstream +t-gdr-good laundered + +t-git-debrebase stitch +t-gdr-good stitched + +git diff --quiet ordinary + +t-ok diff --git a/tests/tests/gdr-subcommands b/tests/tests/gdr-subcommands new file mode 100755 index 0000000..e59fc07 --- /dev/null +++ b/tests/tests/gdr-subcommands @@ -0,0 +1,226 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies GDR + +t-setup-import gdr-convert-gbp + +cd $p + +t-dgit setup-mergechangelogs + +mix-it () { + t-git-next-date + + local m=$(git symbolic-ref HEAD) + t-some-changes "subcommands $m 1" + + # we want patches mde by dgit, not gdr, for our test cases + t-dgit --git-debrebase=true -wgf quilt-fixup + t-git-next-date + + t-some-changes "subcommands $m 2" + t-git-next-date +} + +git checkout -b stitched-laundered master +mix-it +t-git-debrebase quick +t-gdr-good stitched HEAD + +git checkout -b stitched-mixed master +mix-it + +git checkout -b unstitched-laundered master +mix-it +t-git-debrebase +t-gdr-good laundered + +git checkout -b unstitched-mixed master +t-git-debrebase +mix-it + +t-git-next-date + +git show-ref + +subcmd () { + local subcmd=$1 + shift + for startbranch in {stitched,unstitched}-{laundered,mixed}; do + work="work-$subcmd-$startbranch" + + : "---------- $subcmd $startbranch ----------" + + git for-each-ref "**/$startbranch"{,/**} \ + --format='create %(refname) %(objectname)' \ + | sed "s/$startbranch/$work/" \ + | git update-ref --stdin + + git checkout $work + checkletters=$1; shift + + before=before-$work + git branch $before + + local xopts='' + + case "$checkletters" in + XX*) + fail "$checkletters" # for debugging + ;; + esac + + case "$checkletters" in + X*) + t-expect-fail E:'snags: [0-9]* blockers' \ + t-git-debrebase $xopts $subcmd + xopts+=' --force' + next_checkletter + ;; + esac + + case "$checkletters" in + N*) + t-expect-fail E:. \ + t-git-debrebase $xopts $subcmd + xopts+=' --noop-ok' + next_checkletter + ;; + esac + + case "$checkletters" in + [EF]:*) + t-expect-fail "$checkletters" \ + t-git-debrebase $xopts $subcmd + continue + ;; + *) + t-git-debrebase $xopts $subcmd + ;; + esac + + peel=peel-$subcmd-$startbranch + git checkout -b $peel + t-clean-on-branch $peel + + : "---------- $subcmd $startbranch $checkletters ----------" + + while [ "x$checkletters" != x ]; do + : "---- $subcmd $startbranch ...$checkletters ----" + make_check "$checkletters" + checkletters="${checkletters#?}" + done + done + +} + +next_checkletter () { + checkletters="${checkletters#?}" +} + +make_check () { + case "$1" in + [Nn]*) + t-refs-same-start + t-refs-same refs/heads/$before refs/heads/$work + ;; + U*) + t-refs-same-start + t-refs-same refs/heads/$before refs/ffq-prev/heads/$work + make_check u + ;; + u*) + t-git-get-ref refs/ffq-prev/heads/$work + t-refs-notexist refs/debrebase-last/heads/$work + ;; + V*) + t-refs-same-start + t-refs-same refs/ffq-prev/heads/$work \ + refs/ffq-prev/heads/$startbranch + t-refs-notexist refs/debrebase-last/heads/$work + ;; + s*) + t-refs-notexist refs/ffq-prev/heads/$work + t-refs-same-start + t-refs-same refs/debrebase-last/heads/$work \ + refs/debrebase-last/heads/$startbranch + t-has-ancestor HEAD refs/debrebase-last/heads/$work + ;; + S*) + t-refs-notexist refs/ffq-prev/heads/$work + t-refs-same-start refs/debrebase-last/heads/$work + t-ref-head + git diff --quiet HEAD^1 + git diff HEAD^2 | grep $startbranch + git reset --hard HEAD^1 + ;; + P*) + t-dgit -wgf --quilt=nofix quilt-fixup + git diff HEAD~ debian/patches | egrep . + git diff --quiet HEAD~ -- ':.' ':!debian/patches' + git reset --hard HEAD~ + ;; + l*) + git diff --quiet HEAD refs/heads/$before -- ':.' ':!debian/patches' + t-gdr-good laundered + ;; + t*) + git diff --quiet HEAD refs/heads/$before + ;; + f*) + t-has-ancestor HEAD refs/heads/$before + ;; + *) + fail "$1" + ;; + esac +} + +Ec="F:No ongoing git-debrebase session" +Ep="F:Patch export produced patch amendments" + +# input state: +# stitched? st'd st'd unst'd unst'd +# laundered? laund'd mixed laund'd mixed +# +# "mixed" means an out of order branch +# containing mixed commits and patch additions, +# but which needs even more patches +# +subcmd '' Ult Ull Vlt Vl +subcmd stitch Ns Nu Sltf Stf +subcmd prepush Ns Nu Sltf Stf +subcmd quick ns Sl Sltf Sl +subcmd conclude "$Ec" "$Ec" Sltf Sl +subcmd make-patches sPft "$Ep" uPft "$Ep" +#subcmd dgit-upload-hook Psft "$Ep" SPft "$Ep" +# +# result codes, each one is a check: +# E:$pat } this is an error (must come first) +# F:$pat } arg is passed to expect-fail +# +# X should fail due to snags, but succeed when forced +# XX crash out of script for manual debugging +# +# N this is a noop, error unless --noop-ok +# n this is a silent noop +# both of these imply tf; but, specify also one of u s +# +# should normally specify one of these: +# U just unstiched: ffq-prev is exactly previous HEAD; implies u +# u result is unstitched +# V ffq-prev remains unchanged; implies also u +# s result is stitched, debrebase-last exists and is unchanged +# S result is stitch just made, remaining letters apply to result~ +# +# P result is add-patches, remaining letters apply to result~ +# +# should normally specify one or both of these: +# l result is laundered, tree is same as before minus d/patches +# t tree is exactly same as before +# +# f result is ff from previous HEAD + +t-ok diff --git a/tests/tests/gdr-viagit b/tests/tests/gdr-viagit new file mode 100755 index 0000000..644d2d4 --- /dev/null +++ b/tests/tests/gdr-viagit @@ -0,0 +1,40 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies NO-DGIT GDR + +t-setup-import gdr-convert-gbp-noarchive + +: 'set up so t-git-debrebase runs gdr via git' + +case "$DGIT_GITDEBREBASE_TEST" in +''|git-debrebase) ;; +*) + t-tstunt + st=$tmp/tstunt/git-debrebase + export DGIT_GITDEBREBASE_TEST_REAL="$DGIT_GITDEBREBASE_TEST" + cat <<'END' >$st +#!/bin/sh +set -x +exec "$DGIT_GITDEBREBASE_TEST_REAL" "$@" +END + chmod +x $st + ;; +esac + +DGIT_GITDEBREBASE_TEST='git debrebase' + +: 'do a simple test' + +cd $p + +t-some-changes + +t-git-debrebase +t-gdr-good laundered + +t-git-debrebase stitch --prose=wombat +t-gdr-good stitched + +t-ok diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes index 9e1c246..bdc61f8 100755 --- a/tests/tests/gitattributes +++ b/tests/tests/gitattributes @@ -22,12 +22,20 @@ badattr1 () { printf >>af/$filename 'crlf: \r\n' echo >>af/$filename 'id $Id: $' echo >>af/$filename 'id $Id: SPLARK $' + printf >>af/$filename '\xEF\xBB\xBF <- UTF-8 BOM\n' echo >>gitattrs "af/$filename" "$attrspec" } badattr () { attrname=$1; shift - badattr1 $attrname-set $attrname + + case "$attrname" in + working-tree-encoding) ;; + *) + badattr1 $attrname-set $attrname + ;; + esac + badattr1 $attrname-unset -$attrname badattr1 $attrname-unspec \!$attrname local val @@ -40,6 +48,9 @@ badattr () { t-git-config core.eol crlf +printf >>.dotfile-attr 'dotfiles too?\n' +echo >>gitattrs '.dotfile-attr filter=dgit-test-crazy-f' + badattr text auto badattr eol lf crlf badattr ident @@ -57,6 +68,7 @@ badattr export-ignore badattr export-subst badattr delta badattr encoding no-such-encoding +badattr working-tree-encoding ISO-8859-1 UTF-16 man gitattributes \ | perl -ne 'print $1,"\n" if m/^ *(\w[-a-z]*)$/' \ @@ -67,7 +79,7 @@ while read attr; do badattr $attr done -sha256sum af/* >sums +sha256sum .dotfile-attr af/* >sums # ----- common to source formats ----- @@ -92,7 +104,7 @@ sfmt_setup () { cp ../gitattrs .gitattributes $addpatch gitattrs - cp -a ../af . + cp -a ../af ../.dotfile-attr . $addpatch files cp ../sums . @@ -108,10 +120,10 @@ sums_check () { # $sums $branch # and check out $branch - sha256sum af/* >../$sums.checkout + sha256sum .dotfile-attr af/* >../$sums.checkout diff -U0 ../sums ../$sums.checkout - for f in af/*; do + for f in .dotfile-attr af/*; do git cat-file blob "refs/heads/$branch:$f" \ | sha256sum \ | sed -e 's#-$#'$f'#' \ @@ -126,7 +138,7 @@ sums_check_broken () { # $sums # and check out the broken branch - sha256sum af/* >../$sums.broken + sha256sum .dotfile-attr af/* >../$sums.broken for s in ../sums ../$sums.broken; do sed 's/[0-9a-f]* //' $s >$s.nosums @@ -178,7 +190,7 @@ sfmt_import () { t-dgit-warn-check 1 $dgitargs import-dsc ../$dscf +$branch git checkout $branch - touch af/* + touch .dotfile-attr af/* git reset --hard sums_check @@ -239,7 +251,7 @@ t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \ clone $p sid $p.clone.broken cd $p.clone.broken -sums=$p.clone.broken +sums=sums.broken sums_check_broken cd .. @@ -253,4 +265,24 @@ sums_check cd .. +t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \ + clone $p sid $p.clone.old + +cd $p.clone.old + +mkdir -p .git/info +cat >.git/info/attributes <<'END' +* dgit-defuse-attrs +[attr]dgit-defuse-attrs -text -eol -crlf -ident -filter +# ^ see GITATTRIBUTES in dgit(7) and dgit setup-new-tree in dgit(1) +END + +t-dgit setup-gitattributes +git reset --hard + +sums=sums.old +sums_check + +cd .. + t-ok diff --git a/tests/tests/hint-testsuite-triggers b/tests/tests/hint-testsuite-triggers new file mode 100755 index 0000000..f35dd43 --- /dev/null +++ b/tests/tests/hint-testsuite-triggers @@ -0,0 +1,10 @@ +#!/bin/bash +set -e +. tests/lib + +: "exists only to trigger ci.debian.net retests for some indirect deps" + +t-restrict hint-testsuite-triggers +t-dependencies NO-DEFAULT gnupg patch diffutils + +t-ok diff --git a/tests/tests/quilt-singlepatch b/tests/tests/quilt-singlepatch index 3b6e228..320a31c 100755 --- a/tests/tests/quilt-singlepatch +++ b/tests/tests/quilt-singlepatch @@ -36,4 +36,10 @@ debian-changes series END +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-ok diff --git a/tests/tests/version-opt b/tests/tests/version-opt index 22c35e7..2933912 100755 --- a/tests/tests/version-opt +++ b/tests/tests/version-opt @@ -14,7 +14,7 @@ git tag start t-dgit setup-mergechangelogs t-dgit build-source -t-dgit push --new +t-dgit push --new --overwrite t-archive-process-incoming sid |