fix(bazel): test/BUILD.bazel uses darwin_x86_64 instead of darwin condition, breaking //test:butil_unittests on Apple Silicon (darwin_arm64)

Open Beginner friendly
#3,763 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Read test/BUILD.bazel around lines 133–139 and compare the Darwin condition with the examples in the root BUILD.bazel. Run bazel test //test:butil_unittests on Apple Silicon to reproduce the Linux-only source compilation failure. Done when the Darwin condition excludes those sources on both Intel and Apple Silicon macOS.

Written by the indexing model from the issue text.

Description

Describe the bug

In test/BUILD.bazel (lines 133–139), TEST_BUTIL_SOURCES excludes the Linux-only unit test sources (test_file_util_linux.cc and proc_maps_linux_unittest.cc) using @bazel_tools//tools/osx:darwin_x86_64:

] + select({
    "@bazel_tools//tools/osx:darwin_x86_64": [],
    "//conditions:default": [
        "test_file_util_linux.cc",
        "proc_maps_linux_unittest.cc",
    ],
})

Unlike the root BUILD.bazel (which uses @bazel_tools//src/conditions:darwin at lines 93, 284, and 398 to match both Intel and Apple Silicon macOS), @bazel_tools//tools/osx:darwin_x86_64 only matches Intel macOS (x86_64).

On Apple Silicon (darwin_arm64), running bazel test //test:butil_unittests falls through to "//conditions:default" and attempts to compile test_file_util_linux.cc and proc_maps_linux_unittest.cc (failing on Linux-only headers such as <sys/vfs.h>).

Expected behaviour

test/BUILD.bazel should use @bazel_tools//src/conditions:darwin (consistent with the root BUILD.bazel) so bazel test //test:butil_unittests excludes the Linux-only source files on both darwin_x86_64 and darwin_arm64.

Dominant language
C++
Stars
17.6k
Forks
4.2k
Avg merge
3d 17h
Merged PRs (30d)
72

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/brpc

All issues in apache/brpc

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.