MantisBT - CMake
View Issue Details
0015683CMakeCMakepublic2015-08-05 03:052016-06-10 14:31
j.kreuzberger 
Kitware Robot 
normalfeaturealways
closedmoved 
allall
CMake 3.2.2 
 
0015683: Extend --trace to --coverage mode for detection of "dead" cmake code
my intention is to find "dead" cmake script code in the project for cleanup and maintainance of the scripts.

I have adapted the gcovr script to parse the cmake script output in --trace mode to detected "code coverage" and write text or html output. Results attached below.

No i have some issues:

- The trace mode does report multi line statements as "one line" statement.
This should be reported as RANGE (e.g. not with just one line number, with start and end line number (e.g. filename(3:5): )

- the commands closing are not considered in trace output. so to each if(), macro() or other commands, the enclosing endif(), endmacro() etc are not "covered". This should be also traced or covered


For complete finalisation is must reload the file and mark the commented and blank lines as "covered". But thats ok for me for the covering issues.

So my suggestion would be to extend the trace mode or create an additional coverage mode.
cmake with --trace output activated and multiline statements like

set( MY_VAR
     test.cpp
     test.h
     ...
)

if( WIN32 )
  set( MYVAR2 )
endif()

The attached files are sample output from the adapted gcovr script.
Script cant be published cause i have to clarify the copyright issues with the "original" script holders.

No tags attached.
html cmake_coverage.tinyxml2_tinyxml2sources.txt.html (7,727) 2015-08-05 03:05
https://public.kitware.com/Bug/file/5503/cmake_coverage.tinyxml2_tinyxml2sources.txt.html
Issue History
2015-08-05 03:05j.kreuzbergerNew Issue
2015-08-05 03:05j.kreuzbergerFile Added: cmake_coverage.tinyxml2_tinyxml2sources.txt.html
2016-06-10 14:29Kitware RobotNote Added: 0042817
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042817)
Kitware Robot   
2016-06-10 14:29   
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.