X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=tests%2Flib;h=bd83be70a69d930a54af356a763c4ad2071718e0;hb=dccb73b082268949abbc074e9fe89d6ec294fd15;hp=c51c4a6146a50230fed33afc80a41f78e222a08c;hpb=fa22d8f771e63ca6fc17dea716980aa0faaf8f2f;p=dgit.git diff --git a/tests/lib b/tests/lib index c51c4a61..bd83be70 100644 --- a/tests/lib +++ b/tests/lib @@ -7,6 +7,20 @@ set -o pipefail . tests/lib-core . tests/lib-restricts +t-report-failure () { + set +x + rc=$1 + cat <&2 +TEST FAILED +funcs: ${FUNCNAME[*]} +lines: ${BASH_LINENO[*]} +files: ${BASH_SOURCE[*]} +END + exit 16 +} + +trap 'test $? = 0 || t-report-failure' EXIT + t-set-intree : ${DGIT_TEST_DEBUG=-D} @@ -48,6 +62,8 @@ incoming = $tmp/incoming run_dinstall = 0 END +: ${tagpfx:=test-dummy} + t-git-next-date () { GIT_COMMITTER_DATE="$(( ${GIT_COMMITTER_DATE%% *} + 1 )) ${GIT_COMMITTER_DATE#* }" GIT_AUTHOR_DATE="$GIT_COMMITTER_DATE" @@ -237,7 +253,8 @@ t-archive-updated () { "filename" => "$4", }; END { - print to_json \@v or die $!; + my $json = JSON->new->canonical(); + print $json->encode(\@v) or die $!; } ' } @@ -385,7 +402,8 @@ t-ref-same-val () { case "$t_ref_val" in '') ;; "$val") ;; - *) fail "ref varies: $name: $val != $t_ref_val" ;; + *) fail "ref varies: $name:\ + ${val:-nothing} != ${t_ref_val:-nothing}" ;; esac t_ref_val="$val" } @@ -412,7 +430,7 @@ t-refs-notexist () { } t-v-tag () { - echo refs/tags/test-dummy/${v//\~/_} + echo refs/tags/$tagpfx/${v//\~/_} } t-check-pushed-master () { @@ -513,9 +531,9 @@ t-apply-diff () { } t-gbp-unapplied-pq2qc () { - # does `gbp pq export' (leaving us on BRANCH (eg "quilt-tip")) + # does `gbp pq export' # commits the resulting debian/patches on qc/BRANCH - # goes back to patch-queue/BRANCH + # leaves us on qc/BRANCH (eg "qc/quilt-tip")) # qc/BRANCH is not fast-forwarding gbp pq export @@ -531,7 +549,6 @@ t-gbp-unapplied-pq2qc () { git checkout qc/$branch git add debian/patches git commit -m 'Commit patch queue' - git checkout patch-queue/$branch } t-gbp-example-prep () { @@ -553,6 +570,10 @@ t-gbp-example-prep () { t-gbp-unapplied-pq2qc t-commit 'some updates' 1.0-2 + + git merge -s ours \ + -m 'Pseudo-merge to make descendant of archive' \ + remotes/dgit/dgit/sid } t-commit () { @@ -573,6 +594,7 @@ t-drs () { t-git-config dgit-distro.test-dummy.git-url "ext::$troot/drs-git-ext %S " t-git-config dgit-distro.test-dummy.git-check true t-git-config dgit-distro.test-dummy.git-create true + t-git-config dgit-distro.test-dummy.dgit-tag-format old,new cp $troot/gnupg/{dd.gpg,dm.gpg,dm.txt} $tmp/. cp $troot/suites $tmp/. cp $troot/suites $tmp/suites-master @@ -594,6 +616,14 @@ t-drs () { ln -sf /bin/true $drs_dispatch/policy-hook } +t-newtag () { + export tagpfx=archive/test-dummy + t-git-config dgit-distro.test-dummy.dgit-tag-format new +} +t-oldtag () { + t-git-config dgit-distro.test-dummy.dgit-tag-format old +} + t-dsd () { t-drs t-git-config dgit-distro.test-dummy.ssh "$troot/dsd-ssh"