Domanda

I'm analyzing C-Code with LCOV on two systems (windows 7, cygwin, Lcov 1.10). On one system I had never problems, but on the other with the same code I get:

$ lcov --directory CMakeFiles/UnitTest.dir/main --capture --output-file lcov.log
Capturing coverage data from CMakeFiles/UnitTest.dir/main
Found gcov version: 4.8.2
Scanning CMakeFiles/UnitTest.dir/main for .gcda files ...
Found 59 data files in CMakeFiles/UnitTest.dir/main
Processing analyze/analyze.c.gcda
[..]
Processing measure/measur.c.gcda
geninfo: Negative length at /usr/bin/geninfo line 2413.

On both systems the folder and files are the same (via subversion revision control). Maybe there could be a problem with some paths, I guess. Someone knows what this is about? Thanks, Led

Addendum: I found out that somethimes it helps to clean the project totally (delete all CMakeFiles and CMakeCache) and rerun the lcov commmand.

È stato utile?

Soluzione

It seems that this happens if some block, for which the coverage information has been captured before, is no longer present in the object file. The problem is that the .gcno file will still store the coverage information for such a block.

To solve the problem it is sufficient to just remove the .gcno file and rebuild your unit test.

For example, I have encountered an error like this:

[...]
Processing CMakeFiles/UnitTest.dir/main.cpp.gcda
[...]
Processing CMakeFiles/UnitTest.dir/Math/BoundingBox.cpp.gcda
geninfo: Negative length at /usr/bin/geninfo line 2413.
Processing CMakeFiles/UnitTest.dir/Math/Vectors.cpp.gcda
make[3]: *** [source/CMakeFiles/] Error 255

In this case it was sufficient to delete the "CMakeFiles/UnitTest.dir/Math/Vectors.cpp.gcno" file and then rebuild the "UnitTest" project.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top