View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005668CMakeCMakepublic2007-09-09 13:552016-06-10 14:30
ReporterTrevor Kellaway 
Assigned ToBill Hoffman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005668: CMake/CTest code coverage support doesn't work for MinGW gcc under Windows
DescriptionUnder Windows MinGW gcc a CTest code coverage generation fails, using 2.4.6 or latest CVS head.

This is because the gcc command line "gcc.exe -fprofile-arcs -ftest-coverage -o CMakeFiles/abc.dir/abc.obj -c M:\gcovtest\abc\abc.c" uses backslashes for the source filename, and these are encoded in the "abc.gcno" filename. When CTest cmCTestCoverageHandler.cxx cmCTestCoverageHandler::ProcessHandler() is searching for the source file it performs a directory compare, but this will fail as the slashes don't match.

There are two solutions to this issue, 1) provide a way to get gcc to be passed forward slashes, 2) Modify the gcov output "File " recovered path slashes via a call to "cmSystemTools::ConvertToUnixSlashes(sourceFile);"

CTest invokes gcov with the "-l" argument, and this seems completely broken by passing in backslashes, I've had to remove the "-l" from CTest to get this to work. This command line:

  gcov.exe -l -o "M:/gcovtest/abc/build2/CMakeFiles/abc.dir"
"M:/gcovtest/abc/build2/CMakeFiles/abc.dir/abc.gcda"

Produces this failure as MinGW gcov is expecting forward slashes:

  File `M:\gcovtest\abc\abc.c'
  Lines executed:100.00% of 3
  M:\gcovtest\abc\abc.c:could not open output file `abc.gcda##M:\gcovtest\abc\abc.c.gcov'

I'm a relative newbie regarding gcov, I thought "-l" was meant to append a header filename to the source filename? Is it even sensible to add "-l" when passing in the ".gcda" as the argument?

Does this work under Cygwin? I can only suggest that "-l" isn't passed, and maybe this is somehow made configurable so it can be turned off.

All these problems stem from the original MinGW gcc compile passing in native Windows backslashes to gcc as the argument; if this could be resolved the other problems would go away.
TagsNo tags attached.
Attached Files

 Relationships
related to 0004971closedBill Hoffman MSYS gcov fails if drive letter case differs 
related to 0004972closedBill Hoffman Code coverage "Something went wrong" verbose mode reports wrong binary path. 
related to 0009678closedDavid Cole CTest fails to summarize code coverage using gcov for files compiled outside PROJECT_SOURCE_DIR subtree 

  Notes
(0013813)
Bill Hoffman (manager)
2008-10-09 13:27

Is this still an issue?
(0013817)
Trevor Kellaway (reporter)
2008-10-09 14:03

Bill,

Yes this is still an issue, but low priority for me as I've had to patch my CTest locally, and can't move to a later version of CMake due to my hacked original implementation supporting cross compiling (which I've not had time to move to the new style in the SVN head).
(0018061)
David Cole (manager)
2009-10-12 14:56

Fix issue 0005668 - use CollapseFullPath when determining if covered file is within source or binary tree. Allows gcc/gcov coverage analysis using MinGW on Windows.

/cvsroot/CMake/CMake/Source/CTest/cmCTestCoverageHandler.cxx,v <-- cmCTestCoverageHandler.cxx
new revision: 1.76; previous revision: 1.75
(0018062)
David Cole (manager)
2009-10-12 14:58

Bill,

Merge this one to the CMake-2-8 branch next time you do a release candidate...
(0041383)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2007-09-09 13:55 Trevor Kellaway New Issue
2007-10-12 10:02 Bill Hoffman Status new => assigned
2007-10-12 10:02 Bill Hoffman Assigned To => Bill Hoffman
2008-10-09 13:27 Bill Hoffman Note Added: 0013813
2008-10-09 14:03 Trevor Kellaway Note Added: 0013817
2009-10-12 14:51 David Cole Assigned To Bill Hoffman => David Cole
2009-10-12 14:56 David Cole Note Added: 0018061
2009-10-12 14:56 David Cole Status assigned => resolved
2009-10-12 14:56 David Cole Resolution open => fixed
2009-10-12 14:58 David Cole Note Added: 0018062
2009-10-12 14:58 David Cole Assigned To David Cole => Bill Hoffman
2009-10-12 14:58 David Cole Status resolved => assigned
2009-10-12 15:00 David Cole Relationship added related to 0009678
2009-10-12 15:08 David Cole Relationship added related to 0004971
2009-10-12 15:08 David Cole Relationship added related to 0004972
2016-06-10 14:27 Kitware Robot Note Added: 0041383
2016-06-10 14:27 Kitware Robot Status assigned => resolved
2016-06-10 14:27 Kitware Robot Resolution fixed => moved
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team