chiark / gitweb /
Test suite: Make t-expect-fail flexible wrt which grep to run
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 10 Jun 2015 17:11:24 +0000 (18:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 10 Jun 2015 17:11:24 +0000 (18:11 +0100)
Change the default to fgrep, and override it in the places where this
is needed.

Also use shell substitution to quote .s in tag name in
debpolicy-newreject.

tests/lib
tests/tests/debpolicy-newreject
tests/tests/trustingpolicy-replay

index 776e2a3e40f42bf426365d96f2894e57795044e7..332bef24414331a9bbd4f2774b1aabca5103dd0c 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -44,12 +44,25 @@ END
 
 t-expect-fail () {
        local mpat="$1"; shift
 
 t-expect-fail () {
        local mpat="$1"; shift
+
+       local grepper=fgrep
+       case "$mpat" in
+       [A-Z]:*)
+               case "$mpat" in
+               E:*)    grepper=egrep   ;;
+               F:*)    grepper=fgrep   ;;
+               *)      fail "bad mpat prefix in $mpat";;
+               esac
+               mpat=${mpat#[A-Z]:}
+               ;;
+       esac
+
        set +o pipefail
        LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output
        local gotstatus=${PIPESTATUS[0]}
        set -o pipefail
        test $gotstatus != 0
        set +o pipefail
        LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output
        local gotstatus=${PIPESTATUS[0]}
        set -o pipefail
        test $gotstatus != 0
-       egrep "$mpat" $tmp/t.output ||false
+       $grepper -e "$mpat" $tmp/t.output ||false
 }
 
 t-reporefs () {
 }
 
 t-reporefs () {
index bda869478059f0bc0638552607e558f214921841..82762bb4a2ec7aee479046e9a9b5c4d6fb4fd3a1 100755 (executable)
@@ -45,7 +45,7 @@ t-git-dir-check enoent
 t-commit 'should require --deliberately...questionable'
 t-dgit build
 
 t-commit 'should require --deliberately...questionable'
 t-dgit build
 
-t-expect-fail "tag debian/$vanished referred to this object.*all previously pushed versions were found to have been removed" \
+t-expect-fail E:"tag debian/${vanished//./\\.} 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
 t-git-dir-check enoent
 
index 4fc3c175bb5383faa81ad29836d13fb757ae2695..79674fefda2fce29ce48129dab5027bb407ae22b 100755 (executable)
@@ -47,7 +47,7 @@ prepare-replay () {
 
        t-commit "request with $delib that we will replay"
        t-dgit build
 
        t-commit "request with $delib that we will replay"
        t-dgit build
-       t-expect-fail "policy-hook.*No such file or directory" \
+       t-expect-fail E:'policy-hook.*No such file or directory' \
        t-dgit push $delib
 
        t-policy dgit-repos-policy-trusting
        t-dgit push $delib
 
        t-policy dgit-repos-policy-trusting