X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=tests%2Flib;h=cf8b72569dfdabc2368c0f49f4762cc4dede8128;hp=0ae9bbc281374fc4b1f23b92aa54f3799e48b712;hb=3f112ef280d8d10152089fcae772f5edd707817c;hpb=84026aec1f98aaeb69a751c89a25c55b355c7ee8 diff --git a/tests/lib b/tests/lib index 0ae9bbc2..cf8b7256 100644 --- a/tests/lib +++ b/tests/lib @@ -2,6 +2,7 @@ exec 2>&1 set -x +set -o pipefail . tests/lib-core @@ -43,8 +44,11 @@ END t-expect-fail () { local mpat="$1"; shift + set +o pipefail LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output - test ${PIPESTATUS[0]} != 0 + local gotstatus=${PIPESTATUS[0]} + set -o pipefail + test $gotstatus != 0 egrep "$mpat" $tmp/t.output ||false } @@ -245,7 +249,7 @@ t-git-get-ref () { refs/*) ;; *) fail "t-git-get-ref bad $ref" ;; esac - git show-ref -d $1 | perl -ne ' + (git show-ref -d $1 || test $? = 1) | perl -ne ' $x = $1 if m#^(\w+) \Q'$1'\E(?:\^\{\})?$#; END { print "$x\n" if length $x; } ' @@ -370,8 +374,9 @@ t-ref-dsc-dgit () { t-apply-diff () { local v1=$1 local v2=$2 - (cd $troot/pkg-srcs; debdiff ${p}_${v1}.dsc ${p}_${v2}.dsc) \ - | patch -p1 -u + (cd $troot/pkg-srcs; + debdiff ${p}_${v1}.dsc ${p}_${v2}.dsc || test $? = 1) \ + | patch -p1 -u } t-commit () {