简体   繁体   中英

How to include all targets in bazel coverage

How do I include non-test targets in bazel coverage? Currently I use the following bazel command to get code coverage:

bazel coverage \
  --instrument_test_targets \
  --experimental_cc_coverage \
  --combined_report=lcov \
  //... --test_arg=--logtostderr

The project is written in C++. The command works fine. However, the output lcov trace file only includes the files that have coverage. If a C file does not have a test, it is not in the lcov trace file.

Does bazel coverage only executes the test targets? Is there a way to include all targets (the non-test targets)? So that even if a file has no test, I can still see it in the report (the report will show zero coverage). The intention for this is that if someone adds new files and doesn't write unit test, the file can be shown in coverage report.

Can you reproduce using --incompatible_cc_coverage?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM