1

Background
I am using the python tool gcovr to produce coverage data for some of my c projects. I am able to get the coverage data with no problems, but I'm not able to see which lines of code are covered due to a problem with the tool finding my source files.

After inspecting the XML data generated by gcovr I realized that the tool was looking at the wrong directory for coverage information. That being the case I specified the root for source files as specified by the documentation for gcovr.

# gcovr ... --object-directory=/some/path -r /some/path  

However, when I specify the directory for my source files, gcovr goes into an infinite loop.

Question
What is causing this infinite loop and what do I need to do to specify what directory my source files reside in?

If any extra information is needed to solve this problem, I am willing to provide what I can.

Dodzi Dzakuma
  • 1,406
  • 2
  • 21
  • 39
  • I'm currently thinking about just giving up and using sed to edit the path in the generated XML files directly. However, the tool specified that one should be able to set a path to the location of the source files if needed. – Dodzi Dzakuma May 21 '14 at 06:09
  • Using `sed` to edit the path directly in the XML file worked. However, this solution doesn't address the infinite loop problem that occurs when I try to specify the path with `gcovr`. – Dodzi Dzakuma May 21 '14 at 06:41

2 Answers2

2

There is a documented bug in gcovr 3.1 with the handling of the "-r" (or "--root=") option. The bug causes gcovr to search for gcda files from the "/" level, which takes a long time. The fix is to surround the argument "options.root" with square brackets at line 1828, ie get_datafiles([options.root]). Please refer to https://github.com/gcovr/gcovr/pull/27 for more information.

In order to get gcovr 3.1 to set the source link correctly when the source was higher in the directory tree than the object (and gcno) directory, I had to apply the fix to issues 27 (root infinite loop), 42 (fix gcov incorrect relative path), and 49 (gcovr cannot find source files with gcov 4.8.2). Here is a visual of my source area:

src/foo/*.cc

src/foo/.obj/variant/*.o

user3784467
  • 21
  • 1
  • 5
0

This issue is resolved in gcovr 3.2

Bill Hart
  • 359
  • 2
  • 15