[cmake-developers] [CMake 0011717]: gcov: handling the same file name in different directories

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 17 17:21:02 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=11717 
====================================================================== 
Reported By:                Marco Craveiro
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   11717
Category:                   CTest
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-01-17 17:21 EST
Last Modified:              2011-01-17 17:21 EST
====================================================================== 
Summary:                    gcov: handling the same file name in different
directories
Description: 
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: 
<snip>

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:

<snip>
   Submission successful
Error in read script: some_ctest_script.cmake


Steps to Reproduce: 


the following steps assume a linux environment with all development tools
installed (gcov, gcc, cmake, tar, etc).

1. download the attachment cmake_gcov_bug.tgz. it contains the smallest amount
of code i could come up with that illustrates the problem.
2. unpack it by running:

$ tar -zxf cmake_gcov_bug.tgz

3. run ctest:

$ cd cmake_gcov_bug
$ ctest -S CTest.cmake -VV

4. An error will occur:

<snip>
Error(s) while accumulating results:
  Looks like there are more lines in the file: class some_class_a
<snip>
Error in read script: /home/marco/code/cmake_gcov_bug/CTest.cmake


Additional Information: 
- the errors occur due to the gcov parameters passed in, which result in using
"short" filenames.

- the problem should be fixed by adding the flag -p (--preserve-paths) to the
gcov invocation in cmCTestCoverageHandler::HandleGCovCoverage
(Source/CTest/cmCTestCoverageHandler.cxx). this code uses the gcov generated
filename to process the file and works correctly with a longer filename.

- once processed into a SingleFileCoverageVector, it appears nothing else relies
on the original gcov file name.

- patch will be attached subsequently as only one file can be uploaded from
submission form.



====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-01-17 17:21 Marco Craveiro New Issue                                    
2011-01-17 17:21 Marco Craveiro File Added: cmake_gcov_bug.tgz                  
 
======================================================================




More information about the cmake-developers mailing list