Ask Your Question
0

Measuring code coverage in ROS

asked 2019-04-29 05:47:43 -0500

updated 2019-04-29 06:34:37 -0500

Hello,

I am looking for a solution to measure code coverage in ROS. For example, in the ROS turtlesim package, I would like to measure how many functions / branches / program-blocks the tutorial program draw_square.cpp reaches during its execution. Such coverage can be helpful, for example, in determining the thoroughness of a test program.

The ROS Continuous Integration page ( http://wiki.ros.org/CIs ) provides hints on some existing solutions of measuring coverage, but the page does not seem to give details.

For your information, I sometimes used GCOV for measuring C program coverage. I am looking for a solution that can deal with both C++ and Python programs in ROS.

Thank you.

edit retag flag offensive close merge delete

Comments

Perhaps mikeferguson/code_coverage can help here, or at least the C++ side. For Python I wouldn't know anything integrated/nice/ROS wrapped.

Edit: according to this the sr-build-tools project can provide code coverage for both C++ and Python. Haven't used it myself though.

gvdhoorn gravatar imagegvdhoorn ( 2019-04-29 06:05:15 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-04-29 07:22:00 -0500

Thomas D gravatar image

updated 2019-04-29 22:12:40 -0500

I have an example of doing code coverage using gcov for ROS C++ code at node_example. The tests are run as part of a Travis job and the results are uploaded to codecov, but you can also get the coverage results locally as well.

The relevant steps for doing code coverage of a ROS package can be found in the Travis configuration file at:

https://github.com/tdenewiler/node_ex...

That package does not yet include tests for Python code.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-04-29 05:47:43 -0500

Seen: 171 times

Last updated: Apr 29