2

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 .          
------------------------------------------------------------------------------
                           GCC Code Coverage Report
Directory: .
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
example.cpp                                    0       0    --%   
------------------------------------------------------------------------------
TOTAL                                          0       0    --%
------------------------------------------------------------------------------

If I run gcov example.cpp directly I can see that the generated .gcov data is correct:

% gcov example.cpp   
File 'example.cpp'
Lines executed:87.50% of 8
Creating 'example.cpp.gcov'

I am unsure where the disconnect between this gcov output and the gcovr interpretation of it is.

I have tried downgrading to an older gcovr version, running the command on other projects, and switching python versions, but have not seen any different behavior.

My gcov and gcc are from the Xcode command line tools. gcovr was pip installed (within pyenv with python 3.8.5)

Edit: adding verbose output:

gcovr -r . -v
Filters for --root: (1)
- re.compile('^/Test/')
Filters for --filter: (1)
- DirectoryPrefixFilter(/Test/)
Filters for --exclude: (0)
Filters for --gcov-filter: (1)
- AlwaysMatchFilter()
Filters for --gcov-exclude: (0)
Filters for --exclude-directories: (0)
Scanning directory . for gcda/gcno files...
Found 2 files (and will process 1)
Pool started with 1 threads
Processing file: /Test/example.gcda
Running gcov: 'gcov /Test/example.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /Test' in '/var/folders/bc/20q4mkss6457skh36yzgm2bw0000gp/T/tmpo4mr2wh4'
Finding source file corresponding to a gcov data file
  currdir      /Test
  gcov_fname   /var/folders/bc/20q4mkss6457skh36yzgm2bw0000gp/T/tmpo4mr2wh4/example.cpp.gcov
               ['        -', '    0', 'Source', 'example.cpp\n']
  source_fname /Test/example.gcda
  root         /Test
  fname        /Test/example.cpp
Parsing coverage data for file /Test/example.cpp
Gathered coveraged data for 1 files
------------------------------------------------------------------------------
                           GCC Code Coverage Report
Directory: .
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
example.cpp                                    0       0    --%   
------------------------------------------------------------------------------
TOTAL                                          0       0    --%
------------------------------------------------------------------------------
Paige
  • 33
  • 4
  • 1
    Are you on MacOS? Could be related to . Should be fixed with the next release, but that's still a bit in the future. There's no easy workaround, but if you don't need coverage data for header files you could manually run gcov for all your source files and then use `gcovr -g` to create a summary report. – amon Dec 10 '21 at 10:39
  • This does sound like the same issue. I confirmed that running `gcov` manually and telling gcovr not to regenerate the files with `gcovr -g` does what I need for now. – Paige Dec 13 '21 at 17:57

0 Answers0