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?
See my project here for an example. I use gcovr/lcov to produce code coverage reports. You will have to do some searching around(see rdl_cmake) as well as how I use
gcovr
in the.gitlab-ci.yml
file in the top level. It's a fully working example though.Thanks, looking at it helped me figure out how to get it to run locally. I think when I attempted yesterday I had both a build and build_isolated in my workspace which was throwing gcovr off.