File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
src/test/shell/integration Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,22 @@ function test_no_javabase() {
267267 expect_log " bazel-bin/javabase_test/a.runfiles/local_jdk/bin/java: No such file or directory"
268268}
269269
270+ # Tests non-existent java_home path.
271+ function test_no_java_home_path() {
272+ cat << EOF >> WORKSPACE
273+ load("@bazel_tools//tools/jdk:local_java_repository.bzl", "local_java_repository")
274+ local_java_repository(
275+ name = "javabase",
276+ java_home = "$PWD /i-dont-exist",
277+ version = "11",
278+ )
279+ EOF
280+
281+ bazel build @javabase//... >& $TEST_log && fail " Build with missing java_home should fail."
282+ expect_log " The path indicated by the \" java_home\" attribute .* does not exist."
283+ }
284+
285+
270286function test_genrule() {
271287 cat << EOF > WORKSPACE
272288load("@bazel_tools//tools/jdk:local_java_repository.bzl", "local_java_repository")
Original file line number Diff line number Diff line change @@ -123,8 +123,8 @@ def _local_java_repository_impl(repository_ctx):
123123 java_home = repository_ctx .attr .java_home
124124 java_home_path = repository_ctx .path (java_home )
125125 if not java_home_path .exists :
126- fail ('The path indicated by the "java_home" attribute "%s" (absolute: "%s") ' +
127- "does not exist." % (java_home , str (java_home_path )))
126+ fail (( 'The path indicated by the "java_home" attribute "%s" (absolute: "%s") ' +
127+ "does not exist." ) % (java_home , str (java_home_path )))
128128
129129 repository_ctx .file (
130130 "WORKSPACE" ,
You can’t perform that action at this time.
0 commit comments