diff options
author | Philipp Wollermann <philwo@google.com> | 2016-07-14 15:10:10 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2016-07-14 17:46:04 +0000 |
commit | a03599225c010739e9d2e852400f1fdc94f8ee91 (patch) | |
tree | 6d2bf024e104b58c04ef7412ee42f7eca94959ce /tools/test | |
parent | 0e7a4171b13c9332bd278a3a9b70699af551853a (diff) |
StandaloneTestStrategy: Use relative paths for environmental variables related to tests.
This allows for better caching and also makes it easy to run tests in a different directory than the global execroot.
The paths are rewritten to absolute paths in test-setup.sh, because Test Encyclopedia says that we pass absolute paths to tests in these variables.
--
MOS_MIGRATED_REVID=127432675
Diffstat (limited to 'tools/test')
-rwxr-xr-x | tools/test/test-setup.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh index 8ea4fc57b6..6714c792d5 100755 --- a/tools/test/test-setup.sh +++ b/tools/test/test-setup.sh @@ -20,6 +20,19 @@ exec 2>&1 # Executing the test log will page it. echo 'exec ${PAGER:-/usr/bin/less} "$0" || exit 1' +# Bazel sets some environment vars to relative paths, but it's easier to deal +# with absolute paths once we're actually running the test, so let's convert +# them. +if [[ "$TEST_SRCDIR" != /* ]]; then + export TEST_SRCDIR="$PWD/$TEST_SRCDIR" +fi +if [[ "$TEST_TMPDIR" != /* ]]; then + export TEST_TMPDIR="$PWD/$TEST_TMPDIR" +fi +if [[ "$XML_OUTPUT_FILE" != /* ]]; then + export XML_OUTPUT_FILE="$PWD/$XML_OUTPUT_FILE" +fi + # Tell googletest about Bazel sharding. if [[ -n "${TEST_TOTAL_SHARDS+x}" ]] && ((TEST_TOTAL_SHARDS != 0)); then export GTEST_SHARD_INDEX="${TEST_SHARD_INDEX}" |