Ask Your Question
2

Use gtest to catch segfaults

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

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:

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

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] -- run_tests.py: 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
0

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

Dirk Thomas gravatar image

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

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

Comments

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 -0500 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

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

Seen: 729 times

Last updated: Sep 29 '16