Open bmeoaountiful opened 10 months ago
What are you observing? Is the output coverage.dat
file empty?
Bazel does not normally track the .gcda
files after test execution; the .gcda
files are not part of the official coverage output. But you can force it to output everything into a directory under bazel-testlogs
with --experimental_fetch_all_coverage_outputs
bazel coverage --experimental_fetch_all_coverage_outputs //foo:bar
$ find bazel-testlogs/foo/bar/_coverage
[gcno, files gcda files, and other files]
I have been looking for a way to get the .gcna
files for months. It seemed as if bazel was "eating" the .gcda
and .gcov.json.gz
files (because the .gcno
files were sitting in the _objs
directories, right where they should be.
THANK YOU!!!
experimental_fetch_all_coverage_outputs
yes, the output coverage.data is empty. and there is no .gcda file when bazel coverage
with --experimental_fetch_all_coverage_outputs
.
A few questions:
--config=cuda
?cc_test
targets?@bmeoaountiful Without knowing your application I would check how your application shuts down. If its not a graceful shutdown (like you kill your application) it happens that gcov (maybe other coverage tool) can not flush coverage point hits.
By the way, in C/C++ you can do a manual flush in the code directly with:
extern "C" void __gcov_flush(); //I think this become depracted in later versions and you may have to use __gcov_dump()...
To avoid putting this function call in production code I suggest to put the call behind compile switch.
I am doing some coverage test on xla project. The result shows test command runs successfully, and coverage files(*.gcno) are generat. but no runtime .gcda file generate,
I am using bazel 6.1.0. os Ubuntu20.04 Does any one know how to resolve this?