X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=tests%2Ftests%2Ftagupl;h=80b92bee059d0f004fd3d56dfe05ded2cb0b325f;hb=2df5e989bcbb8d4d8510e4322f3db964e5b9ca9c;hp=c45f5e927d81086e87d79f9f6fdfab36796840e8;hpb=985cefa0cc7c74ec57954fc5fbd46af0bcf03297;p=dgit.git diff --git a/tests/tests/tagupl b/tests/tests/tagupl index c45f5e92..80b92bee 100755 --- a/tests/tests/tagupl +++ b/tests/tests/tagupl @@ -46,6 +46,19 @@ perl -i -ne ' print or die $!; ' ../basetag +mv-ident () { + local f=$tmp/$1 + if test -e $f; then + mv $f $f--$ident + fi +} + +next-mangle () { + mv-ident tagupl/overall.log + mv-ident sendmail.log + ident=$1 +} + with-mangled () { local perl=$1 perl <../basetag >../badtag-$ident -pe "$perl" @@ -55,14 +68,95 @@ with-mangled () { } expect-quit () { - mv ../tagupl/overall.log ../tagupl/overall.log-$ident - ident=$1 + next-mangle "$1" local perl=$2 local mstring=$3 with-mangled "$perl" grep ": $mstring" ../tagupl/overall.log } +expect-email () { + next-mangle "$1" + local perl=$2 + local mstring=$3 + with-mangled "$perl" + grep 'Was not successful' ../sendmail.log + grep "$mstring" ../sendmail.log + grep ": 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 +} + +tagname=test-dummy/1.2 +t-expect-fail E:'failed command: git fetch' \ +t-tagupl-run-drs + +tagname=splorf/$v ; expect-quit baddistro '' 'tag name not for us' +tagname=test-dummy/1,2; expect-quit badver '' 'tag name not for us' +tagname=test-dummy/$v + expect-quit noplease s/please-upload/plunk/ 'tag missing please-upload' +expect-email vermatch 's/^example release /$&3/' 'reject: version mismatch' + +expect-email unkinfo 's/^\[dgit please-upload/$& Rejectme/' \ + 'unknown dgit info in tag' + +expect-quit unkdistro 's/test-dummy/ubuntu/ if m/^\[dgit/' \ + 'not for this distro' + +expect-email notsplit 's/ split / no-split /' 'reject: missing "split"' + +expect-email upsnot1 's/ upstream=/ uxstream=/' \ + 'reject: upstream tag and not commitish' + +expect-email upsnot2 's/ upstream-tag=/ uxstream-tag=/' \ + 'reject: upstream tag and not commitish' + +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" + +expect-email upsmism 's/ upstream=/$&3/' \ + "but tag refers to" + +# 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 + +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 /; + exit 0 if m/^$/; +' >../tagobj-$ident +echo >>../tagobj-$ident +cat ../basetag >>../tagobj-$ident +raw-mangled +grep 'failed to fish tagger out of tag' ../tagupl/overall.log + +cd .. +rm -rf $p +mv $p.save $p + t-ok