gcovr

gcovr代码覆盖率为0

北战南征 提交于 2020-04-07 10:51:39
jenkins上集成了ccache及gcovr,编译完成后生成了gcno等信息,但是脚本运行完成后(脚本运行正常,返回码正常),发现生成的报告packages节点数据为空,经排查,本次出现问题与ccache、编译版本(release、debug)没有关系,而是字符集环境变量不正确导致,将编码从zh_CN.UTF-8改为en_US.UTF-8后正常。 大家如果在保证安装没有出现问题的情况下如果没有覆盖率结果输出,不妨检查下环境字符集编码是否正确。 哎,又是两天过去了 。。。 来源: oschina 链接: https://my.oschina.net/u/245151/blog/781857

Remove auto generated exception code from coverage report

丶灬走出姿态 提交于 2020-01-14 14:23:26
问题 Let's start with a minimal working example: main.cpp: #include <iostream> #include <string> int main() { std::cout << "hello " + std::to_string(42); return 0; } I compile this code using the following flags: [g++/clang++] -std=c++11 -g -Og --coverage -Wall -o main main.cpp clang 4.0.1 gcc 4.8.5. I get only 50% code coverage, since the compiler generates exception code, which is not executed, as explained in another stackoverflow question. The problem is that disabling exceptions via -fno

Low branch coverage especially when using 3rd party libs. ex boost

限于喜欢 提交于 2019-12-24 06:37:41
问题 I have problems understanding branch coverage in c++. Even for a simple program the branch coverage is 50%. When i use boost the branch coverage is below 20%. Could someone explain me why this is happening? I am using -fno-exceptions -g -O0 -fprofile-arcs -ftest-coverage -fPIC -Wall compiler flags and gcovr for generating the report. I also tried lcov with exactly the same result 回答1: This is just general C++ compiler weirdness. Both gcovr and lcov depend on the coverage data that GCC

Can't get gcovr to generate coverage data

空扰寡人 提交于 2019-12-13 19:20:05
问题 Using gcovr 3.2 I am trying to generate a code coverage report for a set unit tests that I have developed and run using Xcode 5.0. I have successfully configured Xcode to generate the .gcda files following the execution of the tests and I am able to view the results using CoverStory. However, when I try to generate a report using gcovr nothing is generated. With the verbose switch on I can see that it scans the directory for the gcda/gcno files and finds the one I'm expecting it to. I've

Gcovr generates coverage data for 0 files

两盒软妹~` 提交于 2019-12-11 19:05:21
问题 I am setting up code coverage for an iOS application. I am using XCode 5.0.2 and gcovr 3.1 to test and perform code coverage for iOS 7 devices. I initially had issues with .gcda file generation but I followed this blog and resolved the issue. I have set ‘Generate test coverage files’ to ‘Yes’, ‘Instrument Program flow’ to ‘Yes’ for the Debug module only. I have also set -fprofile-arcs -ftest-coverage for Debug module in ‘Other C Flags’. I have added __gcov_flush() in my app code when

Exclusion markers for gcov

旧城冷巷雨未停 提交于 2019-12-08 02:06:10
问题 I'm using gcov to measure coverage in my C++ code. I'd like to be able to mark certain lines of source code so that they are excluded from coverage reporting when using gcovr. I know they exist because I stumbled across them once but now I can't find where I saw them. I'm not using lcov to report coverage so references to such markers are no good to me. Can anyone point me to the right place? TIA 回答1: I figured this out finally. The lcov exclusion markers are valid with gcovr. The following

Exclusion markers for gcov

岁酱吖の 提交于 2019-12-06 07:47:29
I'm using gcov to measure coverage in my C++ code. I'd like to be able to mark certain lines of source code so that they are excluded from coverage reporting when using gcovr. I know they exist because I stumbled across them once but now I can't find where I saw them. I'm not using lcov to report coverage so references to such markers are no good to me. Can anyone point me to the right place? TIA I figured this out finally. The lcov exclusion markers are valid with gcovr. The following markers are recognized by geninfo: LCOV_EXCL_LINE Lines containing this marker will be excluded. LCOV_EXCL

LCOV_EXCL_START/STOP has no effect when using gcovr

自作多情 提交于 2019-12-02 21:09:24
问题 When I add LCOV_EXCL_START/STOP tags to my C++ code, it does not seem to have any effect on my gcovr report. Does someone know why this occurs? I have the following: $ tree . ├── build ├── include │ └── a.h └── tests └── test_a.cpp and $ cat include/a.h void f (bool x) { // LCOV_EXCL_START if (x) throw 1; // LCOV_EXCL_STOP } and $ cat tests/test_a.cpp #include "a.h" int main () { f (false); return 0; } But line 5 throw 1; is included in the gcovr report, even though it is surrounded in

LCOV_EXCL_START/STOP has no effect when using gcovr

我的未来我决定 提交于 2019-12-02 08:46:47
When I add LCOV_EXCL_START/STOP tags to my C++ code, it does not seem to have any effect on my gcovr report. Does someone know why this occurs? I have the following: $ tree . ├── build ├── include │ └── a.h └── tests └── test_a.cpp and $ cat include/a.h void f (bool x) { // LCOV_EXCL_START if (x) throw 1; // LCOV_EXCL_STOP } and $ cat tests/test_a.cpp #include "a.h" int main () { f (false); return 0; } But line 5 throw 1; is included in the gcovr report, even though it is surrounded in exclude tags: $ g++ -c -O0 -fprofile-arcs -ftest-coverage -fPIC --coverage -I include ./tests/test_a.cpp -o .

Is it possible to merge coverage data from two executables with gcov/gcovr?

若如初见. 提交于 2019-11-30 06:06:26
On one project, I'm running the test cases on three different executables, compiled with different options. Depending on the options, some code paths are taken or not. Right now, I'm only using the coverage data from one executable. I'm using gcovr to generate a XML that is then parsed by Sonar: gcovr -x -b -r . --object-directory=debug/test > coverage_report.xml I have three sets of gcda and gcno files, but I don't know how to generate a global report of them. Is there any way to do that ? Assuming that by "compiled with different options" you mean that you compile such that you obtain