8

我使用 gcov 库测量我的代码的覆盖率,我想以用户友好的格式生成覆盖率报告。我为此找到了 lcov 实用程序,但它与 Windows 环境不兼容(主要是因为解析路径的方式)。有谁知道积极支持 Windows 的 lcov 端口?

似乎让它在 Windows 上工作很容易(它认为它甚至可以通过一些模仿 unix shell 命令行为的创造性批处理/perl 脚本来解决),并且该工具非常有用,所以我想有人可能有已经做到了。

4

5 回答 5

4

这里有一个积极支持的 Windows lcov genhtml 端口:https ://github.com/RickSBrown/jgenhtml 。

它专门设计用于跨平台运行 - 路径中的反斜杠等没有问题。

于 2013-01-17T19:58:38.057 回答
2

虽然它可能很脏,但 lcov似乎在 cygwin 下工作。您可能还对如何测量 CppUnit 测试覆盖率(在 win32 和 Unix 上)这个问题感兴趣?及其答案。 Visual Studio似乎提供代码覆盖率报告。

于 2009-11-29T22:49:38.697 回答
2

还有一个 Windows 版本的 LCOV https://github.com/valbok/lcov解释了如何使用它。我们在使用本机或其他版本的 LCOV 时遇到了一些问题。例如从这里http://simply-embedded.blogspot.com/2014/07/code-coverage-html-reports-using-lcov.html

我们的流程是这样的:

  1. 使用 ARM QNX GCC 编译器在 Windows 中构建项目,收集 gcno 文件。

  2. 将二进制文件和配置复制到 QNX 下的目标并运行它们,收集 gcda 文件。

  3. Run LCOV (on Windows or Linux) to create reports.

In case of using native version of LCOV, reports will be broken due to mess up of windows and linux paths and some bugs inside LCOV scripts. We had to fix the scripts a bit to avoid problems like dir duplicates, slashes, broken paths etc.

于 2014-09-30T07:25:22.710 回答
0

Donald MacQueen 在http://www.macqueen.us/lcov.html下有一个 windows 版本,但我没有测试过。我制作了自己的版本,您可以在这里找到:http:
//simply-embedded.blogspot.com/2014/07/code-coverage-html-reports-using-lcov.html
这是在 LCOV 1.11 版上完成的。

于 2014-07-23T08:47:16.487 回答
0

There is an article here by Fred Grott that shows how to install lcov on windows using the Chocolatey package manager

于 2022-02-13T14:27:18.450 回答