Query regarding bazel coverage with cache #25476
roshan-rubrik
started this conversation in
General
Replies: 1 comment
-
documentation link: https://bazel.build/versions/7.4.0/configure/coverage |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been testing coverage collection with Bazel and wanted to share my findings in response to a point noted in the Bazel documentation on coverage.
Documentation Claim: 🧑⚖️
The documentation mentions:
"Bazel will currently fail to create coverage information if tests have been cached previously. To work around this, --nocache_test_results can be set specifically for coverage runs, although this of course incurs a heavy cost in terms of test times."
My Observations: 🔬
In my experiments, I ran bazel coverage with and without caching enabled and consistently received correct results. Specifically, when I made changes to the tests, Bazel correctly re-ran those tests and utilized the build cache effectively. It worked flawlessly, even with cached test results.
Confusion About Documentation: 😕
Given my successful results, I am puzzled by the documentation's assertion that Bazel fails to generate coverage information with cached test results. My experience suggests that it functions as expected without needing to disable cache specifically for coverage runs.
Environment Details:
Bazel version: 7.1.0
Command used:
bazel coverage --keep_going --build_tests_only <other_flags> --@io_bazel_rules_go//go/config:cover_format=go_cover -- <targets>
Question ❓
Has anyone else encountered a similar discrepancy between the documentation and actual behavior? If there are specific scenarios where this issue manifests, I would appreciate any insights. Otherwise, it might be worth revisiting the documentation to reflect its correct functionality.
Looking forward to your thoughts and experiences!
Beta Was this translation helpful? Give feedback.
All reactions