Skip to content

Commit

Permalink
Improve errors in integration tests when the local jdk is not found
Browse files Browse the repository at this point in the history
Related:

#21391 / #21392

#22228

Closes #22285.

PiperOrigin-RevId: 633466127
Change-Id: I6334c655607807073da2eda88b1fe66a81fb8ba7
  • Loading branch information
hvadehra authored and Copybara-Service committed May 14, 2024
1 parent bf2f762 commit 905a4fe
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,19 @@ function try_with_timeout() {

function setup_localjdk_javabase() {
if [[ $PLATFORM =~ msys ]]; then
jdk_dir="$(cygpath -m $(cd $(rlocation local_jdk/bin/java.exe)/../..; pwd))"
jdk_binary=local_jdk/bin/java.exe
else
jdk_dir="$(dirname $(dirname $(rlocation local_jdk/bin/java)))"
jdk_binary=local_jdk/bin/java
fi
jdk_binary_rlocation=$(rlocation ${jdk_binary})
if [[ -z "${jdk_binary_rlocation}" ]]; then
echo "error: failed to find $jdk_binary, make sure you have java \
installed or pass --java_runtime_verison=XX with the correct version" >&2
fi
if [[ $PLATFORM =~ msys ]]; then
jdk_dir="$(cygpath -m $(cd ${jdk_binary_rlocation}/../..; pwd))"
else
jdk_dir="$(dirname $(dirname ${jdk_binary_rlocation}))"
fi
bazel_javabase="${jdk_dir}"
}
Expand Down

0 comments on commit 905a4fe

Please sign in to comment.