chiark / gitweb /
Test suite: Introduce tests/list-tests
[dgit.git] / tests / lib
index 469b8fc2cf97f15e2f92ee37b5da816f91b22af5..d131e7b2a8dc4a6328a32d8cb1016135a896ba58 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -5,6 +5,7 @@ set -x
 set -o pipefail
 
 . tests/lib-core
+. tests/lib-restricts
 
 t-set-intree
 
@@ -436,6 +437,16 @@ t-pushed-good () {
        git verify-tag `t-v-tag`
 }
 
+t-commit-build-push-expect-log () {
+       local msg=$1
+       local mpat=$2
+       t-commit "$msg"
+       t-dgit build
+       LC_MESSAGES=C \
+       t-dgit push --new 2>&1 |tee $tmp/push.log
+       t-grep-mpat "$mpat" $tmp/push.log
+}
+
 t-822-field () {
        local file=$1
        local field=$2
@@ -557,14 +568,20 @@ t-policy-nonexist () {
        ln -sf no-such-file-or-directory $drs_dispatch/policy-hook
 }
 
-t-policy () {
-       local policyhook=$1
-       policyhook=${DGIT_INFRA_PFX}$policyhook
-       case $policyhook in
+t-make-hook-link () {
+       local hook=$1 # in infra/
+       local linkpath=$2
+       hook=${DGIT_INFRA_PFX}$hook
+       case $hook in
        */*)    ;;
-       *)      policyhook=`type -P $policyhook` ;;
+       *)      hook=`type -P $hook` ;;
        esac
-       ln -sf "$policyhook" $drs_dispatch/policy-hook
+       ln -sf "$hook" $linkpath
+}
+
+t-policy () {
+       local policyhook=$1
+       t-make-hook-link $policyhook $drs_dispatch/policy-hook
 }
 
 t-debpolicy () {
@@ -580,6 +597,11 @@ t-policy-periodic () {
                test-dummy $drs_dispatch '' --cron
 }
 
+t-restrict () {
+       local restriction=$1
+       (cd $root; t-restriction-$restriction >&2)
+}
+
 t-chain-test () {
        local ct=$1
        local d=${0%/*}