Questions tagged [gcovr]
114 questions
2
votes
2 answers
how to update/install gcovr to match my updated compiler gcc
I have ubuntu 18.04 and I had gcc version 7 on there.
I updated gcc to version 8 using alternatives and slaved my gcov version to gcc also to keep them compatible (which worked nicley), but gcovr itself is stuck at version 3.4 and it needs to be…

code_fodder
- 15,263
- 17
- 90
- 167
2
votes
1 answer
Merge lcov results in one report, and keep the test ids testing each line
I have lcov report of my c++ code on each of my integration tests. I would like to merge it in one global report, I know it is possible but it only adds up hit lines count. I wish to have the information about which test hit each line.
I dunno if…

amestin
- 31
- 1
- 3
2
votes
1 answer
How to get correct code coverage for member functions in header files
When I run gcovr after running my unit test suite I get wrong number for coverage of header files where some inline member function definitions are placed. For example:
---------------------------------------------------------------------------- …

Nicola Mori
- 777
- 1
- 5
- 19
2
votes
2 answers
Gcov works, but Gcovr doesn't work
When I run gcov then the output says 87% covered... then I want to use gcovr, but it does never work. I tried to run from many directories, with lots of options. In some cases, a few files I get coverage but not the file I want to see.
My project…

Bart Mensfort
- 995
- 11
- 21
2
votes
1 answer
How to get coverage information for each run on Gcov (or Gcovr)?
I'm trying to get coverage information for each of my test cases (and also the total coverage). But since .gcda file will be merged everytime the program runs, it's not possible unless the file is deleted/moved.
The problem of deleting the .gcda…

AceVez
- 291
- 1
- 5
- 19
2
votes
0 answers
gcovr: cannot analyse class under test in some cases
my intention is to execute code coverage report with gcovr to my tests that are written with gtest framework with CMake.
ClassUnderTest.h:
class ClassUnderTest
{
public:
uint8_t Start(int in_a, int in_b);
static uint8_t…

BelteZol
- 21
- 3
2
votes
2 answers
googletest move constructor coverage
I am using googletest in conjunction with gcovr which is producing some odd behavior. I have a header file foo.h that gcovr claims has some lines that are not being covered under a test. These lines are the class definition and the move…

David Freitag
- 2,252
- 2
- 16
- 18
2
votes
0 answers
Gcovr Gathered coveraged data for 0 files
I'm trying to use gcovr to generate xml from gcno/gcda to feed the cobertura plugin in Jenkins. The application is built on a build machine and passed to a downstream job running on a unit test slave. The source files and the generated gcno files…

joaerl
- 1,012
- 1
- 10
- 21
2
votes
1 answer
gcovr doesn't create detailed report when source file located relative in other directories
I'm trying to get proper html output from gcovr when source file is located relative from my root directory.
For example (I will mention two cases where gcovr works, and where it has problems):
CASE:1 - gcovr works without problems
My root directory…

JohnDoe
- 825
- 1
- 13
- 31
2
votes
1 answer
The regular expression in the FILTER option of gcovr
I use gcovr to read coverage information for program foo.c. The syntax is
gcovr -r . -b --filter=FILE_PATTERN
where the '-r .' part indicates the current directory as the search root, '-b' is for branch coverage, and the FILE_PATTERN part is to…

zell
- 9,830
- 10
- 62
- 115
1
vote
1 answer
Why does gcovr fail to create a report with g++ version 12?
I have recently upgraded my toolchain, which has caused gcovr to fail to produce any coverage output. Can anyone tell me if this is an issue with gcovr, or my toolchain, or missing dependencies?
Here is the example/comparison I used to…

Jan Jaap
- 437
- 1
- 4
- 13
1
vote
1 answer
Gcovr - 6 possible branches in if-statement
I am using Gcovr to measure code coverage in C++.
In a simple if-statement, I am getting weird results.
Below I add a picture of a code coverage.
Can anyone help and can explain, why there are six possible branches?
When I seperate the functions a()…

user19471767
- 47
- 4
1
vote
0 answers
gcovr missing all branches in report
I'm trying to use gcovr (version 5.0) to collect branch coverage metrics, but I see this error in many places in my code. I am certain the code it running over both branches in many places, but instead of 2/2, I get a 0/2. I notice this is usually…

Richard Fabian
- 697
- 1
- 5
- 18
1
vote
0 answers
Getting different statement coverage for the same piece of code using gcov and gcovr
I am new to using gcov and gcovr and I wanted to get the statement coverage of a given function. It is coded in C, compiled with minGW and called from Matlab (which I use to later process the coverage information given by gcov).
I am executing the…

c.belmonte
- 11
- 1
1
vote
1 answer
gcov is invoking gtest sources and unit-tests. how can I avoid this?
I am working on creating a Jenkins pipeline for unit-testing maybe with GTest.
My plan is to use the following tools:
GTest for Unit-Testing, gcov for generating gcda and gcno Files and gcovr for xml or Html outputs of the unit-testing results.
It's…

user19471767
- 47
- 4