-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save test coverage data to bazel-testlogs. (#1387)
This lets `bazel coverage //some:test` produce a Go coverage data file in `bazel-testlogs/some/test/coverage.dat`. This file can be processed by normal Go coverage tooling to produce a coverage report. The change to `go/private/rules/test.bzl` needs some explanation -- Bazel only looks for coverage data if the test target has an `InstrumentedFilesProvider`, but this provider can currently only be created using "legacy" provider syntax. Old and new provider syntaxes can be combined by putting new-style providers in a `providers` field of the old-style struct. If the provider is found and at least one source file is present, Bazel will set the `COVERAGE_OUTPUT_FILE` environment variable during tests and will save that file to the build events + test outputs.
- Loading branch information
1 parent
2d33362
commit 6a2a5c5
Showing
3 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters