chiark / gitweb /
Test suite: In drs tests, check that master gets updated
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Jul 2015 19:53:11 +0000 (20:53 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Jul 2015 20:40:47 +0000 (21:40 +0100)
tests/lib

index 77c15d4..9fc056e 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -141,10 +141,14 @@ t-git-none () {
        (set -e; cd $tmp/git; tar xf $troot/git-template.tar)
 }
 
+t-git-merge-base () {
+       git merge-base $1 $2 || test $? = 1
+}
+
 t-has-ancestor () {
        local now=`git rev-parse HEAD`
        local ancestor=`git rev-parse $1^{}`
-       local mbase=`git merge-base $ancestor $now`
+       local mbase=`t-git-merge-base $ancestor $now`
        if [ x$mbase != x$ancestor ]; then
                fail "not ff $ancestor..$now, $mbase != $ancestor"
        fi
@@ -380,6 +384,15 @@ t-v-tag () {
        echo refs/tags/test-dummy/${v//\~/_}
 }
 
+t-check-pushed-master () {
+       local master=`t-git-get-ref refs/heads/master`
+       if [ x$master = x$t_ref_val ]; then return; fi
+       if [ x$master = x ]; then fail "failed to push master"; fi
+       # didn't update master, it must be not FF
+       local mbase=`t-git-merge-base $master $t_ref_val`
+       if [ x$mbase = x$master ]; then fail "failed to ff master"; fi
+}
+
 t-pushed-good () {
        local branch=$1
        t-ref-dsc-dgit
@@ -394,6 +407,7 @@ t-pushed-good () {
         t-refs-same \
                refs/dgit/sid \
                `t-v-tag`
+        ${t_check_pushed_master:- : NOT-DRS-NO-CHECK-PUSHED-MASTER}
         t-refs-notexist \
                refs/dgit/unstable
        )
@@ -486,6 +500,9 @@ t-drs () {
  t-git-config dgit-distro.test-dummy.git-create true
        cp $troot/gnupg/{dd.gpg,dm.gpg,dm.txt} $tmp/.
        cp $troot/suites $tmp/.
+       cp $troot/suites $tmp/suites-master
+
+       export t_check_pushed_master=t-check-pushed-master
 
        drs_dispatch=$tmp/distro=test-dummy
        mkdir $drs_dispatch
@@ -495,7 +512,7 @@ t-drs () {
        fi
 
        ln -sf $tmp/git $drs_dispatch/repos
-       ln -sf $tmp/suites $tmp/dm.txt $drs_dispatch/
+       ln -sf $tmp/suites $tmp/suites-master $tmp/dm.txt $drs_dispatch/
        mkdir -p $drs_dispatch/keyrings
        ln -sf $tmp/dd.gpg $drs_dispatch/keyrings/debian-keyring.gpg
        ln -sf $tmp/dm.gpg $drs_dispatch/keyrings/debian-maintainers.gpg