Ask Your Question
1

Enforce consecutive execution order for gtest and rostest.

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

Magnus gravatar image

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

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 imageLink ( 2019-02-27 08:47:40 -0500 )edit

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

Link gravatar imageLink ( 2019-02-27 08:49:08 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

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 imageDirk Thomas ( 2019-02-27 10:34:25 -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: 2019-02-27 03:25:25 -0500

Seen: 132 times

Last updated: Feb 27