Description of the problem / feature request:
I am doing some coverage test on bazel-example project, but I failed to get coverage file:
- build project with coverage related options
git clone https://github.com/bazelbuild/examples/ bazel_examples
cd bazel_examples/cpp-tutorial/stage1
bazel build -s --copt="-coverage" --linkopt="-lgcov" //main:hello-world
The result shows build command runs successfully, but no coverage files(*.gcno) are generated.
Then I run the binary output, but no runtime coverage files(*.gcda) are generated too.
I am using bazel 3.5.0, gcc 9.4.0, Ubuntu 18.04.5.
Does any one know how to resolve this?
man gcc, the option should be named--coverage, with two minus signs. However,bazel coverageshould be your go-to tool, it should do the rest for you.