[bazel,cov] Fix missing generated files due to coverage remote-cache #29567
[bazel,cov] Fix missing generated files due to coverage remote-cache #29567sasdf wants to merge 3 commits into
Conversation
4f091b7 to
ccf6d23
Compare
The coverage report generation requires source files to be present locally. When using remote caching, some source files might not be present in the local workspace. This change adds a utility script `util/fetch-remote-cache.py` that: 1. Resolves the remote cache URL from Bazel configuration. 2. Parses the Bazel action cache to map file paths to content hashes. 3. Fetches missing files directly from the remote cache's CAS. Change-Id: Ifedad80d526862c07616c2e9d6cec3169c7e3675 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
The coverage report generation requires source files to be present locally. When using remote caching, some source files might not be present in the local workspace. The `collect-coverage-report.sh` script is updated to invoke this utility before attempting to rsync source files into the report directory. Change-Id: I16e41e78c3ffd07f5926dffdd37f868fca4f1c92 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
This ensures that the output directories are empty before we start collecting data, avoiding potential issues with stale data from previous runs. Change-Id: I8eaba03e802c1703183fc8c93e0f7c1d5e6463f4 Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
|
I am not super familiar with the coverage handling in bazel, but it sounds a bit strange that some files would be downloaded by bazel. Is this a bazel bug/misfeature? Or is possibly because of some missing dependency tracking in the rules? It doesn't sound great to require to manually download from the 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 includes generated sources used to during compilation in the dependencies. However, generating the coverage reports requires the source code. This download behavior is configured by the --remote_download_outputs, which supports:
|
|
Close this since we found a better solution using aspect: |
The coverage report generation requires source files to be present locally. When using remote caching, some source files might not be present in the local workspace.
This change adds a utility script
util/fetch-remote-cache.pythat:The
collect-coverage-report.shscript is updated to invoke this utility before attempting to rsync source files into the report directory.