View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009678CMakeCTestpublic2009-10-07 13:552010-12-14 18:49
ReporterWojciech Migda 
Assigned ToDavid Cole 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionwon't fix 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0009678: CTest fails to summarize code coverage using gcov for files compiled outside PROJECT_SOURCE_DIR subtree
DescriptionWhen the unit test binary is linked with a static library compiled from source files located outside the PROJECT_SOURCE_DIR then although the *.gcov files are generated, they are missed out from the final xml file.

The attached example has a following folder structure:

[DIR] code_coverage
  [DIR] dir_A
    [DIR] scr_A
      scr_A.c
    CMakeLists.txt
    test_bar.h
    test_foo.h
  [DIR] src_B
    src_B.c

LastCoverage_*.log from the Testing/Temporary folder contains the an
error of a form:

  Errors:
  Something went wrong. Cannot find file: /home/scr/code_coverage/src_B/src_B.c in source dir: /home/scr/code_coverage/dir_A or binary dir: /home/scr/code_coverage/dir_A

Coverage.xml hen contain data for src_A library, but not for src_B.

If a symbolic link to src_B is created within dir_A then the code coverage will be summarized for src_B as well.

After setting CMAKE_USE_RELATIVE_PATHS to TRUE it is even worse and ctest fails to summarize any coverage.
TagsNo tags attached.
Attached Filesgz file icon code_coverage.tar.gz [^] (2,137 bytes) 2009-10-07 13:55

 Relationships
related to 0005668closedBill Hoffman CMake/CTest code coverage support doesn't work for MinGW gcc under Windows 

  Notes
(0018047)
Wojciech Migda (reporter)
2009-10-08 15:35

I've checked this issue with 2.8.0 RC2 and it is reproducible too
(0018063)
David Cole (manager)
2009-10-12 15:03

This behavior is "by design." The files that are reported for code coverage analysis are limited to source files that are located underneath CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. We exclude others on the principal of not reporting coverage for "system files" -- like STL headers for std::string usage. We figure you do not want those files reported.

If you have a better suggestion for this behavior (base it on a variable, allow certain other directories, some other idea, ...?) then please re-open and suggest how to achieve your goals while still keeping the idea of excluding "system source files" from the coverage data.

Better yet, attach a patch that does what you want!
(0024081)
David Cole (manager)
2010-12-14 18:49

Closing bugs that have been resolved for more than 3 months without any further updates.

 Issue History
Date Modified Username Field Change
2009-10-07 13:55 Wojciech Migda New Issue
2009-10-07 13:55 Wojciech Migda File Added: code_coverage.tar.gz
2009-10-08 15:35 Wojciech Migda Note Added: 0018047
2009-10-12 14:59 David Cole Status new => assigned
2009-10-12 14:59 David Cole Assigned To => David Cole
2009-10-12 15:00 David Cole Relationship added related to 0005668
2009-10-12 15:03 David Cole Note Added: 0018063
2009-10-12 15:03 David Cole Status assigned => resolved
2009-10-12 15:03 David Cole Resolution open => won't fix
2010-12-14 18:49 David Cole Note Added: 0024081
2010-12-14 18:49 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team