chiark / gitweb /
Memoise git config lookups (big speedup!)
[dgit.git] / tests / lib
index 7cd8062cae3c7d1b6671832bce1197a9d35a587a..1179fb093f8ed48535c60a5eaaf52fc7ae9de481 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -58,6 +58,13 @@ t-expect-fail () {
        *)      fail "tee failed"  ;;
        esac
 
+       t-grep-mpat "$mpat" $tmp/t.output
+}
+
+t-grep-mpat () {
+       local mpat="$1"
+       local file="$2"
+
        local grepper=fgrep
        case "$mpat" in
        [A-Z]:*)
@@ -70,8 +77,8 @@ t-expect-fail () {
                ;;
        esac
 
-       $grepper -e "$mpat" $tmp/t.output ||
-               fail "error message not found"
+       $grepper -e "$mpat" "$file" ||
+               fail "message not found"
 }
 
 t-expect-push-fail () {
@@ -104,11 +111,12 @@ t-git-objects-not-present () {
 
 t-reporefs () {
        local whichoutput=$1; shift
+       local whichrepo=${1-$dgitrepo}
        local outputfile="$tmp/show-refs.$whichoutput"
        (set -e
         exec >"$outputfile"
-        if test -d $dgitrepo; then
-               cd $dgitrepo
+        if test -d $whichrepo; then
+               cd $whichrepo
                git show-ref |sort
        fi)
 }
@@ -293,6 +301,15 @@ t-diff-nogit () {
        diff --exclude=.git --exclude=.pc -ruN $*
 }
 
+t-files-notexist () {
+       local f
+       for f in "$@"; do
+               if [ -e $f ]; then
+                       fail "$f exists!"
+               fi
+       done
+}
+
 t-cloned-fetched-good () {
        t-diff-nogit ../extract/$p-${v%-*} .
        t-clean-on-branch dgit/sid
@@ -419,6 +436,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