简体   繁体   English

使用MinGW的Qt Creator中的代码覆盖率

[英]Code coverage in Qt Creator using MinGW

How to generate and view code coverage using Qt Creator with MinGW on Windows ? 如何在Windows上使用带有MinGW的 Qt Creator生成和查看代码覆盖率?

I'm already able to generate it using GCOV and LCOV on OS X with the following flags in my .pro file: 我已经可以在OS X上使用GCOVLCOV.pro文件中使用以下标志来生成它:

mac {
    QMAKE_CXXFLAGS += --coverage
    QMAKE_LFLAGS += --coverage
}

I have accomplished that by following this tutorial . 通过遵循本教程 ,我已经做到了。

What tools/flags should I use to generate and view the code coverage on Windows? 我应该使用哪些工具/标志来生成和查看Windows上的代码覆盖率?

Note : on OS X I'm using Clang. 注意 :在OS X上,我正在使用Clang。


Update : 更新

I have successfully generated the GCNO and GCDA files, but I don't know how can I access/visualize the code coverage properly. 我已经成功生成了GCNOGCDA文件,但是我不知道如何正确访问/可视化代码覆盖率。

As far as I know, LCOV doesn't work on Windows. 据我所知, LCOV在Windows上不起作用。

I found the Ported to Windows LCOV Code Coverage tool project on Github and I will try to use it. 我在Github上找到了“ 移植到Windows LCOV代码覆盖率”工具项目,我将尝试使用它。

Some related questions: 一些相关的问题:

Qt and gcov, coverage files are not generated Qt和gcov,不生成coverage文件

Can GCov be used in windows? 可以在Windows中使用GCov吗?

Is there any actively supported lcov port for windows Windows是否有任何受积极支持的lcov端口

For this platform case your .pro file should contain: 对于这种平台情况,您的.pro文件应包含:

win32 {
  # MinGW-related settings
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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