ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Use gtest to catch segfaults

asked 2016-09-29 15:14:10 -0600

Dave Coleman gravatar image

I'm not sure how to get catkin to catch segfaults during testing. I've setup a ROS gtest using the following line in my CMakeLists:

  catkin_add_gtest(moveit_bolt_test test/moveit_bolt_test.cpp)
  target_link_libraries(moveit_bolt_test ${PROJECT_NAME} ${catkin_LIBRARIES} )

I run the test using catkin run_tests --no-deps --this -iv

When the test segfaults, however, there is not reporting of test failures:

[bolt_moveit:make] Segmentation fault (core dumped)
[bolt_moveit:make] Cannot find results, writing failure results to '/home/dave/ros/current/ws_swri/build_release/bolt_moveit/test_results/bolt_moveit/MISSING-gtest-moveit_bolt_test.xml'
[bolt_moveit:make] -- verify result "/home/dave/ros/current/ws_swri/build_release/bolt_moveit/test_results/bolt_moveit/gtest-moveit_bolt_test.xml"

How do I get gtest to report a failure instead?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-09-29 15:58:30 -0600

Dirk Thomas gravatar image

updated 2016-09-29 15:58:56 -0600

Since the test segfaulted it didn't write the expected result file. Therefore the script wrapping the test invocation generated MISSING-gtest-moveit_bolt_test.xml which should contain a failed test. How do you expect the test failure to be reported? Did you run catkin_test_results afterwards?

edit flag offensive delete link more


I'm not running this in a CI currently, so didn't use catkin_test_results. I guess that is the tool that I'm missing, thanks.

Dave Coleman gravatar image Dave Coleman  ( 2016-09-29 16:35:24 -0600 )edit

Question Tools



Asked: 2016-09-29 15:14:10 -0600

Seen: 851 times

Last updated: Sep 29 '16