chiark / gitweb /
Tests: debpolicy-newreject: Explicitly check the state of the repo after each operation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 May 2015 23:30:46 +0000 (00:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:54:13 +0000 (11:54 +0100)
tests/lib
tests/tests/debpolicy-newreject

index 0933c4373d588c45e248f9c6185c2e16fad55086..fd06097bd090bf186826c14eced3b78573d5a315 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -179,6 +179,24 @@ t-git-dir-time-passes () {
        touch -d 'last year' $tmp/git/$p.git
 }
 
+t-git-dir-check () {
+       local gitdir=$tmp/git/$p.git
+       case "$1" in
+       enoent)
+               if test -e "$gitdir"; then fail "$gitdir exists"; fi
+               return
+               ;;
+       public) wantstat='7[75]5' ;;
+       secret) wantstat='7[70]0' ;;
+       *)      fail "$1 t-git-dir-check ?" ;;
+       esac
+       gotstat=`stat -c%a $gitdir`
+       case "$gotstat" in
+       *$wantstat) return ;;
+       *)      fail "$gitdir has mode $gotstat, expected $wantstat" ;;
+       esac
+}
+
 t-dgit () {
        local dgit=${DGIT_TEST-dgit}
        : '
index e4c9b00ef9948941b828e31e5f69cd85bb3b97ed..2a2e8f3afab577868c8547edb8fabcbd8abe31dd 100755 (executable)
@@ -18,13 +18,16 @@ t-policy-admin taint --global "$bad" "forbidden for testing"
 t-dgit build
 t-expect-fail 'forbidden for testing' \
 t-dgit push --new
+t-git-dir-check enoent
 
 git reset --hard HEAD~
 git commit --allow-empty -m 'will vanish from NEW'
 t-dgit build
 t-dgit push --new
+t-git-dir-check secret
 
 t-policy-periodic
+t-git-dir-check secret
 
 # pretend it vanished from new:
 rm $tmp/incoming/*
@@ -33,13 +36,16 @@ t-archive-none example
 t-git-dir-time-passes
 
 t-policy-periodic
+t-git-dir-check enoent
 
 git commit --allow-empty -m 'should require --deliberately...questionable'
 t-dgit build
 
 t-expect-fail 'tag debian/1.0 referred to this object.*all previously pushed versions were found to have been removed' \
 t-dgit push --new
+t-git-dir-check enoent
 
 t-dgit push --new --deliberately-include-questionable-history
+t-git-dir-check secret
 
 echo xxx up to here