0

I'm trying to generate a HTML file of results of a C program using Gcovr. I've installed gcov (via MinGW), Python, easy_stall and gcovr. Added the C:\MinGW\bin, C:\Python33 and C:\Python\Scripts to the Windows PATH.

Now the problems I'm having (in Windows commandline):

1. gcovr command

gcovr cannot be found/executed from any directory until executed from c:\Python33\Scripts with the python gcovr command.

Temp fix, rename gcovr to gcovr.py? But this doesn't sound as the right solution.

2. Executing gcovr

No results when I call:

c:\Python33\Scripts>python gcovr -r "d:\somepath\Debug"
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
------------------------------------------------------------------------------
TOTAL                                          0       0    --%
------------------------------------------------------------------------------

But gcov gives proper results.

D:\somepath\Debug>gcov some_file.gcda
File '../some_file.c'
Lines executed:21.43% of 14
Creating 'some_file.c.gcov'

What do I need to do to get proper results?

RvdK
  • 19,580
  • 4
  • 64
  • 107

4 Answers4

0

Try running the same command without the -r option, that is:

c:\Python33\Scripts>python gcovr "d:\somepath\Debug"

Mobiletainment
  • 22,201
  • 9
  • 82
  • 98
a.akizu
  • 1
  • 1
0

I had the same problem. I did solve it with following approach.

Go to root (main) directory of your project.

To generate output in Tabular format, in command prompt, Give the command to generate coverage in

1) Tabular format

     "python C:\Python27\Scripts\gcovr -r . --object-directory <path to *.gcno *.gcda file>"

2) XML format

   "python C:\Python27\Scripts\gcovr -r . --object-directory <path to *.gcno *.gcda file> -x -o <desired_name.xml>"

3) HTML format

   "python C:\Python27\Scripts\gcovr -r . --object-directory <path to *.gcno *.gcda file> –-html -o <desired_name.html>"
0

This post may resolve your issue.

GCOVR giving empty results zero percent in MAC

Community
  • 1
  • 1
0

Had the same issue.

The problem is that your source file is not "below" the root folder and by default gcovr will filter it.

If you call

python gcovr -r "d:\somepath\Debug" --verbose

you will notice the line

Filtering coverage data for file ../some_file.c

An easy fix is to add a filter option:

python gcovr -r "d:\somepath\Debug" --verbose -f .*

From gcovr help:

-f FILTER, --filter=FILTER Keep only the data files that match this regular expression

What gcovr documentation fail to mention is that if you do not provide a filter it will use the root path as default filter.

Hope it will help someone.

IceBerg0
  • 59
  • 5