Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable tests on macOS #21381

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .bazelci/postsubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,25 +188,12 @@ tasks:
- "//tools/aquery_differ/..."
- "//tools/python/..."
- "//tools/bash/..."
# C++ coverage is not supported on macOS yet.
- "-//src/test/shell/bazel:bazel_cc_code_coverage_test"
# MacOS does not have cgroups so it can't support hardened sandbox
- "-//src/test/java/com/google/devtools/build/lib/sandbox:CgroupsInfoTest"
- "-//src/test/shell/integration:bazel_hardened_sandboxed_worker_test"
- "-//src/test/shell/integration:bazel_sandboxed_worker_with_cgroups_test"
- "-//src/test/shell/integration:bazel_worker_with_cgroups_test"
# https://github.com/bazelbuild/bazel/issues/16526
- "-//src/test/shell/bazel:starlark_repository_test"
# https://github.com/bazelbuild/bazel/issues/17407
- "-//src/test/shell/bazel/apple:bazel_apple_test"
# https://github.com/bazelbuild/bazel/issues/17408
- "-//src/test/shell/bazel/apple:bazel_objc_test"
# https://github.com/bazelbuild/bazel/issues/17410
- "-//src/test/java/com/google/devtools/build/lib/platform:SystemMemoryPressureEventTest"
# https://github.com/bazelbuild/bazel/issues/17411
- "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:PatchApiBlackBoxTest"
# https://github.com/bazelbuild/bazel/issues/17447
- "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:GitRepositoryBlackBoxTest"
# https://github.com/bazelbuild/bazel/issues/17456
- "-//src/test/shell/bazel:bazel_determinism_test"
# https://github.com/bazelbuild/bazel/issues/17457
Expand Down Expand Up @@ -249,37 +236,6 @@ tasks:
- "//tools/aquery_differ/..."
- "//tools/python/..."
- "//tools/bash/..."
# C++ coverage is not supported on macOS yet.
- "-//src/test/shell/bazel:bazel_cc_code_coverage_test"
# MacOS does not have cgroups so it can't support hardened sandbox
- "-//src/test/java/com/google/devtools/build/lib/sandbox:CgroupsInfoTest"
- "-//src/test/shell/integration:bazel_hardened_sandboxed_worker_test"
- "-//src/test/shell/integration:bazel_sandboxed_worker_with_cgroups_test"
- "-//src/test/shell/integration:bazel_worker_with_cgroups_test"
# https://github.com/bazelbuild/bazel/issues/16525
- "-//src/test/java/com/google/devtools/build/lib/buildtool:KeepGoingTest"
- "-//src/test/java/com/google/devtools/build/lib/buildtool:DanglingSymlinkTest"
- "-//src/test/java/com/google/devtools/build/lib/buildtool:CompileOneDependencyIntegrationTest"
- "-//src/test/java/com/google/devtools/build/lib/buildtool:SkymeldBuildIntegrationTest"
- "-//src/test/java/com/google/devtools/build/lib/rules/objc:BazelJ2ObjcLibraryTest"
- "-//src/test/java/com/google/devtools/build/lib/skyframe/rewinding:RewindingTest"
- "-//src/test/java/com/google/devtools/build/lib/buildtool:MiscAnalysisTest"
- "-//src/test/java/com/google/devtools/build/lib/rules/objc:ObjcRulesTests"
# https://github.com/bazelbuild/bazel/issues/17007
- "-//src/test/java/com/google/devtools/build/lib/platform:SystemMemoryPressureEventTest"
# https://github.com/bazelbuild/bazel/issues/16521 & https://github.com/bazelbuild/bazel/issues/18776
- "-//src/test/shell/bazel/android/..."
- "-//src/tools/android/java/com/google/devtools/build/android/..."
- "-//src/test/java/com/google/devtools/build/android/dexer:AllTests"
# Macs can't find python, so these fail: https://github.com/bazelbuild/bazel/issues/18776
- "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test"
- "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools"
- "-//src/test/shell/bazel/android:aapt_integration_test"
- "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools"
# https://github.com/bazelbuild/bazel/issues/17411
- "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:PatchApiBlackBoxTest"
# https://github.com/bazelbuild/bazel/issues/17447
- "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:GitRepositoryBlackBoxTest"
include_json_profile:
- build
- test
Expand Down
144 changes: 53 additions & 91 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@ tasks:
- "//tools/aquery_differ/..."
- "//tools/python/..."
- "//tools/bash/..."
# C++ coverage is not supported on macOS yet.
- "-//src/test/shell/bazel:bazel_cc_code_coverage_test"
# MacOS does not have cgroups so it can't support hardened sandbox
- "-//src/test/java/com/google/devtools/build/lib/sandbox:CgroupsInfoTest"
- "-//src/test/shell/integration:bazel_hardened_sandboxed_worker_test"
- "-//src/test/shell/integration:bazel_sandboxed_worker_with_cgroups_test"
- "-//src/test/shell/integration:bazel_worker_with_cgroups_test"
# https://github.com/bazelbuild/bazel/issues/16526
- "-//src/test/shell/bazel:starlark_repository_test"
# https://github.com/bazelbuild/bazel/issues/17407
Expand All @@ -207,10 +200,6 @@ tasks:
# https://github.com/bazelbuild/bazel/issues/17410
- "-//src/test/java/com/google/devtools/build/lib/platform:SystemMemoryPressureEventTest"
# https://github.com/bazelbuild/bazel/issues/17411
- "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:PatchApiBlackBoxTest"
# https://github.com/bazelbuild/bazel/issues/17447
- "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:GitRepositoryBlackBoxTest"
# https://github.com/bazelbuild/bazel/issues/17456
- "-//src/test/shell/bazel:bazel_determinism_test"
# https://github.com/bazelbuild/bazel/issues/17457
- "-//src/test/shell/bazel:jdeps_test"
Expand All @@ -219,6 +208,59 @@ tasks:
- "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools"
- "-//src/test/shell/bazel/android:aapt_integration_test"
- "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools"
# Disable the top 50 most time-consuming tests on macOS Intel platform in presubmit.
# Those tests are still covered in postsubmit and by macOS arm64 platform in presubmit.
# To run any of the following test in presubmit, just comment out the corresponding line.
- "-//src/test/shell/bazel:bazel_bootstrap_distfile_test"
- "-//src/test/shell/bazel:bazel_bootstrap_distfile_tar_test"
- "-//src/test/shell/bazel/android:android_integration_test"
- "-//src/test/shell/bazel/android:android_integration_test_with_head_android_tools"
- "-//src/test/shell/bazel:bazel_proto_library_test"
- "-//src/test/py/bazel:runfiles_test"
- "-//src/test/shell/integration:loading_phase_tests"
- "-//src/test/py/bazel:bazel_module_test"
- "-//src/test/shell/integration:target_compatible_with_test"
- "-//src/test/shell/integration:bazel_json_worker_test"
- "-//src/test/shell/bazel:bazel_coverage_java_jdk17_toolchain_head_test"
- "-//src/test/shell/bazel:bazel_java_test_jdk11_toolchain_head"
- "-//src/test/shell/bazel/android:aar_integration_test"
- "-//src/test/shell/bazel:bazel_coverage_java_test"
- "-//src/test/shell/bazel:bazel_coverage_java_jdk11_toolchain_head_test"
- "-//src/test/shell/bazel:bazel_java_test_jdk17_toolchain_head"
- "-//src/test/shell/bazel:starlark_git_repository_test"
- "-//src/test/shell/integration:build_event_stream_test"
- "-//third_party/ijar/test:zip_test"
- "-//src/test/java/com/google/devtools/build/lib/rules/java:JavaStarlarkApiTest"
- "-//src/test/shell/bazel:bazel_java_tools_test"
- "-//src/test/shell/bazel/remote:build_without_the_bytes_test"
- "-//src/test/shell/integration:bazel_sandboxed_worker_test"
- "-//src/test/shell/integration:client_test"
- "-//src/test/shell/bazel/remote:remote_execution_test"
- "-//src/test/shell/bazel:bazel_coverage_java_jdk17_toolchain_released_test"
- "-//src/test/py/bazel:bazel_vendor_test"
- "-//src/test/shell/integration:sandboxing_test"
- "-//src/test/shell/bazel:bazel_java_test"
- "-//src/test/py/bazel:bzlmod_query_test"
- "-//src/test/shell/bazel/android:desugarer_integration_test"
- "-//src/test/shell/bazel/android:android_local_test_integration_test"
- "-//src/test/shell/bazel/android:desugarer_integration_test_with_head_android_tools"
- "-//src/test/py/bazel:bazel_external_repository_test"
- "-//src/test/shell/bazel/android:resource_processing_integration_test"
- "-//src/test/shell/bazel:bazel_coverage_java_jdk11_toolchain_released_test"
- "-//src/test/shell/bazel/android:aar_integration_test_with_head_android_tools"
- "-//src/test/shell/bazel/android:android_local_test_integration_test_with_head_android_tools"
- "-//src/tools/singlejar:zip64_test"
- "-//src/test/py/bazel:launcher_test"
- "-//src/test/shell/integration:bazel_worker_test"
- "-//src/test/py/bazel:py_test"
- "-//src/test/shell/bazel:bazel_test_test"
- "-//src/test/py/bazel:bazel_overrides_test"
- "-//src/test/shell/bazel:path_mapping_test"
- "-//src/test/shell/integration:toolchain_test"
- "-//src/test/shell/integration:execution_phase_tests"
- "-//src/test/shell/bazel/android:resource_processing_integration_test_with_head_android_tools"
- "-//src/test/shell/integration:aquery_test"
- "-//src/test/py/bazel:mod_command_test"
include_json_profile:
- build
- test
Expand Down Expand Up @@ -253,90 +295,10 @@ tasks:
- "//tools/aquery_differ/..."
- "//tools/python/..."
- "//tools/bash/..."
# C++ coverage is not supported on macOS yet.
- "-//src/test/shell/bazel:bazel_cc_code_coverage_test"
# MacOS does not have cgroups so it can't support hardened sandbox
- "-//src/test/java/com/google/devtools/build/lib/sandbox:CgroupsInfoTest"
- "-//src/test/shell/integration:bazel_hardened_sandboxed_worker_test"
- "-//src/test/shell/integration:bazel_sandboxed_worker_with_cgroups_test"
- "-//src/test/shell/integration:bazel_worker_with_cgroups_test"
# https://github.com/bazelbuild/bazel/issues/16525
- "-//src/test/java/com/google/devtools/build/lib/buildtool:KeepGoingTest"
- "-//src/test/java/com/google/devtools/build/lib/buildtool:DanglingSymlinkTest"
- "-//src/test/java/com/google/devtools/build/lib/buildtool:CompileOneDependencyIntegrationTest"
- "-//src/test/java/com/google/devtools/build/lib/buildtool:SkymeldBuildIntegrationTest"
- "-//src/test/java/com/google/devtools/build/lib/rules/objc:BazelJ2ObjcLibraryTest"
- "-//src/test/java/com/google/devtools/build/lib/skyframe/rewinding:RewindingTest"
- "-//src/test/java/com/google/devtools/build/lib/buildtool:MiscAnalysisTest"
- "-//src/test/java/com/google/devtools/build/lib/rules/objc:ObjcRulesTests"
# https://github.com/bazelbuild/bazel/issues/17007
- "-//src/test/java/com/google/devtools/build/lib/platform:SystemMemoryPressureEventTest"
# Disable the most time-consuming tests on macOS arm64 platform in presubmit.
# To run any of the following test in presubmit, just comment out the corresponding line.
# TODO(pcloudy): Re-enable when Apple Silicon machine waiting time is no longer the major
# bottleneck for presubmit.
- "-//src/test/shell/bazel:bazel_determinism_test"
- "-//src/test/shell/bazel:jdeps_test"
- "-//src/test/shell/bazel:starlark_git_repository_test"
- "-//src/test/shell/bazel:bazel_bootstrap_distfile_tar_test"
- "-//src/test/shell/integration:bazel_json_worker_test"
- "-//src/test/py/bazel:runfiles_test"
- "-//src/test/py/bazel:launcher_test"
- "-//src/test/py/bazel:bazel_module_test"
- "-//src/test/shell/bazel:bazel_java_test_jdk11_toolchain_head"
- "-//src/test/shell/integration:target_compatible_with_test"
- "-//src/test/py/bazel:py_test"
- "-//src/test/py/bazel:bzlmod_query_test"
- "-//src/test/py/bazel:cc_import_test"
- "-//src/test/shell/bazel/remote:build_without_the_bytes_test"
- "-//src/test/shell/bazel:bazel_coverage_java_test"
- "-//src/test/py/bazel:bazel_yanked_versions_test"
- "-//src/test/shell/bazel:bazel_coverage_java_jdk17_toolchain_head_test"
- "-//src/test/shell/bazel:bazel_proto_library_test"
- "-//src/test/shell/bazel:bazel_java_tools_test"
- "-//src/test/shell/integration:build_event_stream_test"
- "-//src/test/py/bazel:bazel_overrides_test"
- "-//src/test/shell/bazel:cc_integration_test"
- "-//src/test/shell/bazel:bazel_java_test"
- "-//src/test/java/com/google/devtools/build/lib/rules/config:ConfigRulesTests"
- "-//src/test/shell/bazel:bazel_java_test_jdk17_toolchain_head"
- "-//src/test/shell/integration:bazel_worker_test"
- "-//src/test/shell/bazel:tags_propagation_native_test"
- "-//src/test/shell/bazel:bazel_coverage_java_jdk11_toolchain_head_test"
- "-//src/test/shell/integration:bazel_sandboxed_worker_test"
- "-//src/test/py/bazel:bazel_repo_mapping_test"
- "-//src/test/shell/bazel:bazel_coverage_java_jdk11_toolchain_released_test"
- "-//src/test/py/bazel:bazel_workspace_test"
- "-//src/test/shell/bazel:execroot_test"
- "-//src/test/shell/bazel:starlark_repository_test"
- "-//src/test/shell/bazel:bazel_coverage_java_jdk17_toolchain_released_test"
- "-//src/test/shell/bazel/remote:remote_execution_test"
- "-//src/test/shell/integration:toolchain_test"
- "-//src/test/shell/bazel:bazel_test_test"
- "-//src/test/shell/integration:test_test"
- "-//src/test/shell/bazel:bazel_execlog_test"
- "-//src/test/shell/integration:modify_execution_info_test"
- "-//src/test/shell/bazel:external_integration_test"
- "-//src/test/py/bazel:bazel_external_repository_test"
- "-//src/test/shell/bazel:bazel_workspaces_test"
- "-//src/test/shell/integration:client_test"
- "-//src/test/shell/bazel:workspace_resolved_test"
- "-//src/test/shell/bazel:bazel_repository_cache_test"
- "-//src/test/shell/integration:aquery_test"
- "-//src/test/shell/integration:py_args_escaping_test"
# https://github.com/bazelbuild/bazel/issues/16521 & https://github.com/bazelbuild/bazel/issues/18776
- "-//src/test/shell/bazel/android/..."
- "-//src/tools/android/java/com/google/devtools/build/android/..."
- "-//src/test/java/com/google/devtools/build/android/dexer:AllTests"
# Macs can't find python, so these fail: https://github.com/bazelbuild/bazel/issues/18776
- "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test"
- "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools"
- "-//src/test/shell/bazel/android:aapt_integration_test"
- "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools"
# https://github.com/bazelbuild/bazel/issues/17411
- "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:PatchApiBlackBoxTest"
# https://github.com/bazelbuild/bazel/issues/17447
- "-//src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace:GitRepositoryBlackBoxTest"
include_json_profile:
- build
- test
Expand Down
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ test:ci-macos --test_env=REPOSITORY_CACHE=/Users/buildkite/bazeltest/repo_cache
test:ci-macos --test_env=REMOTE_NETWORK_ADDRESS=bazel.build:80
test:ci-macos --sandbox_writable_path=/Users/buildkite/bazeltest
test:ci-macos --sandbox_default_allow_network=false
test:ci-macos --test_tag_filters=-no_macos

