Merge branch 'jk/http-auth-tests-robustify'
[gitweb.git] / t / test-lib.sh
index c3e07b9e162d6ec6984e07d1ea8061c14658642a..1cf78d5b113e0ddac8cdda9b8bc9b49db7b43451 100644 (file)
@@ -26,6 +26,10 @@ then
        # outside of t/, e.g. for running tests on the test library
        # itself.
        TEST_DIRECTORY=$(pwd)
+else
+       # ensure that TEST_DIRECTORY is an absolute path so that it
+       # is valid even if the current working directory is changed
+       TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
 fi
 if test -z "$TEST_OUTPUT_DIRECTORY"
 then