From: Ian Jackson Date: Sun, 3 May 2015 11:02:09 +0000 (+0100) Subject: Tests: break out some things into lib-core (nfc) X-Git-Tag: debian/0.30~188 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=6913c854ca0f3eb901c39c74b74d7f0344318f72;hp=f6cd040652129d18f3d7fe53b6bb62e5d0c79ec1 Tests: break out some things into lib-core (nfc) --- diff --git a/tests/lib b/tests/lib index 4435b55c..0e188cca 100644 --- a/tests/lib +++ b/tests/lib @@ -3,13 +3,9 @@ exec 2>&1 set -x -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 +. tests/lib-core + +t-set-intree : ${DGIT_TEST_DEBUG:=-D} export DGIT_TEST_DEBUG @@ -45,11 +41,6 @@ incoming = $tmp/incoming run_dinstall = 0 END -fail () { - echo >&2 "failed: $*" - exit 1 -} - t-expect-fail () { local mpat="$1"; shift LC_MESSAGES=C "$@" 2>&1 | tee $tmp/t.output diff --git a/tests/lib-core b/tests/lib-core new file mode 100644 index 00000000..98ae85f5 --- /dev/null +++ b/tests/lib-core @@ -0,0 +1,16 @@ +# + +fail () { + echo >&2 "failed: $*" + exit 1 +} + +t-set-intree () { + if [ "x$DGIT_TEST_INTREE" = x ]; then return; fi + : ${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 + export PERLLIB="$DGIT_TEST_INTREE${PERLLIB:+:}${PERLLIB}" +} diff --git a/tests/using-intree b/tests/using-intree index 26d5812c..b9072527 100755 --- a/tests/using-intree +++ b/tests/using-intree @@ -1,5 +1,5 @@ #!/bin/bash set -e pwd=`pwd` -export DGIT_TEST_INTREE="$pwd" PERLLIB="$pwd${PERLLIB:+:}${PERLLIB}" +export DGIT_TEST_INTREE="$pwd" exec "$@"