## For Windows
common:ci-windows --config=ci-common
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* <p>1. We are creating some git repository with the preset contents, which will be used for
* fetching contents for the test. We plan to fetch contents specifying either commit hash, tag, or
* branch. For all test variants, we are creating the same repository, as the same HEAD commit is
* marked with a tag, and can be addressed with commit hash, master branch, and tag name.
* marked with a tag, and can be addressed with commit hash, main branch, and tag name.
*
* <p>2. The contents of the git repository working tree is generated by {@link
* RepoWithRuleWritingTextGenerator}. We pass some certain text to that generator; that exact text
Expand Down Expand Up @@ -123,7 +123,7 @@ public void testCloneAtCommit() throws Exception {
* general approach description in the class javadoc comment.
*/
@Test
public void testCloneAtMaster() throws Exception {
public void testCloneAtMain() throws Exception {
Path repo = context().getTmpDir().resolve("ext_repo");
setupGitRepository(context(), repo);

Expand All @@ -138,7 +138,7 @@ public void testCloneAtMaster() throws Exception {
"new_git_repository(",
" name='ext',",
String.format(" remote='%s',", PathUtils.pathToFileURI(repo.resolve(".git"))),
" branch='master',",
" branch='main',",
String.format(" build_file_content=\"\"\"%s\"\"\",", buildFileContent),
")");

Expand All @@ -158,7 +158,7 @@ public void testCheckoutOfCommitFromBranch() throws Exception {
Path repo = context().getTmpDir().resolve("branch_repo");
GitRepositoryHelper gitRepository = initGitRepository(context(), repo);

context().write(repo.resolve("master.marker").toString());
context().write(repo.resolve("main.marker").toString());
gitRepository.addAll();
gitRepository.commit("Initial commit");

Expand All @@ -171,10 +171,10 @@ public void testCheckoutOfCommitFromBranch() throws Exception {
gitRepository.commit("Commit in branch");
String branchCommitHash = gitRepository.getHead();

gitRepository.checkout("master");
gitRepository.checkout("main");
generator.withOutputText(HELLO_FROM_EXTERNAL_REPOSITORY).setupRepository();
gitRepository.addAll();
gitRepository.commit("Commit in master");
gitRepository.commit("Commit in main");

context()
.write(
Expand Down Expand Up @@ -203,7 +203,7 @@ public void testCheckoutOfCommitFromTag() throws Exception {
Path repo = context().getTmpDir().resolve("tag_repo");
GitRepositoryHelper gitRepository = initGitRepository(context(), repo);

context().write(repo.resolve("master.marker").toString());
context().write(repo.resolve("main.marker").toString());
gitRepository.addAll();
gitRepository.commit("Initial commit");

Expand All @@ -217,14 +217,14 @@ public void testCheckoutOfCommitFromTag() throws Exception {
gitRepository.tag("tag1");
String tagCommitHash = gitRepository.getHead();

gitRepository.checkout("master");
gitRepository.checkout("main");

// delete branch, so that the last commit is not an any branch.
gitRepository.deleteBranch("demonstrate_branch");

generator.withOutputText(HELLO_FROM_EXTERNAL_REPOSITORY).setupRepository();
gitRepository.addAll();
gitRepository.commit("Commit in master");
gitRepository.commit("Commit in main");

context()
.write(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ void init() throws Exception {
runGit("init");
runGit("config", "user.email", "me@example.com");
runGit("config", "user.name", "E X Ample");
runGit("commit", "--allow-empty", "-m", "Initial commit");
runGit("branch", "-M", "main");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void setUpPatchTestRepo(
"index 1f4c41e..9d548ff 100644",
"--- a/foo.sh",
"+++ b/foo.sh",
"@@ -1,3 +1,3 @@",
"@@ -1,4 +1,4 @@",
" #!/usr/bin/env sh",
"",
"-echo Here be dragons...",
Expand Down
Loading
Loading