chiark / gitweb /
test suite: tag-to-upload tests: Tolerate a changed git message
[dgit.git] / tests / tests / tagupl
index 0c88bda29b3765cdf7ae0576586b4136fa3fdd0a..e11ea5af7f463b0e2f753571a6c4404932e0e6c5 100755 (executable)
@@ -12,24 +12,25 @@ t-worktree 1.0
 
 v=1.0-1
 
-t-tagupl-settings
-
 cd $p
 git checkout -b native 
 
 git checkout --orphan upstream quilt-tip-2
 git rm -rf debian
 git commit -m 'pseudo-upstream'
-git tag upstream/1.0
+upstreamtag=UPSTREAM/RELEASE/1.0
+git tag $upstreamtag
 
 git checkout -B master quilt-tip-2
 
-upstream=$(git rev-parse upstream/1.0~0)
-tagname=test-dummy/$v
+t-tagupl-settings
 
-t-tagupl-test --no-push --quilt=gbp
+tagname=test-dummy/$v
 
-# xxx test pushing
+t-expect-fail "upstream tag $upstreamtag is not an ancestor of refs/heads/master" \
+t-tagupl-test --quilt=gbp --upstream=$upstreamtag
+t-tagupl-test --quilt=gbp --force --upstream=$upstreamtag
+t-pushed-good master
 
 # todo: test each miss/rejection
 
@@ -46,8 +47,6 @@ perl -i -ne '
        print or die $!;
 ' ../basetag
 
-git cat-file tag test-dummy/1.0-1 >../raw-base
-
 mv-ident () {
        local f=$tmp/$1
        if test -e $f; then
@@ -66,36 +65,37 @@ with-mangled () {
        perl <../basetag >../badtag-$ident -pe "$perl"
        git tag -u Senatus -f -s -m "$(cat ../badtag-$ident)" "$tagname"
 
-       t-tagupl-run-drs
+       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)
-       t-tagupl-run-drs
+       t-tagupl-run-drs $tmp/$p
 }
 
 tagname=test-dummy/1.2
 t-expect-fail E:'failed command: git fetch' \
-t-tagupl-run-drs
+t-tagupl-run-drs $tmp/$p
 
 tagname=splorf/$v     ; expect-quit baddistro '' 'tag name not for us'
 tagname=test-dummy/1,2; expect-quit badver    '' 'tag name not for us'
@@ -123,17 +123,38 @@ 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'
+
+v=1.0-2
+
+t-dch-commit -v $v -m bump
 
 expect-email upsmism 's/ upstream=/$&3/' \
        "but tag refers to"
 
+expect-email wrongpkg 's/^example /explosive /' 'mismatch: changelog Source'
+
 # we are going to trash $p because it will contain corrupted objects
 # which makes our end-of-test fsck fail
 cp -al ../$p ../$p.save
 cd ../$p
 
-tagname=test-dummy/1.0-1
+git cat-file tag $tagname >../raw-base
+
+next-mangle sigfail
+perl -pe <../raw-base >../tagobj-$ident 's/ split / split ignoreme /'
+raw-mangled
+grep 'gpgv: BAD signature' ../sendmail.log
+
+next-mangle nosig
+perl -ne <../raw-base >../tagobj-$ident 'print unless m/^-----/..0'
+raw-mangled
+grep 'missing signature' ../sendmail.log
+
+git cat-file tag test-dummy/1.0-1 >../raw-base
+
 next-mangle badtagger
 perl -pe <../raw-base '
        s/\+\d+$/xyz/ if m/^tagger /;