bazel: C++ Coverage on Linux is broken
ATTENTION! Please read and follow:
- if this is a question about how to build / test / query / deploy using Bazel, or a discussion starter, send it to bazel-discuss@googlegroups.com
- if this is a bug or feature request, fill the form below as best as you can.
Description of the problem / feature request:
When I execute the bazel coverage command with version 0.24.1, I can generate a valid coverage.dat file, but when using a version higher than 0.24.1, the coverage.dat file is empty. This problem exists only when generating coverage for the C++ language.
$ ll bazel-testlogs/id_test/ total 3136 drwxr-xr-x 2 admin admin 4096 Sep 19 15:29 ./ drwxr-xr-x 3 admin admin 4096 Sep 19 15:07 …/ -r-xr-xr-x 1 admin admin 581600 Sep 19 15:07 baseline_coverage.dat* -r-xr-xr-x 1 admin admin 68477 Sep 19 15:29 coverage.dat* -r-xr-xr-x 1 admin admin 179 Sep 19 15:29 test.cache_status* -r-xr-xr-x 1 admin admin 2539566 Sep 19 15:29 test.log* -rw-r–r-- 1 admin admin 904 Sep 19 15:28 test.xml $ bazel version Build label: 0.24.1 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Tue Apr 2 16:29:26 2019 (1554222566) Build timestamp: 1554222566 Build timestamp as int: 1554222566
$ ll bazel-testlogs/id_test/ total 4108 drwxr-xr-x 2 admin admin 4096 Sep 19 15:25 ./ drwxr-xr-x 3 admin admin 4096 Sep 19 15:07 …/ -r-xr-xr-x 1 admin admin 581600 Sep 19 15:07 baseline_coverage.dat* -r-xr-xr-x 1 admin admin 0 Sep 19 15:25 coverage.dat* -r-xr-xr-x 1 admin admin 176 Sep 19 15:25 test.cache_status* -r-xr-xr-x 1 admin admin 3600923 Sep 19 15:25 test.log* -rw-r–r-- 1 admin admin 904 Sep 19 15:25 test.xml $ bazel version Build label: 0.25.0 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Wed May 1 21:45:01 2019 (1556747101) Build timestamp: 1556747101 Build timestamp as int: 1556747101
Replace this line with your answer.
Feature requests: what underlying problem are you trying to solve with this feature?
Replace this line with your answer.
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Replace this line with your answer.
What operating system are you running Bazel on?
Replace this line with your answer.
What’s the output of bazel info release
?
Replace this line with your answer.
If bazel info release
returns “development version” or “(@non-git)”, tell us how you built Bazel.
Replace this line with your answer.
What’s the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?
Replace this line with your answer.
Have you found anything relevant by searching the web?
Replace these lines with your answer.
Places to look:
- StackOverflow: http://stackoverflow.com/questions/tagged/bazel
- GitHub issues: https://github.com/bazelbuild/bazel/issues
- email threads on https://groups.google.com/forum/#!forum/bazel-discuss
Any other information, logs, or outputs that you want to share?
Replace these lines with your answer.
If the files are large, upload as attachment or provide link.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 46 (15 by maintainers)
Commits related to this issue
- Partially fix C++ coverage on Linux gcov 8.3.0 no longer prints "Creating <output>" messages, so we have to fall back to collecting all .gcov files in the current directory. Also, provide a mechanism... — committed to bazelbuild/bazel by ulfjack 4 years ago
- Fix GCC 9 Code coverage by adding its JSON format GCC 9 changed the intermediate format to a JSON based format and with it changed the meaning of the `-i` flag. Because of these changes it was not po... — committed to helaan/bazel by helaan 4 years ago
- Fix GCC 9 Code coverage by adding its JSON format GCC 9 changed the intermediate format to a JSON based format and with it changed the meaning of the `-i` flag. Because of these changes it was not po... — committed to helaan/bazel by helaan 4 years ago
- Fix GCC 9 Code coverage by adding its JSON format GCC 9 changed the intermediate format to a JSON based format and with it changed the meaning of the `-i` flag. Because of these changes it was not po... — committed to helaan/bazel by helaan 4 years ago
- Fix GCC 9 Code coverage by adding its JSON format GCC 9 changed the intermediate format to a JSON based format and with it changed the meaning of the `-i` flag. Because of these changes it was not po... — committed to helaan/bazel by helaan 4 years ago
- Fix GCC 9 Code coverage by adding its JSON format GCC 9 changed the intermediate format to a JSON based format and with it changed the meaning of the `-i` flag. Because of these changes it was not po... — committed to helaan/bazel by helaan 4 years ago
- Fix GCC 9 Code coverage by adding its JSON format GCC 9 changed the intermediate format to a JSON based format and with it changed the meaning of the `-i` flag. Because of these changes it was not po... — committed to helaan/bazel by helaan 4 years ago
- Fix GCC 9 Code coverage by adding its JSON format GCC 9 changed the intermediate format to a JSON based format and with it changed the meaning of the `-i` flag. Because of these changes it was not po... — committed to helaan/bazel by helaan 4 years ago
- Fix GCC 9 Code coverage by adding its JSON format GCC 9 changed the intermediate format to a JSON based format and with it changed the meaning of the `-i` flag. Because of these changes it was not po... — committed to bazelbuild/bazel by helaan 4 years ago
- Define Bazel coverage config Define configuration options for collecting coverage data with Bazel. The coverage command for Bazel is fairly fragile and many configurations do not work [1,2]. The `--... — committed to oliverlee/recorder by oliverlee 4 years ago
- Define Bazel coverage config Define configuration options for collecting coverage data with Bazel. The coverage command for Bazel is fairly fragile and many configurations do not work [1,2]. The `--... — committed to oliverlee/recorder by oliverlee 4 years ago
- Define Bazel coverage config Define configuration options for collecting coverage data with Bazel. The coverage command for Bazel is fairly fragile and many configurations do not work [1,2]. The `--... — committed to oliverlee/recorder by oliverlee 4 years ago
Really appreciate a fix here.
Not working on either Linux or Mac with Bazel 3.0.0.
Yes, there is a “test.log” file and there is “creating” text in the file. But the “coverage.dat” file is empty, when generated coverage with bazel version higher than 0.24.1.
$ ll bazel-testlogs/id_test/ total 4068 drwxr-xr-x 2 admin admin 4096 Sep 23 11:39 ./ drwxr-xr-x 4 admin admin 4096 Sep 20 20:34 …/ -r-xr-xr-x 1 admin admin 581600 Sep 19 15:07 baseline_coverage.dat* -r-xr-xr-x 1 admin admin 0 Sep 23 11:38 coverage.dat* -r-xr-xr-x 1 admin admin 176 Sep 23 11:39 test.cache_status* -r-xr-xr-x 1 admin admin 3563900 Sep 23 11:39 test.log* -rw-r–r-- 1 admin admin 912 Sep 23 11:38 test.xml
Some logs are as follows:
GCC 9.2.1 and bazel 3.3.1 is still not working. Got zero-sized coverage.dat.
Thank you for the fix! @helaan Do I use the right version?