chiark / gitweb /
Tests: break out some things into lib-core (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 3 May 2015 11:02:09 +0000 (12:02 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:54:10 +0000 (11:54 +0100)
tests/lib
tests/lib-core [new file with mode: 0644]
tests/using-intree

index 4435b55c4b72825818643e88542e03b77e87e3d7..0e188cca4280e83cf1f3de309198901c226b8cf7 100644 (file)
--- 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 (file)
index 0000000..98ae85f
--- /dev/null
@@ -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}"
+}
index 26d5812c22728c42206c8b09ce8da20b6e60dc8b..b9072527e46dd5e8620831910b2756ba40e1b514 100755 (executable)
@@ -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 "$@"