Commit e2a6a2b 1 parent c2ddbd1 commit e2a6a2b Copy full SHA for e2a6a2b
File tree 2 files changed +18
-2
lines changed
src/test/shell/integration
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() {
267
267
expect_log " bazel-bin/javabase_test/a.runfiles/local_jdk/bin/java: No such file or directory"
268
268
}
269
269
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
+
270
286
function test_genrule() {
271
287
cat << EOF > WORKSPACE
272
288
load("@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):
123
123
java_home = repository_ctx .attr .java_home
124
124
java_home_path = repository_ctx .path (java_home )
125
125
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 )))
128
128
129
129
repository_ctx .file (
130
130
"WORKSPACE" ,
You can’t perform that action at this time.
0 commit comments