[cmake-developers] [CMake 0015683]: Extend --trace to --coverage mode for detection of "dead" cmake code

Mantis Bug Tracker mantis at public.kitware.com
Wed Aug 5 03:05:22 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15683 
====================================================================== 
Reported By:                j.kreuzberger
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15683
Category:                   CMake
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-08-05 03:05 EDT
Last Modified:              2015-08-05 03:05 EDT
====================================================================== 
Summary:                    Extend --trace to --coverage mode for detection of
"dead" cmake code
Description: 
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.


Steps to Reproduce: 
cmake with --trace output activated and multiline statements like

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

if( WIN32 )
  set( MYVAR2 )
endif()



Additional Information: 
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.


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-08-05 03:05 j.kreuzberger  New Issue                                    
2015-08-05 03:05 j.kreuzberger  File Added:
cmake_coverage.tinyxml2_tinyxml2sources.txt.html                    
======================================================================



More information about the cmake-developers mailing list