Questions tagged [gcovr]

114 questions
4
votes
0 answers

Using gcovr to show zero coverage

we try to use gcovr to generate coverage report for our c++ project in Jenkins. I was able to get it worked, but I'm stuck with one problem. gcovr doesn't show any statistics for files with zero coverage - they have only .gcno files, no .gcda files…
Trisch
  • 138
  • 10
3
votes
1 answer

libgcov profiling error - overwriting an existing profile data with a different timestamp

My issue is different than this question: the problem there was that he was compiling the same file twice. I am only compiling each file once. g++ -c "file_1.c" -o file_1.o -fprofile-arcs -ftest-coverage g++ -c "file_2.c" -o file_2.o …
Bob
  • 4,576
  • 7
  • 39
  • 107
3
votes
0 answers

How to create coverage report with gcovr and multiple source/object directories?

I'm trying to use gcovr 4.1 to generate coverage reports for a shared library project in C++/Qt while running unit tests. I had no problems instrumenting my code but am having trouble getting gcda files for the library and also having trouble…
Tiberius
  • 31
  • 4
3
votes
1 answer

Code coverage of Multiple files using Gcovr

i am new to gcovr. I have 3 files in my code namely main.cpp, math.cpp and math.hpp.I am compiled it with g++ using the following command g++ -fprofile-arcs -ftest-coverage -fPIC -O0 main.cpp math.cpp math.hpp -o math my code is compiled and run…
Aneesh A S
  • 163
  • 11
3
votes
1 answer

gcovr does't generate reports for some branches on Jenkins

We found that for some of our Github branches that are automatically pulled into Jenkins, gcovr does not generate any coverage information. It claims that no files are found and returns a code coverage of 0%. Other branches work fine. Once we pull…
mrks
  • 8,033
  • 1
  • 33
  • 62
3
votes
1 answer

Remove auto generated exception code from coverage report

Let's start with a minimal working example: main.cpp: #include #include 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…
datosh
  • 498
  • 7
  • 20
3
votes
2 answers

Getting lines of C code in files

We are using gcov and gcovr.py to get coverage reports for our tests. Not all the source files are tested at all and therefore those aren't mentioned in gcovr report. Now I'd like to calculate overall coverage for whole code base nevertheless. From…
burm
  • 93
  • 11
3
votes
4 answers

GCovr generate a 0% coverage report, if cpp,gcno and gcda files are not present at same folder

I have two folder inside same folder as below :- 1.src (it contains my cpp file) 2.linux (where I am running g++ and executing o file) now I am running commands as below cd linux g++ --coverage ../src/example1.cpp -o example1 ./example1 cd…
3
votes
1 answer

How can we use gcovr with -g option?

How can we use gcovr with -g option? I've tried some commands but they all failed. I didn't get any errors but I didn't get the output that I've expected either. Documentation also does not give any examples: http://gcovr.com/guide.html Any ideas?…
leventunver
  • 3,269
  • 7
  • 24
  • 39
3
votes
1 answer

Can't get gcovr to generate coverage data

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…
ksl
  • 4,519
  • 11
  • 65
  • 106
3
votes
0 answers

lcov and gcovr option for ignoring compiler generated dead code

My team is looking for a way to get around gcov reporting branch coverage for dead/compiler generated code. I noticed that gcovr has an option --exclude-unreachable-branches that seems to do what we need. Also, lcov has the option --no-markers which…
wizurd
  • 3,541
  • 3
  • 33
  • 50
3
votes
0 answers

Is it possible to get coverage statistics on C++ headers files with specialised templates in them?

I hope you can help. Ive have spend the day researching this problem and have yet to find a solution. I have a header file which contains specialized templates inside them and I would like to make sure my unit tests are covering it properly. I am…
Stoff81
  • 597
  • 4
  • 15
2
votes
1 answer

Why does GCOV claim this line is not covered?

I recently upgraded to a new version of gcc/g++/gcov, and now gcov behaves strangely. The new version claims some lines of code are not covered that were seen as covered by the old version. I managed to reduce my code to this minimal…
Filipp
  • 1,843
  • 12
  • 26
2
votes
0 answers

gcov generating correct output but gcovr does not

Running through the setup example from gcovr here: https://gcovr.com/en/stable/guide.html#getting-started I can build the file and am seeing the following output from running gcovr -r .: % gcovr -r . …
Paige
  • 33
  • 4
2
votes
1 answer

CMake doesn't generate the code coverage report for source files

I have the following project structure: ├── app │   ├── CMakeLists.txt │   └── tcpstream │   ├── CMakeLists.txt │   ├── include │   │   └── TCPAcceptor.h │   └── src │   └── TCPAcceptor.cpp ├── cmake │   └──…
Vikash
  • 67
  • 1
  • 7