android_local_test coverage reports only synthetic baseline data
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- android, java
- Domain
- mobile-dev, testing
Research direction
Start with the Starlark android_local_test rule and the test target //test/rules/android_local_test/java/com/starlark_resources:no_deps_with_resources. Trace how InstrumentedFilesInfo and the implicit _lcov_merger dependency are configured, then inspect collect_coverage.sh behavior when LCOV_MERGER is unset. Done means per-test coverage.dat and the combined LCOV report contain execution line and function coverage.
Written by the indexing model from the issue text.
Description
Running bazel coverage on a Starlark android_local_test succeeds, but no execution coverage is collected.
I reproduced this on current main at 1d4cc58 with Bazel 9.0.0rc3:
bazel coverage --combined_report=lcov --instrument_test_targets \
//test/rules/android_local_test/java/com/starlark_resources:no_deps_with_resources
The test passes, but its per-test coverage.dat is empty. The combined report contains only the synthetic baseline record:
SF:test/rules/android_local_test/java/com/starlark_resources/SampleTest.java
FNF:0
FNH:0
LH:0
LF:0
end_of_record
android_local_test returns InstrumentedFilesInfo, but it does not define the implicit _lcov_merger dependency required for Bazel test rules. Bazel therefore runs the test with JaCoCo instrumentation, then collect_coverage.sh sees that LCOV_MERGER is unset and exits without processing the intermediate coverage data.
Bazel documents the required test rule setup here:
https://bazel.build/extending/rules#test-rules
Adding the coverage merger dependency to android_local_test produces line and function coverage in both the per-test and combined LCOV reports.
This is related to #558, but that issue covers broader extensibility for alternative coverage tools. This issue is about the default Bazel coverage path producing no execution data.
- Dominant language
- Java
- Stars
- 203
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazelbuild/rules_android
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bazelbuild/rules_android#539 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bazelbuild/rules_android#535 · 2 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bazelbuild/rules_android#485 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
bazelbuild/rules_android#564 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
bazelbuild/rules_android#558 ·
All issues in bazelbuild/rules_android
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100