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

Enforce consecutive execution order for gtest and rostest.

asked 2019-02-27 03:33:26 -0600

Magnus gravatar image

updated 2019-02-27 07:38:40 -0600

My ROS package contains two test executables, one gtest and one rostest. They are specified in the CMakeLists as, catkin_add_gtest(...) and add_rostest_gtest(...) respectively.

When performing catkin run_tests my_package --no-deps, the rostest executable decides to run in the middle of the gtests. This is undesirable as the messages being published from one test could be received by another test.

Is there a way to ensure these tests are run consecutively?

Note: I tried using add_dependencies(my_gtest_target my_rostest_target), hoping it would force the gtest to execute before the rostest, but this makes no difference.

Looking at the build output, it seems two instances of run_tests.py are always run in parallel. One instance for gtest and one for rostest.

edit retag flag offensive close merge delete

Comments

Note that unless the --reuse-master flag is passed to rostest, unlikely in your case since it is not the default, there is essentially a separate Ros master assigned to each test. See here for more details.

Link gravatar image Link  ( 2019-02-27 08:47:40 -0600 )edit

Since there are different Ros masters you won't be able to receive messages from a different test.

Link gravatar image Link  ( 2019-02-27 08:49:08 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-02-27 07:43:48 -0600

Magnus gravatar image

Catkin build accepts the jobs flag: https://catkin-tools.readthedocs.io/e...

So adding -j1 as a parameter to catkin run_tests fixes the issue, as it forces the tests to run on one job.

edit flag offensive delete link more

Comments

For efficiency of testing you should rather make sure that your tests don't collide with each other. Since you have full control over them that shouldn't be too difficult.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-02-27 10:34:25 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-02-27 03:25:25 -0600

Seen: 1,734 times

Last updated: Feb 27 '19