Ask Your Question

Multiple Cores running in rostest

asked 2013-05-10 17:15:26 -0500

David Lu gravatar image

updated 2013-05-10 17:57:45 -0500

I'm running tests in the latest navigation branch, but keep getting errors when I run

catkin_make run_tests

The errors claim that there is already a roscore instance open on that port. Full output of the command is seen here but the relevant bit is...

-- execute commands
  /opt/ros/groovy/bin/rostest --pkgdir=/home/dlu/catkin/src/navigation/costmap_2d --package=costmap_2d --results-filename test_simple_driving_test.xml /home/dlu/catkin/src/navigation/costmap_2d/test/simple_driving_test.xml
... logging to /home/dlu/.ros/log/rostest-serenity-8918.log
[ROSUNIT] Outputting test results to /home/dlu/catkin/build/test_results/costmap_2d/rostest-test_simple_driving_test.xml
[ WARN] [1368241605.099039962]: Message from [/rosbag] has a non-fully-qualified frame_id [base_laser]. Resolved locally to [/base_laser].  This is will likely not work in multi-robot systems.  This message will only print once.
[ WARN] [1368241605.108304546, 19.527194170]: No laser scan received (and thus no pose updates have been published) for 19.527194 seconds.  Verify that data is being published on the /base_scan topic.
testsimple_driving_test ... ERROR!
ERROR: roscore cannot run as another roscore/master is already running. 
Please kill other roscore/master processes before relaunching.
The ROS_MASTER_URI is http://serenity:22422/
  File "/usr/lib/python2.7/unittest/", line 332, in run
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rostest/", line 121, in fn
    succeeded, failed = self.test_parent.launch()
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rostest/", line 81, in launch
    return self.runner.launch()
  File "/opt/ros/groovy/lib/python2.7/dist-packages/roslaunch/", line 644, in launch
  File "/opt/ros/groovy/lib/python2.7/dist-packages/roslaunch/", line 620, in _setup
  File "/opt/ros/groovy/lib/python2.7/dist-packages/roslaunch/", line 381, in _launch_master
    raise RLException("roscore cannot run as another roscore/master is already running. \nPlease kill other roscore/master processes before relaunching.\nThe ROS_MASTER_URI is %s"%(m.uri))

However running the tests with the individual command works just fine.

/opt/ros/groovy/bin/rostest --pkgdir=/home/dlu/catkin/src/navigation/costmap_2d --package=costmap_2d --results-filename test_simple_driving_test.xml /home/dlu/catkin/src/navigation/costmap_2d/test/simple_driving_test.xml

The CMake command for the above listed test is...

catkin_add_gtest(module_tests test/module_tests.cpp)

In the words of "David after Dentist," "WHY IS THIS HAPPENING? IS THIS GOING TO BE FOREVER?"

edit retag flag offensive close merge delete


What do the unit test commands in your CMakeLists.txt look like? (Please edit your question.)

joq gravatar image joq  ( 2013-05-10 17:27:22 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2013-05-12 10:28:20 -0500

David Lu gravatar image

The actual problem is literally too many cores. I have a dual core laptop and the catkin_make has this option:

-j [JOBS], --jobs [JOBS]
                    Specifies the number of jobs (commands) to run
                    simultaneously. Defaults to the environment variable
                    ROS_PARALLEL_JOBS and falls back to the number of CPU

Since I have two cores, it was running two tests at the same time with the same port number.

I have posted a ticket.

edit flag offensive delete link more

answered 2013-05-11 07:30:19 -0500

joq gravatar image

This might be the same as a problem I had. Check my earlier question: how does rostest work with catkin?

Unless your gtest is a standalone non-ROS test, try commenting it out in your CMakeLists.txt.

edit flag offensive delete link more

answered 2013-05-12 12:34:21 -0500

Dirk Thomas gravatar image

rostest uses a fixed rosmaster and can therefore not be invoked in parallel. So catkin_make should not automatically append -j flags when running tests. This has already been fixed in catkin_make ( which will be available with the next patch release.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2013-05-10 17:15:26 -0500

Seen: 1,121 times

Last updated: May 12 '13