Skip to content

fix collect coverage script to work with recent changes#3812

Open
anonrig wants to merge 1 commit intobazelbuild:mainfrom
anonrig:yagiz/fix-collect_coverage
Open

fix collect coverage script to work with recent changes#3812
anonrig wants to merge 1 commit intobazelbuild:mainfrom
anonrig:yagiz/fix-collect_coverage

Conversation

@anonrig
Copy link

@anonrig anonrig commented Jan 20, 2026

Make sure RUNFILES_DIR also tries BAZEL_COVERAGE_INTERNAL_RUNFILES_DIR. This change ensures that we don't throw a fatal error and exit due to RUNFILES_DIR being empty.

In bazel 8, coverage collection script clears RUNFILES_DIR before calling language specific coverage collectors. The rules_rust collect_coverage tool was panicking because it required RUNFILES_DIR to be set.

@anonrig anonrig force-pushed the yagiz/fix-collect_coverage branch 2 times, most recently from 8df50f7 to 335b9ee Compare January 20, 2026 18:01
In Bazel 8+, RUNFILES_DIR may not be set during coverage post-processing.
This change:
- Makes RUNFILES_DIR optional, with fallback to BAZEL_COVERAGE_INTERNAL_RUNFILES_DIR
- Derives the bindir from COVERAGE_DIR when runfiles is unavailable
- Simplifies the test binary lookup logic
@anonrig anonrig force-pushed the yagiz/fix-collect_coverage branch from 335b9ee to cb9d412 Compare January 20, 2026 18:16
@illicitonion
Copy link
Collaborator

Sorry for the delay in getting to this!

I can't find any mention of BAZEL_COVERAGE_INTERNAL_RUNFILES_DIR in the Bazel source tree (either on master or on 8.5.1), or on Google - can you walk me through what sets this and why it's something we should be checking?

Also it looks like CI is currently failing due to a hopefully-trivial-to-fix clippy issue :)

@akhramov
Copy link

akhramov commented Feb 3, 2026

@illicitonion illicitonion added coverage expert-needed We lack maintainer expertise in this area. Contributions will need clear explanations & good tests. labels Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coverage expert-needed We lack maintainer expertise in this area. Contributions will need clear explanations & good tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants