How to set timeout for a launched gtest in ros2?

asked 2021-01-22 10:28:25 -0500

updated 2021-01-22 10:29:17 -0500

Following up on the discussion here:

I'm following the pattern given in the issue on GitHub for launching gtests as regular ROS Nodes so I can pass parameters into them. However, now I'd like to know how I should go about setting timeouts for those tests.


For some more context, I'm working to migrate the moveit_servo tests in moveit2 to use this method. There are a handful of full-on integration tests that launch servo and related nodes and component nodes and the gtest and then there is one unit test that is only launched this way because it needs parameters loaded into it.

Here is the cmake:

Here is the python script common to the integration tests: Here is the launchfile for one of the integration tests:

Here is the unit test launch:

You can see that there is some sort of logic for a timeout in the integration tests, however when I try to use that logic in the integration test it doesn't work, instead, the test always fails even though it completes in 0.4s or so.

Is the proper way to specify the gtest timeout through the launch system or through cmake?

If there is anything else you see me doing in that PR please respond to it here: We are trying to understand the correct way to use ros2 launch for writing tests for moveit2. I understand some of this is changing quickly and may still be in open PRs in ros2/launch.

edit retag flag offensive close merge delete


| However, now I'd like to know how I should go about setting timeouts for those tests.

Setting a timeout at the CMakeLists.txt level is always an option, but waiting for shutdown with a timeout should be fine as well. How do these tests fail after completing in 0.4s?

hidmic gravatar image hidmic  ( 2021-03-02 11:21:53 -0500 )edit