aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-06-12 08:07:19 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-12 08:08:27 -0700
commit2eff4fdbd1dd89877098010ab3f672687fc008b6 (patch)
tree87ce872bc5afc6b9c9747b79f471ae8d4eb74d1d /tools
parent45e28e50172583ef2a62804979cb515b85c46462 (diff)
For languages that use launchers, there are some requirements about files other than the main executable being co-located with the executable: 1. For Python, the .zip file must be alongside the executable. 2. For Shell, the shell file must be alongside the exe. In addition, a .exe suffix is needed for launchers. Tested that cc_test (non-launcher), java_test, py_test, sh_test (all launchers) work remotely when using the TEST_SHORT_EXEC_PATH env var. RELNOTES: N/A PiperOrigin-RevId: 200216308
Diffstat (limited to 'tools')
-rwxr-xr-xtools/test/test-setup.sh20
1 files changed, 15 insertions, 5 deletions
diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh
index fda8f00e2e..d8f2a47b67 100755
--- a/tools/test/test-setup.sh
+++ b/tools/test/test-setup.sh
@@ -222,14 +222,24 @@ fi
# 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
+ BASE="${EXEC_ROOT}/t${QUALIFIER}"
+ while [[ -e "${BASE}" || -e "${BASE}.exe" || -e "${BASE}.zip" ]]; do
((QUALIFIER++))
+ BASE="${EXEC_ROOT}/t${QUALIFIER}"
done
- ln -s "${TEST_PATH}" "${EXEC_ROOT}/t${QUALIFIER}"
- TEST_PATH="${EXEC_ROOT}/t${QUALIFIER}"
+
+ # Note for the commands below: "ln -s" is equivalent to "cp" on Windows.
+
+ # Needs to be in the same directory for sh_test. Ignore the error when it
+ # doesn't exist.
+ ln -s "${TEST_PATH%.*}" "${BASE}" 2>/dev/null
+ # Needs to be in the same directory for py_test. Ignore the error when it
+ # doesn't exist.
+ ln -s "${TEST_PATH%.*}.zip" "${BASE}.zip" 2>/dev/null
+ # Needed for all tests.
+ ln -s "${TEST_PATH}" "${BASE}.exe"
+ TEST_PATH="${BASE}.exe"
fi
exitCode=0