instrumentation_filter doesn't control what files to be instrumented
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
When code coverage is enabled using --collect_code_coverage=True, no matter if a file matches the instrumentation_filter it will always be compiled with instrumentation flags turned on. isCodeCoverageEnabled in CcCimpilationHelper should be used to guard it in CcCommon.
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Run an aquery with instrumentation_filter and --collect_code_coverage=True on a target and verify that "-fprofile-instr-generate" and "-fcoverage-mapping" are always present no matter if the target match the instrumentation_filter or not.
### Which operating system are you running Bazel on?
linux
### What is the output of `bazel info release`?
development version
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
git clone https://github.com/bazelbuild/bazel.git
git checkout 3791b049d3db4c87dd0c02c3de2f52686fced0eb
the run bazel build //src:bazel
### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?
```text
git remote get-url origin: https://github.com/bazelbuild/bazel.git
git rev-parse master: 128e4b32d6279fd76d403d37be2a2d485a51acc1
git rev-parse HEAD: 3791b049d3db4c87dd0c02c3de2f52686fced0eb
```
### 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
Assessment
This issue has not been assessed yet.