2 years ago

#23927

test-img

Daniel

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 open them in Eclipse with the GCOV extension I see valid coverage data. But when I run gcovr with the command gcovr -v -r X:/Path/to/my/Project . (this folder contains sub-folders with my .c and .h files) I see the following output

------------------------------------------------------------------------------
                           GCC Code Coverage Report
Directory: X:/Path/to/my/Project
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
------------------------------------------------------------------------------
TOTAL                                          0       0    --%
------------------------------------------------------------------------------

Thanks to the -v (verbose) option I can see that all files are processed e.g.

Processing file: C:\Path\to\my\object\folder\02_obj\filename.gcda
Running gcov: 'gcov C:\Path\to\my\object\folder\02_obj\filename.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory     C:\Path\to\my\object\folder\02_obj' in 'C:\Users\Name\AppData\Local\Temp\tmpncjbaf67'

But it ends always with Gathered coveraged data for 0 files. I can also let gcovr generate a HTML output file with the option --html -o output.html but this shows no results.

My project structure is the following

.c files: X:\Project\Implementation\dev\Source_File_Folder

.o, .gcno, .gcda files: X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder

The call

X:\Project\Implementation\dev\Source_File_Folder>gcovr -v X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder -r .

Gave me the following result

Filters for --root: (1)
-re.compile('^X:\\\\Project\\\\Implementation\\\\dev\\\\ProjektGitRepo\\\\Source_File_Folder\\\\')
Filters for --filter: (1)
-DirectoryPrefixFilter(X:\Project\Implementation\dev\Source_File_Folder\)
Filters for --exclude: (0)
Filters for --gcov-filter: (1)
- AlwaysMatchFilter()
Filters for --gcov-exclude: (0)
Filters for --exclude-directories: (0)
Scanning directory     X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder for gcda/gcno files...
Found 21 files (and will process 11)
Pool started with 1 threads
Processing file: X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder\bap_bcl.gcda
Running gcov: 'gcov X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder\bap_bcl.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder' in 'C:\Users\Name\AppData\Local\Temp\tmppd7r7jwv'
Processing file: X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder\bap_bpl.gcda
Running gcov: 'gcov X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder\bap_bpl.gcda --branch-counts --    branch-probabilities --preserve-paths --object-directory X:\Project\Verification\Test\VariantABC\Binaries\Obj_Folder\02_obj' in 'C:\Users\Name\AppData\Local\Temp\tmppd7r7jwv'
Processing file: ... this continues for the remaining 19 files
Gathered coveraged data for 0 files
------------------------------------------------------------------------------
                           GCC Code Coverage Report
Directory: .
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
------------------------------------------------------------------------------
TOTAL                                          0       0    --%
------------------------------------------------------------------------------

How can I run gcovr sucessfully?

Edit I have now added a script that is called instead of gcov. It replaces all backslashes by slashes in the parameter list for gcov and then calls gcov. This is the implementation:

gcov_replace_backslash.bat:
@echo off
set "parameters=%*"
set "parameters=%parameters:\=/%"
gcov %parameters%

When using this script with gcovr by setting the parameter --gcov-executable I get a diferent but still not the desired result:

X:\Implementation\dev\Source>gcovr -v --gcov-executable gcov_replace_backslash.bat X:/Verification/Test/Integration/obj -r .
Filters for --root: (1)
- re.compile('^X:\\\\Implementation\\\\dev\\\\Source\\\\')
Filters for --filter: (1)
- DirectoryPrefixFilter(C:/Users/Name/Projekt/Implementation/dev/Source/)
Filters for --exclude: (0)
Filters for --gcov-filter: (1)
- AlwaysMatchFilter()
Filters for --gcov-exclude: (0)
Filters for --exclude-directories: (0)
Scanning directory X:/Verification/Test/Integration/obj for gcda/gcno files...
Found 21 files (and will process 11)
Pool started with 1 threads
Processing file: C:\Users\Name\Projekt\Verification\Test\Integration\obj\file1.gcda
Running gcov: 'gcov_replace_backslash.bat C:\Users\Name\Projekt\Verification\Test\Integration\obj\file1.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory C:\Users\Name\Projekt\Verification\Test\Integration\_obj' in 'C:\Users\Name\AppData\Local\Temp\tmpdlm9xrfx'
Finding source file corresponding to a gcov data file
  currdir      X:\Implementation\dev\Source
  gcov_fname   C:\Users\Name\AppData\Local\Temp\tmpdlm9xrfx\#cygdrive#X#Implementation#dev#Source#file1.c.gcov
               ['        -', '    0', 'Source', '/cygdrive/X/Implementation/dev/Source/file1.c\n']
  source_fname C:\Users\Name\Projekt\Verification\Test\Integration\obj\file1.gcda
  root         X:\Implementation\dev\Source
  fname        C:\Users\Name\Projekt\Verification\Test\Integration\obj\file1.c
Parsing coverage data for file C:\Users\Name\Projekt\Verification\Test\Integration\obj\file1.c
  Filtering coverage data for file C:\Users\Name\Projekt\Verification\Test\Integration\obj\file1.c
Processing file: C:\Users\Name\Projekt\Verification\Test\Integration\obj\file2.gcda
Running gcov: 'gcov_replace_backslash.bat C:\Users\Name\Projekt\Verification\Test\Integration\obj\file2.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory C:\Users\Name\Projekt\Verification\Test\Integration\_obj' in 'C:\Users\Name\AppData\Local\Temp\tmpdlm9xrfx'
Finding source file corresponding to a gcov data file
  currdir      X:\Implementation\dev\Source
  gcov_fname   C:\Users\Name\AppData\Local\Temp\tmpdlm9xrfx\#cygdrive#X#Implementation#dev#Source#file2.c.gcov
               ['        -', '    0', 'Source', '/cygdrive/X/Implementation/dev/Source/file2.c\n']
  source_fname C:\Users\Name\Projekt\Verification\Test\Integration\obj\file2.gcda
  root         X:\Implementation\dev\Source
  fname        C:\Users\Name\Projekt\Verification\Test\Integration\obj\file2.c
Parsing coverage data for file C:\Users\Name\Projekt\Verification\Test\Integration\obj\file2.c
  Filtering coverage data for file C:\Users\Name\Projekt\Verification\Test\Integration\obj\file2.c
Processing file: ... for the remaining files

Gathered coveraged data for 0 files
------------------------------------------------------------------------------
                           GCC Code Coverage Report
Directory: .
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
------------------------------------------------------------------------------
TOTAL                                          0       0    --%
------------------------------------------------------------------------------

c++

c

code-coverage

gcovr

0 Answers

Your Answer

Accepted video resources