Skip to content

Fix coverage with MacOS autoconf toolchains#720

Open
UebelAndre wants to merge 1 commit into
bazelbuild:mainfrom
UebelAndre:collect_cc_coverage
Open

Fix coverage with MacOS autoconf toolchains#720
UebelAndre wants to merge 1 commit into
bazelbuild:mainfrom
UebelAndre:collect_cc_coverage

Conversation

@UebelAndre
Copy link
Copy Markdown
Contributor

@UebelAndre UebelAndre commented May 15, 2026

This change updates the autoconf toolchains for MacOS to search for llvm-profdata which is required to produce coverage. Toolchains which enable llvm code coverage but do not provide llvm-profdata will now see an explicit message explaining the configuration error.

relates to #613

@UebelAndre UebelAndre force-pushed the collect_cc_coverage branch from 3911f5d to e856912 Compare May 15, 2026 15:51
if darwin:
overridden_tools["gcc"] = "cc_wrapper.sh"
overridden_tools["ar"] = _find_generic(repository_ctx, "libtool", "LIBTOOL", overridden_tools)
xcrun = repository_ctx.which("xcrun")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keith curious if this is the recommended way to do this. I'd love to avoid invoking xcrun but this toolchain is already unique to the host so feels like it's aligned with the spirit of the toolchain.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the hermetic way to do it would be to make the tools shell scripts that run xcrun llvm-cov and then put the xcode env vars / execution_info on the actions, then the absolute path to xcode would be entirely separated.

as is i think this would make the toolchain sensitive to that path which probably isn't desirable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, definitely not desirable and I can make shell scripts. What do you mean "xcode env vars / execution info" does that currently exist (is that a fragment already)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@UebelAndre UebelAndre marked this pull request as ready for review May 15, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants