Skip to content

android_local_test coverage reports only synthetic baseline data #560

Description

@bala-evani-ai

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions