Skip to content

Commit 7ff6833

Browse files
committed
Allow test_all.sh to pass under Bazel 7
`bash ./test_all.sh` passes after minor updates to the following test cases to handle slightly different behavior under Bazel 7: - `test_custom_reporter_class_has_been_set` makes the test output dir writable, since it no longer is by default. - `test_scala_import_expect_failure_on_missing_direct_deps_warn_mode` removes preexisting output, since Bazel 7 won't emit warnings if it already exists. --- FYI: Under Bazel 7.0 and Bazel 7.1, buildifier warnings for external targets in the following test cases changed to begin with `@@repo_name` instead of `@repo_name`: - test/shell/test_scala_library.sh: `test_scala_library_expect_failure_on_missing_direct_external_deps_jar` `test_scala_library_expect_failure_on_missing_direct_external_deps_file_group` - test/shell/test_strict_dependency.sh: `test_stamped_target_label_loading` `test_strict_deps_filter_included_target` - test/shell/test_test_unused_dependency.sh: `test_unused_deps_filter_included_target` However, as of Bazel 7.2, those warnings changed back to `@repo_name`, so those changes aren't reflected in this commit.
1 parent 14d3fa6 commit 7ff6833

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

test/shell/test_custom_reporter_class.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ test_custom_reporter_class_has_been_set() {
2222
bazel test test/scala_test:custom_reporter
2323
set +e
2424
reporter_output_dir="$(bazel info bazel-testlogs)/test/scala_test/custom_reporter/test.outputs"
25+
chmod u+w "$reporter_output_dir" # Needed under Bazel 7
2526
reporter_output_filepath="${reporter_output_dir}/${custom_reporter_check_file}"
2627
unzip -oq "${reporter_output_dir}/outputs.zip" -d "${reporter_output_dir}"
2728
assert_file_exists "${reporter_output_filepath}"
2829
}
2930

30-
$runner test_custom_reporter_class_has_been_set
31+
$runner test_custom_reporter_class_has_been_set

test/shell/test_strict_dependency.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ test_scala_import_expect_failure_on_missing_direct_deps_warn_mode() {
2121
dependency_target2='//test_expect_failure/scala_import:guava'
2222
test_target='test_expect_failure/scala_import:scala_import_propagates_compile_deps'
2323

24+
# Bazel 7 won't emit warnings if the output already exists.
25+
rm -f "$(bazel info bazel-bin)/${test_target/://}"*
26+
2427
local expected_message1="buildozer 'add deps $dependency_target1' //$test_target"
2528
local expected_message2="buildozer 'add deps $dependency_target2' //$test_target"
2629

0 commit comments

Comments
 (0)