Coverage fails on MacOS and Windows after Bazel 9
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
Invoking `bazel coverage` on some `cc_test` targets results in [collect_cc_coverage.sh](https://github.com/bazelbuild/bazel/blob/c81d8ebcae859e49a4ea77e7f22a814087c0d87a/tools/test/collect_cc_coverage.sh) failing:
Macos:
```
external/bazel_tools/tools/test/collect_cc_coverage.sh: line 99: : command not found
error: coverage collection script failed
```
Windows:
```
GCov does not exist at the given path: 'external/+cc_configure_extension+local_config_cc/wrapper/bin/msvc_nop.bat'
error: coverage collection script failed
```
This is a cross-post of https://github.com/bazelbuild/rules_cc/issues/613 as the failure comes from [@bazel_tools//tools/test/collect_cc_coverage.sh](https://github.com/bazelbuild/bazel/blob/c81d8ebcae859e49a4ea77e7f22a814087c0d87a/tools/test/collect_cc_coverage.sh) which currently lives in core Bazel.
### Which category does this issue belong to?
C++ Rules
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Checkout `rules_cc` and run `bazel coverage //tests/runfiles:runfiles_test`
### Which operating system are you running Bazel on?
MacOS, Windows
### What is the output of `bazel info release`?
release 9.0.0
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
```text
```
### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start with tools/test/collect_cc_coverage.sh, especially the failure around line 99, and reproduce with bazel coverage //tests/runfiles:runfiles_test in rules_cc. Compare the MacOS and Windows failures under Bazel 9, then verify that coverage collection succeeds for the affected cc_test targets on both operating systems.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100