[CMake] gcov: handling same file name in different directories

Marco Craveiro marco.craveiro at gmail.com
Thu Jan 13 14:54:45 EST 2011


hello cmakers,

i've been trying to use ctest's coverage support on a project that uses
the same file name in different directories, e.g.:

serialisation/some_class_name.hpp
streaming/some_class_name.hpp
...

due to the parameters passed in to gcov by ctest, this results in naming
clashes when generating the *.gcov files from the different *.gcda input
files.

symptoms of this problem:
-------------------------

1. errors such as:

  Error(s) while accumulating results:
  Problem reading source file: some_file_name line:45  out total: 49
  Looks like there are more lines in the file: };
  Looks like there are more lines in the file: 
  Looks like there are more lines in the file: 
....

debugging ctest revealed that each of these is actually an error in a
different file, all of which suffering from the name clashing.

2. an error at the end of ctest even though the submission is
successful:

...
   Submission successful
Error in read script: some_ctest_script.cmake

possible fix
------------

using your latest git, i managed to fix the problem by adding the -p
flag to the gcov invocation (--preserve-paths). this fixed my problems. 

i submit the patch for your consideration.

cheers

marco
-- 
Constraint has encouraged not only economy, but also a certain elegance
of design. -- Dennis Ritchie


-- 
Constraint has encouraged not only economy, but also a certain elegance
of design. -- Dennis Ritchie

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-use-the-preserve-paths-flag-when-invoking-gcov-to-av.patch
Type: text/x-patch
Size: 1284 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110113/b095b70d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110113/b095b70d/attachment.pgp>


More information about the CMake mailing list