Questions tagged [gcovr]
The gcovr tag has no usage guidance.
97
questions
0
votes
0
answers
9
views
Gcovr cannot find results file
When I run gcov I get the results file but then when gcovr is run I get an error message
FileNotFoundError: [Errno 2] No such file or directory: 'C:\C~#Ruby26#lib#ruby#gems#2.6.0#gems#ceedling-0.31.1#...
1
vote
1
answer
80
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(...
1
vote
3
answers
38
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 ...
0
votes
2
answers
36
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 ...
0
votes
1
answer
92
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
...
0
votes
0
answers
87
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 ...
1
vote
1
answer
281
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 ...
1
vote
0
answers
211
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 . ...
0
votes
1
answer
33
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 ...
0
votes
1
answer
237
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 --...
0
votes
0
answers
69
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:
----------------...
0
votes
0
answers
37
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 ...
0
votes
0
answers
152
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 ...
1
vote
1
answer
249
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
│ └── ...
0
votes
1
answer
213
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 ...
0
votes
2
answers
3k
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(){
...
0
votes
1
answer
142
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 ...
1
vote
1
answer
438
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 ...
0
votes
2
answers
4k
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 ...
0
votes
1
answer
62
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. (...
1
vote
1
answer
92
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.
...
1
vote
2
answers
687
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 ...
0
votes
0
answers
71
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 <&...
0
votes
1
answer
839
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 -...
0
votes
1
answer
713
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 "${...
0
votes
1
answer
127
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 !=...
1
vote
0
answers
513
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 ...
1
vote
1
answer
3k
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 ...
0
votes
1
answer
4k
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'
...
1
vote
2
answers
706
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 &&...
1
vote
1
answer
343
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 ...
0
votes
0
answers
176
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 ...
0
votes
2
answers
2k
views
How to make gcov and gcovr pick up source and header files
I am trying to generate coverage report for project using .bat file as detailed below.
I see very few .gcov files. Also, when I click on link on generated html output, I am not able to see file ...
0
votes
0
answers
386
views
How to Define Output Directory of Coverage Files in CMake
I am trying to make a very simple regression model that (among other things), builds and compiles a GCC target for coverage, executes, and then publishes a standard Cobertura coverage report (all ...
0
votes
1
answer
491
views
How to get gcovr to report 0% for untested files?
I have a number of source files in my project which are not tested at all. So they have gcno files but no gcda files. gcovr just skips them entirely, which artificially inflates my test coverage ...
0
votes
0
answers
473
views
gcovr GCOV_EXCL_START equivalent for excluding file from line coverage
I am using gcovr for determining line and branch coverage of my C++ code. However, there are some classes that can't be tested (due to dependencies to the OS) and therefore have 0 coverage. I would ...
1
vote
1
answer
571
views
setup gcovr with cmake-How can I Get Code coverage recursively on all static libraries
I have setup gcovr to get code coverage on my c++ project which is quite complex in terms of hierarchy of nested static libraries.
One approach I tried was to include required compile options (-...
1
vote
1
answer
966
views
How to avoid that gcc generates extra code after compiling?
I am trying to get code coverage using ´gcovr´. I am using -O0 as optimization level. For line coverage, I get the results I need, but for branch coverage unfortunately not. According to the ...
3
votes
0
answers
1k
views
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 ...
0
votes
1
answer
629
views
Get coverage for files in other directories with gcvor
I am here with the problem, not getting an cpp files in gcovr output. Actually my main project consist of many sub cpp files but, they are located in different directory paths.
Directory layout:
D:\...
2
votes
1
answer
1k
views
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:
-------------------------------...
1
vote
1
answer
349
views
Unable to generate code coverage and also .gcda deleted from sub directories after running gcovr command
I am facing following issues with Code coverage:
The detailed html files are not generated for .cpp files which
have .gcno and .gcda counterparts.
gcda files automatically got deleted after running ...
3
votes
1
answer
1k
views
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....
-1
votes
1
answer
445
views
Conda - gcovr offline installation
On my computer with windows 10, I can create following conda environment
conda create -n test-coverage python=3.6
activate test-coverage
pip install gcovr
Now, I want to create this conda ...
1
vote
1
answer
1k
views
How do I correctly handle output directories for GCC test coverage profiling?
I am trying to generate coverage data for my unit tests, with the ultimate goal of displaying said data as part of our automated build output.
We build using makefiles and cs-make, with cxxtest as ...
4
votes
2
answers
2k
views
How to merge coverage reports?
I have a C program which I compile with -fprofile-arcs -ftest-coverage flags.Then I run the program on 5 different inputs, this will override the .gcda file and give me a combined report.But I want to ...
1
vote
0
answers
827
views
Unit Testing Code which contains Linux system calls
I am new to unit testing in C++. I am using googletest for performing unit testing(and gcovr for coverage report) of the sources which contains linux system calls. To test them I thought of 2 ...
0
votes
1
answer
2k
views
Gcovr --object-directory option not working as expected with .gcda files in a different directory than .o files
The program I want to profile with gcovr (or gcov/lcov) is located on a shared filesystem, along with the build directory from compiling the program, and I have multiple workers with which I intend to ...
1
vote
1
answer
260
views
Keep Gcov Test name in GCDA files
After having performed my test coverage on my product using lcov (for C++ dev), i'd like to draw a matrix to have the correspondence between the test name and the files it covers.
The idea is to have ...
2
votes
2
answers
4k
views
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 ...