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

查看:249
本文介绍了Qt和gcov,不生成coverage文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取我为Arora浏览器编写的,使用C ++和Qt框架编写的组件的代码覆盖范围。

I am trying to obtain code coverage for a component I am writing for the Arora browser, that is written using C++ and Qt framework.

我无法使用gcov程序,无论是在Gnu / Linux还是在Mac Os X上都没有。我尝试了在Internet上可以找到的所有内容,还通过强制自动编辑.pro文件生成的Makefile来实现。

I am not able to use the gcov program, neither under Gnu/Linux nor Mac Os X. I tried everything I was able to find on the Internet, also by forcing things automatically editing the Makefile generated by the .pro file.

有人可以帮我吗?这是我非常简单的专业文件:

Can somebody help me please? This is my very simple pro file:

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
LIBS += -lgcov
QMAKE_CXXFLAGS += -g -fprofile-arcs -ftest-coverage -O0
QMAKE_LDFLAGS += -g -fprofile-arcs -ftest-coverage  -O0


include(../autotests.pri)

# Input
SOURCES += tst_quickview.cpp
HEADERS +=

Makefile确实包含标志。我还尝试了-coverage 选项。但是什么也没发生。当我运行可执行文件时,不会生成任何gcov文件。没有错误,也没有警告。我正在使用QTestLib框架。

The Makefile does correctly contain the flags. I also tried the --coverage option. But nothing happens. When I run the executable, no gcov files are generated. There are no errors and no warnings. I am using the QTestLib framework.

谢谢

推荐答案

在至少您应该使用

QMAKE_LFLAGS += -g -fprofile-arcs -ftest-coverage  -O0

而不是

QMAKE_LDFLAGS += -g -fprofile-arcs -ftest-coverage  -O0

我不确定是否会解决您的问题,但QMAKE_LDFLAGS不会做任何有用的事情。

I'm not sure if that will fix your problem but QMAKE_LDFLAGS is not going to do anything useful.

这篇关于Qt和gcov,不生成coverage文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