View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011717CMakeCTestpublic2011-01-17 17:212012-07-09 06:52
ReporterMarco Craveiro 
Assigned ToDavid Cole 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSUbuntuOS Version10.10
Product VersionCMake 2.8.3 
Target VersionCMake 2.8.7Fixed in VersionCMake 2.8.7 
Summary0011717: gcov: handling the same file name in different directories
Descriptioni'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 Reproducethe 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.


TagsNo tags attached.
Attached Filestgz file icon cmake_gcov_bug.tgz [^] (1,086 bytes) 2011-01-17 17:21
patch file icon 0001-use-the-preserve-paths-flag-when-invoking-gcov-to-av.patch [^] (1,255 bytes) 2011-01-17 17:22 [Show Content]

 Relationships
related to 0012415closedDavid Cole CTest doesn't push all generated coverage files to CDash 
related to 0012490closedDavid Cole Coverage counts 0 lines when path too long 

  Notes
(0025009)
Marco Craveiro (reporter)
2011-01-21 14:53
edited on: 2011-01-21 14:56

Maximum filename size problem

One potential problem with this patch is creating filenames which are larger than the filesystem's filename size. For instance for Ext4 it appears to be 256 bytes [1]; because gcov concatenates both the full path to the CPP file as well as the full path to the header file, its not difficult to exceed 256 bytes.

[1] For details of filename sizes for different filesystems, see: http://en.wikipedia.org/wiki/Comparison_of_file_systems [^]

(0025360)
David Cole (manager)
2011-02-09 16:10

Fix pushed to 'next'
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e02a3b2bf43f4785bb21eb1cf8bbc26ac1abc12 [^]
(0026720)
David Cole (manager)
2011-06-06 18:25

Closing resolved issues that have not been updated in more than 3 months.
(0027614)
David Cole (manager)
2011-10-22 11:11

The hard-coded addition of " -p" in this fix caused related issues 0012415 and 0012490. A different fix is required.
(0027615)
David Cole (manager)
2011-10-22 11:16

A new, different fix is now in CMake 'next':

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2f309cba455d0a946e935f66a53561ba64717faf [^]

In order to add " -p" to the gcov command lines, please append " -p" to the advanced cache variable COVERAGE_EXTRA_FLAGS at CMake configure time. By default, the value of COVERAGE_EXTRA_FLAGS is "-l".

To enable using duplicate file names in your tree with nightly CMake from now on, or with CMake 2.8.7 or later, please set COVERAGE_EXTRA_FLAGS to "-l -p" in your individual build trees.
(0029972)
David Cole (manager)
2012-07-09 06:52

Closing resolved issues that have not been updated in more than 4 months.

 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
2011-01-17 17:22 Marco Craveiro File Added: 0001-use-the-preserve-paths-flag-when-invoking-gcov-to-av.patch
2011-01-21 14:53 Marco Craveiro Note Added: 0025009
2011-01-21 14:56 Marco Craveiro Note Edited: 0025009
2011-01-26 09:35 David Cole Assigned To => David Cole
2011-01-26 09:35 David Cole Status new => assigned
2011-02-09 16:10 David Cole Note Added: 0025360
2011-02-09 16:10 David Cole Status assigned => resolved
2011-02-09 16:10 David Cole Resolution open => fixed
2011-02-16 11:43 David Cole Target Version => CMake 2.8.5
2011-02-16 11:43 David Cole Steps to Reproduce Updated
2011-06-06 18:25 David Cole Status resolved => closed
2011-06-06 18:25 David Cole Note Added: 0026720
2011-06-17 18:23 David Cole Fixed in Version => CMake 2.8.5
2011-06-17 18:23 David Cole Steps to Reproduce Updated
2011-10-05 17:31 David Cole Relationship added related to 0012415
2011-10-05 17:32 David Cole Relationship added related to 0012490
2011-10-22 11:11 David Cole Note Added: 0027614
2011-10-22 11:11 David Cole Status closed => feedback
2011-10-22 11:11 David Cole Resolution fixed => reopened
2011-10-22 11:11 David Cole Fixed in Version CMake 2.8.5 =>
2011-10-22 11:11 David Cole Target Version CMake 2.8.5 => CMake 2.8.7
2011-10-22 11:16 David Cole Note Added: 0027615
2011-10-22 11:16 David Cole Status feedback => resolved
2011-10-22 11:16 David Cole Fixed in Version => CMake 2.8.7
2011-10-22 11:16 David Cole Resolution reopened => fixed
2012-07-09 06:52 David Cole Note Added: 0029972
2012-07-09 06:52 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team