chiark / gitweb /
test suite: t-tstunt: When looking for real thing, strip stunt from PATH
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 Jan 2017 12:22:42 +0000 (12:22 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 Jan 2017 13:08:31 +0000 (13:08 +0000)
Otherwise if we run this again in a fresh environment, the wrapper may
be on PATH even though DGIT_TEST_REAL_<FOO> is not set.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/lib

index 1def3d36394892aabc9ca6774444aa5fedc90950..1af0288aeace7db78adc3b6518af4529dc1972af 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -801,7 +801,14 @@ t-tstunt--save-real () {
        local rc
        local real
        set +e
-       real=$(type -p "$f")
+       real=$(
+               p=":$PATH:"
+               p="${p/:"$tmp/tstunt":/:}"
+               p="${p%:}"
+               p="${p#:}"
+               PATH="$p"
+               type -p "$f"
+       )
        rc=$?
        set -e