Skip to content

[cov,ci] Ensure all generated sources are available for coverage#30145

Open
sasdf wants to merge 3 commits into
lowRISC:earlgrey_1.0.0from
sasdf:mgT189b3878
Open

[cov,ci] Ensure all generated sources are available for coverage#30145
sasdf wants to merge 3 commits into
lowRISC:earlgrey_1.0.0from
sasdf:mgT189b3878

Conversation

@sasdf
Copy link
Copy Markdown
Contributor

@sasdf sasdf commented May 18, 2026

This PR fixes missing generated files for coverage report generation due to remote-cache.

By default, bazel only downloads the artifacts of top-level targets (i.e. targets specified in cmdline) from the remote cache, including test result / compiled libs... These artifacts does not include generated sources used to during compilation in the dependencies.

However, coverage report generation is executed outside of bazel environment, which requires the source code to be present locally.

This PR solves this issue by collecting all sources into the coverage_sources output group, and request those files explicitly in CI before generating reports.


Note: bazel coverage also accepts --output-groups flag, but it won't download the files. We need to use bazel build to fetch from remote cache.

TEST: The tests in "CI / Coverage (quick) / Unit Tests (pull_request)" job are all cached, while its artifact contains generated sources correctly.

sasdf added 3 commits May 18, 2026 18:08
This aspect traverses the dependency graph to gather all files necessary
for coverage reporting. This specific output group can be explicitly
requested to ensure that the generated source files are available for
analysis.

Change-Id: I369c5a99937a98545d7d1909af05604905dca493
Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
Adds the `coverage_sources_aspect` to the `ot_coverage` configuration.
This aspect collects all source files into the `coverage_sources`
output group for coverage report generation.

Change-Id: I84e1394ae9007f4796d56dbeac25868182427abb
Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
When running Bazel coverage, some generated sources might not be
downloaded from remote cache if the test result is cached.

This commit adds a build step with `--output_groups=coverage_sources`
to ensure all relevant generated sources are available for coverage
reporting.

This is applied to both the `coverage-quick.yml` workflow and the
`run-fpga-tests.sh` script.

Change-Id: I189b3878c108db7bc3a94f97b9108664149a72ba
Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
@sasdf sasdf changed the title [wip,cov] test ci [cov,ci] Ensure all generated sources are available for coverage May 18, 2026
@sasdf sasdf marked this pull request as ready for review May 18, 2026 18:45
@sasdf sasdf requested a review from rswarbrick as a code owner May 18, 2026 18:45
Copy link
Copy Markdown
Contributor

@pamaury pamaury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a clever trick, but also a weird behaviour (yet another) of bazel.... Nice that you figured out a way!

@rswarbrick rswarbrick removed their request for review May 19, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants