如何将所有目标包括在巴泽尔的覆盖范围中

发布于 2025-02-01 21:18:24 字数 418 浏览 0 评论 0原文

如何在Bazel覆盖范围内包括非测试目标?目前,我使用以下Bazel命令获取代码覆盖范围:

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

该项目用C ++编写。该命令正常工作。但是,输出LCOV跟踪文件仅包括具有覆盖范围的文件。如果C文件没有测试,则不在LCOV跟踪文件中。

Bazel覆盖范围仅执行测试目标吗?有没有办法包括所有目标(非测试目标)?因此,即使文件没有测试,我仍然可以在报告中看到它(报告将显示零覆盖范围)。这样做的目的是,如果某人添加新文件并且不编写单元测试,则可以在覆盖范围报告中显示该文件。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

桜花祭 2025-02-08 21:18:24

您可以使用-compatible_cc_coverage重现吗?

Can you reproduce using --incompatible_cc_coverage?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文