diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-05-03 12:02:42 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-05-31 11:54:10 +0100 |
commit | e270c55f02ce8839a6a2f4fbc316b213e4eaa9d1 (patch) | |
tree | 091e3123d08b92ee2a7c3efb14971aa84a9832ae /tests/adhoc | |
parent | 6913c854ca0f3eb901c39c74b74d7f0344318f72 (diff) |
Tests: New tests/adhoc helper; document tests/using-intree too
Diffstat (limited to 'tests/adhoc')
-rwxr-xr-x | tests/adhoc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/adhoc b/tests/adhoc new file mode 100755 index 0000000..f252602 --- /dev/null +++ b/tests/adhoc @@ -0,0 +1,49 @@ +#!/bin/bash +# +# usage: +# after tests/tests/some-test has been run (and maybe failed) +# cd tests/tmp/some-test/blah +# ../../adhoc ../../../dgit some options +# or +# after tests/tests/some-test has been run (and maybe failed) +# cd tests/tmp/some-test/blah +# ../../adhoc some rune run by some piece of infrastructure +# +# effects: +# directly sets the env variables which arrange to use +# progrmas etc. from the working tree + +ourname=adhoc + +case $0 in +*/$ourname) + : ${DGIT_TEST_INTREE:=$(realpath "${0%/$ourname}/..")} + ;; +*) + echo >&2 "$ourname must be invoked as .../$ourname not $0" + exit 127 + ;; +esac + +export DGIT_TEST_INTREE + +. $DGIT_TEST_INTREE/tests/lib-core + +t-set-intree + +pwd=$(realpath "$(pwd)") +basis=$DGIT_TEST_INTREE/tests/tmp +case "$pwd" in +"$basis" | "$basis"/*) + testname=${pwd/"$basis/"/} + testname=${testname%%/*} + tmp="$basis/$testname" + ;; +*) + fail "$ourname pwd must be inside some test (in $basis), not $pwd" + ;; +esac + +export ADTTMP=$tmp HOME=$tmp DGIT_TEST_DUMMY_DIR=$tmp DGIT_TEST_TMP=$tmp + +exec "$@" |