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.
Running
bazel coverageon a Starlarkandroid_local_testsucceeds, but no execution coverage is collected.I reproduced this on current
mainat1d4cc58with Bazel9.0.0rc3:The test passes, but its per-test
coverage.datis empty. The combined report contains only the synthetic baseline record:android_local_testreturnsInstrumentedFilesInfo, but it does not define the implicit_lcov_mergerdependency required for Bazel test rules. Bazel therefore runs the test with JaCoCo instrumentation, thencollect_coverage.shsees thatLCOV_MERGERis 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_testproduces 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.