aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/test
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-06-11 07:47:30 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-11 07:48:57 -0700
commitbbf3e421ed8b2b431a72cd3ab4ba591dc8833634 (patch)
tree90bcfc1d665221e6fc6d938822c0da6229dc6e67 /tools/test
parent65173666790d6fff0190c196536d34743b419c12 (diff)
Add the ability to force the path to the test binary to a fixed length by using a symlink.
This is enabled with --test_env=TEST_SHORT_EXEC_PATH=true. Passing CI run: https://buildkite.com/bazel/google-bazel-presubmit/builds/3576 RELNOTES: N/A PiperOrigin-RevId: 200050318
Diffstat (limited to 'tools/test')
-rwxr-xr-xtools/test/test-setup.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh
index b403513f10..fda8f00e2e 100755
--- a/tools/test/test-setup.sh
+++ b/tools/test/test-setup.sh
@@ -32,6 +32,11 @@ function is_absolute {
[[ "$1" = /* ]] || [[ "$1" =~ ^[a-zA-Z]:[/\\].* ]]
}
+# The original execution root. Usually this script changes directory into the
+# runfiles directory, so using $PWD is not a reliable way to find the execution
+# root.
+EXEC_ROOT="$PWD"
+
# Bazel sets some environment vars to relative paths to improve caching and
# support remote execution, where the absolute path may not be known to Bazel.
# Convert them to absolute paths here before running the actual test.
@@ -213,6 +218,20 @@ else
TEST_PATH="$(rlocation $TEST_WORKSPACE/$EXE)"
fi
+# TODO(jsharpe): Use --test_env=TEST_SHORT_EXEC_PATH=true to activate this code
+# path to workaround a bug with long executable paths when executing remote
+# tests on Windows.
+if [ ! -z "$TEST_SHORT_EXEC_PATH" ]; then
+ # Use a short path like "t0" in the execution root. Use the smallest numeric
+ # suffix that doesn't collide with an existing file or directory.
+ QUALIFIER=0
+ while [[ -e "${EXEC_ROOT}/t${QUALIFIER}" ]]; do
+ ((QUALIFIER++))
+ done
+ ln -s "${TEST_PATH}" "${EXEC_ROOT}/t${QUALIFIER}"
+ TEST_PATH="${EXEC_ROOT}/t${QUALIFIER}"
+fi
+
exitCode=0
signals="$(trap -l | sed -E 's/[0-9]+\)//g')"
for signal in $signals; do