Questions tagged [gcovr]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
25 views

Get code coverage of integration test of binary

C language supports gcovr to get code coverage of unit test. If I have a integration test which uses binary(build by cmake in one project) with different options to test different cases. Is there any ...
Xinxu's user avatar
  • 1
0 votes
0 answers
210 views

GCOVR - File not found

Windows 11 GCOV v6.0 Python 3.11.3 gcc.exe (Rev2, Built by MSYS2 project) 12.1.0 gcov (Rev2, Built by MSYS2 project) 12.1.0 I compile my project, run the executable and get a full set of .gcda and ....
Phil Shaw's user avatar
4 votes
3 answers
307 views

Is it possible to exclude a redundant, invisible else branch with gcov?

Imagine the following function: int myFunction(my_enum_t x) { int result = 0; if ((x != ENUM_VAL_A) && (x != ENUM_VAL_B) && (x != ENUM_VAL_C)) { result = -1; } ...
Walkingbeard's user avatar
2 votes
1 answer
358 views

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 ...
Jan Jaap's user avatar
  • 447
0 votes
2 answers
443 views

Gcov 6.0 with Ceedling 0.31.1 generates empty html report

I am trying to generate a html report using ceedling and gcov. But I keep getting a empty html report. I have added report_include like this link mentions at the bottom of the page - https://github....
Joe's user avatar
  • 47
1 vote
1 answer
494 views

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 ...
user19471767's user avatar
0 votes
1 answer
47 views

Which can be sued to generate the code coverage report for Qt test cases,lcov or gcovr

Some references states that Qt is not covred using lcov. So need to confirm wheater lcov or gcovr be used for Qt.
SID EDUCATION's user avatar
0 votes
1 answer
701 views

SonarQube shows lines as "Not covered by tests" when gcov reports 100% coverage

I am using SonarQube Server to display code coverage reports on a C++ project (using gcov to generate reports). For some files in my project, there are lines in SonarQube that display as "not ...
anderson2943's user avatar
0 votes
1 answer
20 views

Cmake custom target command does not work on all inputs

I am building a number of sources and then running gcovr with JSON output: foreach(COMPONENT IN LISTS BLAHDIBLAH) ... add_custom_command(TARGET ${COMPONENT}_coverage COMMAND gcovr ...
Walkingbeard's user avatar
1 vote
0 answers
126 views

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 ...
Richard Fabian's user avatar
0 votes
1 answer
195 views

gcovr generates empty report with --add-tracefile --html-details

I was trying to generate a code coverage report from trace1.json. The trace1.json was not generated by gcovr, it was generated using Lauterbach software from the real hardware trace data. From ...
Apprentice.Hou's user avatar
0 votes
0 answers
476 views

How to get Code Coverage Report on Sonarqube for C++ library

I am trying to display code coverage for my project in sonarqube. The closest I got so far is that it shows the coverage on header files, but not on source files. My Setup: I have a project with ...
tabs's user avatar
  • 1
0 votes
1 answer
406 views

gcovr compare two reports

I find it really difficult when refactoring huge codebase, changing tests etc. to find on my code coverage report what lines I'm no longer covering. Is there any tool/way to get diff from two reports?
Mahashi's user avatar
  • 119
0 votes
0 answers
360 views

Getting the decision coverage HTML report with gcovr

I am using gcovr to generate the coverage analysis of some unit tests, and wanted to generate the HTML decision coverage report. I am using Matlab, and am calling gcov and gcovr and generating the ...
c.belmonte's user avatar
1 vote
0 answers
64 views

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 ...
c.belmonte's user avatar
0 votes
1 answer
621 views

gcovr with Cobertura XML output gives absolute path of production files

I have managed to show code coverage data with Cobertura XML in Jenkins. Its works well, but I wants to see the source code in Jenkins, too. I accidentally saw, that Jenkins is referring for the ...
user19471767's user avatar
4 votes
1 answer
6k views

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 -...
Bob's user avatar
  • 4,666
1 vote
1 answer
951 views

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 ...
user19471767's user avatar
0 votes
1 answer
1k views

gcov and gcovr: no .gcno files are generated after compiling

I am trying to get code coverage in my unit test project in windows system. Description After compiling with -fprofile-arcs -ftest-coverage, I found out the execution file is generated and works fine. ...
Risusdan's user avatar
1 vote
1 answer
962 views

gcov coverage limited to test files

I have the following CMakeLists.txt file: cmake_minimum_required(VERSION 3.16) project(first_coverage) set(CXX_STANDARD 20) set(CXX_STANDARD_REQUIRED True) set(CMAKE_BUILD_TYPE Debug) set(...
LeonTheProfessional's user avatar
1 vote
3 answers
81 views

xslt: remove attribute when parent node has an attribute matching a pattern (filter out branch coverage on sonar for files mathcing a pattern)

I am producing coverage reports using gcovr for import into sonar. This use this format (https://docs.sonarqube.org/latest/analysis/generic-test/): <coverage version="1"> <file ...
Bruce Adams's user avatar
  • 5,093
0 votes
2 answers
205 views

How to config GCOV for coverage Testing for a Driver(Ethernet Driver)?

I am trying to use GCOV to test a Device Driver eg: Ethernet Driver wrote in C language. This driver is in Userspace and has a lot of Kernelspace calls. Using a Linux Ubuntu machine Ubuntu 20.04.3 LTS ...
Vinay Kumar's user avatar
0 votes
1 answer
615 views

ImportError: No module named lxml , although lxml is installed

I'm trying to install gcovr tool in virtualenv and tools installs well, but on running the binary, i see warnings with lxml , how do i fix this? Commands used: pip install virtualenv virtualenv env ...
Sbk3824's user avatar
  • 1,249
0 votes
0 answers
678 views

GCOVR Processes all files but then shows "Gathered coveraged data for 0 files"

I'm using Cygwin GCC 11.2.0 on Win10 with gcovr 5.0. My C files are compiled with the --coverage flag and the .gcno files are created. After running my program the .gcda files exist as well and if I ...
Daniel's user avatar
  • 413
2 votes
1 answer
2k views

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 ...
Filipp's user avatar
  • 1,871
2 votes
0 answers
1k views

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's user avatar
  • 33
0 votes
1 answer
147 views

Problems with gcovr and regex expressions

I am trying to merge coverage data from specific files from multiple runs into a single "report". In each project I generate test coverage for different files, each in a separate project ...
Ken 99's user avatar
  • 19
1 vote
1 answer
991 views

gcovr not showing code coverage for untouched header files

I have the following structure for a header only library include - header1.h - header2.h - header3.h test - test1.cpp Now test1.cpp only uses header1.h, so when I compile test1.cpp with --...
Vaibhav Thakkar's user avatar
0 votes
1 answer
290 views

Why does gcovr generates empty report

gcovr, despite providing complete arguments list, generates empty reports? Command: gcovr -r /home/<username>/Projects/ --object-directory <Path to Build Directory> Result: ----------------...
Amalorpavadoss Kulandaisamy's user avatar
0 votes
0 answers
71 views

Configuring suitable target with CMake for gcov

I have followed this link(https://jhbell.com/using-cmake-and-gcov) to integrate gcov in CMake. But it is only working when all the test cases are passed. My few of the Google test cases are getting ...
Shital Jadhav's user avatar
0 votes
0 answers
380 views

How to generate complete GCOV report when few testcases gets failed?

I need to generate the test coverage report and I have observed that when all the google testcases gets passed then only GCOV generates the coverage report. But now few of the testcases are getting ...
Shital Jadhav's user avatar
2 votes
1 answer
1k views

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 │   └── ...
Vikash's user avatar
  • 77
0 votes
1 answer
607 views

No colours in gcovr 5.0 --html-details report

I've been using the gcovr module for monthly report generation. I work on docker, so each time I used to download the gcovr module using pip3 command on my Linux container. Recently, after downloading ...
ashish_k's user avatar
  • 1,563
0 votes
2 answers
7k views

.gcda file coverage info not getting updated when two executables run for same source file

There are three files u1.c , u2.c and common.c content of ut1.c #include<stdio.h> void fun1(); int main(){ fun1(); } content of ut2.c #include<stdio.h> void fun2(); int main(){ ...
Learner09's user avatar
0 votes
1 answer
464 views

Genetate GCOV report for multiple cpp files

I have 3 files in a folder. one.cpp, one.hpp and main.cpp. one.hpp has a class declaration. one.cpp has definition of functions in the class both under same namespace.Iam calling a function from the ...
Cod3r's user avatar
  • 17
1 vote
1 answer
1k views

Unable to find GCC Code coverage libgcov.so for arm toolchain

Steps to Reproduce the issue #include<iostream> int main(){ std::cout << "Hello World" << std::endl; } Write main.cpp Download Toolchain from this link Compile with ...
Thomas Easo's user avatar
  • 3,517
2 votes
2 answers
10k views

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 ...
code_fodder's user avatar
  • 15.5k
0 votes
1 answer
241 views

Create Gcovr standalone version

I have a question about gcovr. Is it possible to install or create a standalone version of the gcovr. So that the user doesn't need to instal python or gcovr ? So that i just have to add the path. (...
Gio's user avatar
  • 5
1 vote
1 answer
192 views

I need some support for gcovr and cobertura

I am trying to create a pdf file which shows coverage of my unit tests. And same I need to push to Jenkins. Steps: I clone the repo. Make the Env and Build it locally. Run Batchfile for unit tests. ...
Prawin's user avatar
  • 59
1 vote
2 answers
1k views

gcovr/SonarQube saying simple C++ function is only half covered

We are running gcovr on our codebase which is (FTR) then fed into SonarQube (cxx-plugin). There are many places where there is a report of less than 100% coverage, even though there are no obvious ...
johnfo's user avatar
  • 1,766
0 votes
0 answers
74 views

gcovr always shows 100% line coverage [duplicate]

I run the following code with gcovr, and get 100% line-coverage, despite bar not being called. What am I doing wrong? #include <iostream> struct A{ static void foo(){ std::cout <&...
Benny K's user avatar
  • 878
1 vote
1 answer
2k views

How to improve the branch coverage using gcovr tool

I have written a sample program using C++. I have written corresponding unit tests using GUNIT framework. I was successfully able to generate.gcda and .gcno files for every source file. I used (gcov -...
Santosh Appachu's user avatar
0 votes
1 answer
2k views

Why does gcovr generate empty coverage statistics?

I'm confused about how to use gcov. I've got a cmake project that has two test executables which use googletest. I've added the required flags to my cmake script: set(CMAKE_CXX_FLAGS "${...
CiaranWelsh's user avatar
  • 7,124
0 votes
1 answer
248 views

Why gcov is not covering logical && operator?

My piece of code which I am doing unit testing on is something like this: if(((State !=TCPIP_IPADDR_STATE_ASSIGNED)&& (State !=TCPIP_IPADDR_STATE_ONHOLD) && (State !=...
antromeda_12's user avatar
1 vote
0 answers
947 views

Parsing lcov total.info

I'm parsing the total.info file which is the result of running a few lcov commands on my source code in order to build a service that provides coverage information when needed. lcov also provides a ...
Nader Kahwaji's user avatar
2 votes
1 answer
7k views

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 ...
amestin's user avatar
  • 31
0 votes
1 answer
9k views

How to generate HTML reports of coverage information using gcov?

I want to generate HTML reports of result of coverage information of code written c++. what is the command to generate it ? I was using File 'c:/mingw/lib/gcc/mingw32/6.3.0/include/c++/iostream' ...
VIJAYASHREE RAGHUVEER SHETTY's user avatar
1 vote
2 answers
1k views

How to obtain 100% branch coverage with gcovr with `if / else if / else`

I'm using gcovr for the first time and have hit a confusing issue with this code: for (int i = 0; i < 4; i++) { bool a = i & 1; bool b = i & 2; if (a &&...
Edd Inglis's user avatar
  • 1,077
2 votes
1 answer
503 views

How to get 100% coverage with gcovr with ifdef code?

I like working with gcovr on my Linux box to understand what is tested and what I have not. I have fallen into a pit where I cannot see the solution. I have C-code like shown just below (save as ...
Peter Toft's user avatar
0 votes
0 answers
349 views

gcovr missing .gcda files after executing binary that is linked with a dynamically linked shard object libraries (.so)

I am trying to use gcovr on my linux project and have no luck getting .gcda files for the dynamic library after executing binary. I have a project called projectA which creates a library called ...
takanoha's user avatar
  • 323