I am new in ROS and I apologize if the question might be simple or common sense. I am trying to use this package (code_coverage) for measuring code coverage for ROS package but unfortunately no success on generating .gcda files.
Already added the following in the CMakeLists.txt if (CATKIN_ENABLE_TESTING AND ENABLE_COVERAGE_TESTING) find_package(code_coverage REQUIRED) APPEND_COVERAGE_COMPILER_FLAGS() endif()
Currently using catkin_make to build catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
But only .gcno and .o files were generated.
Tried to do gcov *.gcno but results are example Lines executed:0.00% of 117.
Been trying to build also using gcc but still no luck because it cannot find the header file.
Is there other necessary steps or settings to make?
Any thoughts or inputs are highly appreciated. Thank you!
Originally posted by anya on ROS Answers with karma: 16 on 2023-01-19
Post score: 0
Original comments
Comment by miura on 2023-01-20:
Are the tests running? To calculate coverage, tests must be run.
Comment by anya on 2023-01-22:
Thank you for your reply Miura !
Yes I was able to do catkin_make run_tests. But is it normal to take a long time for the result?
Also, just one more question, after running the tests, will it displays the coverage of all the package? or only the package with tests? In my source, there are package that do not have tests folders inside the package. Basically I wanted to know the coverage of all the code. But I'm not sure if it will calculate all the coverage of the codes if without test package.