Hi, Is anyone out there successfully generating gcov results using CMake's "MinGW Makefiles" generator and CTest on Windows with MinGW gcc? This doesn't work for me with 2.4.6 or latest CVS head.
Digging into this I've had to patch CTest.exe to get this to work (so I can submit coverage results to my Dart dashboard). It appears that CMake is compiling with this command line, note the backslashes for the source file argument: C:\MinGW\bin\gcc.exe -fprofile-arcs -ftest-coverage -o CMakeFiles/abc.dir/abc.obj -c M:\gcovtest\abc\abc.c The generated abc.gcno has the supplied source filename embedded in it as "M:\gcovtest\abc\abc.c" A "mingw32-make all test ExperimentalCoverage" tries to run gcov with these arguments: gcov.exe" -o "M:/gcovtest/abc/build2/CMakeFiles/abc.dir" "M:/gcovtest/abc/build2/CMakeFiles/abc.dir/abc.gcda" The generated abc.gcov contains these lines at the top: -: 0:Source:M:\gcovtest\abc\abc.c -: 0:Graph:M:/gcovtest/abc/build2/CMakeFiles/abc.dir/abc.gcno -: 0:Data:M:/gcovtest/abc/build2/CMakeFiles/abc.dir/abc.gcda The stdout from gcov is (which is captured and parsed by CTest): File `M:\gcovtest\abc\abc.c' Lines executed:100.00% of 3 M:\gcovtest\abc\abc.c:creating `M:\gcovtest\abc\abc.c.gcov' It appears that CTest is trying to compare the source directory using forward slashes against the backslashes of the source file. Patching CTest's parsing of the "File `M:\gcovtest\abc\abc.c'" works around this. This could all be resolved if the gcc compile used forward slashes for the source filename, but there doesn't seem a way to force this. Also, 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. 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? 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. Does anyone have any ideas / comments on the above? Regards, TrevK _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
