bazelbuild / bazelbuild/bazel

docs: --nocache_test_results may actually not always be required for coverage

Open
#15,611 7 comments 0 reactions 0 assignees View on GitHub
coverage help wanted P3 team-Documentation team-Rules-Server type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

https://bazel.google.cn/docs/coverage?hl=en#remote-execution
> 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.

While actually it seems that coverage information can be retrieved from remote cache (at least when test were run locally and only cached remotely?)

```console
$ bazel coverage //:something
//:something (cached) PASSED in 2.2s

/..../.cache/bazel/..../bazel-out/k8-fastbuild/testlogs/...../coverage.dat
```
`baseline_coverage.dat` file is also present

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

_No response_

### Which operating system are you running Bazel on?

NixOS

### What is the output of `bazel info release`?

release 5.1.1- (@non-git)

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

NixOS nixpkgs

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked Bazel coverage documentation and reproduce `bazel coverage //:something` with cached test results, comparing local and remote-cache behavior. Done means establishing whether `--nocache_test_results` is still required in this scenario and updating the coverage guidance with the supported behavior and reproduction details.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.