X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=tests%2Flib;h=cb5c6498830382a296788d627702a4925cd5ff7b;hp=1516646f23ae1d239be725cb0ccf468afa8ca00f;hb=8c6bf5e74ef133792ac87ccfa2a57041b7dbfe49;hpb=475e31b775275ac895e21afa4143c10596b512d1 diff --git a/tests/lib b/tests/lib index 1516646f..cb5c6498 100644 --- a/tests/lib +++ b/tests/lib @@ -7,6 +7,7 @@ if [ "x$DGIT_TEST_INTREE" != x ]; then : ${DGIT_TEST:=$DGIT_TEST_INTREE/dgit} : ${DGIT_REPOS_SERVER_TEST:=$DGIT_TEST_INTREE/infra/dgit-repos-server} : ${DGIT_SSH_DISPATCH_TEST:=$DGIT_TEST_INTREE/infra/dgit-ssh-dispatch} + : ${DGIT_INFRA_PFX:=$DGIT_TEST_INTREE${DGIT_TEST_INTREE:+/infra/}} export DGIT_TEST DGIT_REPOS_SERVER_TEST DGIT_SSH_DISPATCH_TEST fi @@ -22,9 +23,9 @@ if [ x"$tmp" = x ]; then mkdir $tmp fi cd $tmp -export HOME=$tmp tmp=`pwd` +export HOME=$tmp export DGIT_TEST_DUMMY_DIR=$tmp ln -f $troot/ssh ssh @@ -46,6 +47,13 @@ fail () { exit 1 } +t-expect-fail () { + local mpat="$1"; shift + LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output + test ${PIPESTATUS[0]} != 0 + egrep "$mpat" $tmp/t.output ||false +} + t-untar () { local tarfile=$1.tar local edittree=$1.edit @@ -81,7 +89,20 @@ t-has-ancestor () { if [ x$mbase != x$ancestor ]; then fail "not ff $ancestor..$now, $mbase != $ancestor" fi -} +} + +t-prep-newpackage () { + p=$1 + v=$2 + t-archive-none $p + t-git-none + v=3-1 + t-worktree $v + cd $p + git branch -m dgit/sid master + git remote rm dgit + cd .. +} t-archive-none () { p=$1 @@ -333,6 +354,20 @@ t-dsd () { echo 'no-such-package* drs' >$dsd_dispatch/diverts } +t-policy-admin () { + ${DGIT_INFRA_PFX}dgit-repos-admin-debian --repos $tmp/git "$@" +} + +t-debpolicy () { + t-dsd + + ln -sf ${DGIT_INFRA_PFX}dgit-repos-policy-debian \ + $dsd_dispatch/policy-hook + + mkdir $tmp/git + t-policy-admin create-db +} + t-chain-test () { local ct=$1 local d=${0%/*}