Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use gcovr with ros packages?

I'm trying to use gcovr to generate code coverage statistics for some of my packages that can be used by the Jenkins Cobertura plugin. I have added the following to my CMakeLists.txt

##setup for coverage
set(COVERAGE "OFF" CACHE STRING "Enable coverage generation.")
message(STATUS "Using COVERAGE: ${COVERAGE}")
if("${COVERAGE}" STREQUAL "ON")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()

I'm using catkin_make_isolated. Due to how catkin generates build_isolated/ and devel_isolated/ I'm not sure how to correctly pass the .gcno .gcda data to gcovr (I found the data in build_isolated/package_name/CMakeFiles/package_name-test.dir/test). Anyone have experience successfully running gcovr on ros packages or know a better code coverage tool that has Jenkin's plugins?