bazelbuild / bazelbuild/bazel

default GCOV_PREFIX_STRIP value incorrect on macOS

Open
#23,719 3 comments 0 reactions 1 assignee Claimed by @c-mita View on GitHub
coverage P2 team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

When generating coverage on macOS and when using a gcc toolchain or an llvm toolchain configured to emit gcov, gcda files are not found unless `GCOV_PREFIX_STRIP` is set.

I'm able to set up the correct gcda path with `GCOV_PREFIX_STRIP=10`, although I don't know if that is specific to my laptop.

There are my `.bazelrc` settings for a hermetic LLVM toolchain:
```
coverage:gcov --experimental_generate_llvm_lcov=false
coverage:gcov --features=-coverage
coverage:gcov --copt=-coverage
coverage:gcov --linkopt=-coverage
coverage:gcov --test_env=GCOV_PREFIX_STRIP=10
coverage:gcov --test_env=COVERAGE_GCOV_PATH=./external/llvm18_toolchain_llvm/bin/llvm-cov
```

Can the documentation for this be improved in some way? And is it possible to use a better default value for macOS?

### Which category does this issue belong to?

_No response_

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

_No response_

### Which operating system are you running Bazel on?

_No response_

### What is the output of `bazel info release`?

_No response_

### 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` ?

_No response_

### 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?

https://github.com/bazelbuild/bazel/blob/2df98cb5eaf1cb1ad08555c0e0c21390deae28c2/tools/test/collect_coverage.sh#L91-L92
https://github.com/bazelbuild/bazel/discussions/19144

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.