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

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...

-- run_tests.py: 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/case.py", line 332, in run
    testMethod()
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rostest/runner.py", line 121, in fn
    succeeded, failed = self.test_parent.launch()
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rostest/rostest_parent.py", line 81, in launch
    return self.runner.launch()
  File "/opt/ros/groovy/lib/python2.7/dist-packages/roslaunch/launch.py", line 644, in launch
    self._setup()
  File "/opt/ros/groovy/lib/python2.7/dist-packages/roslaunch/launch.py", line 620, in _setup
    self._launch_master()
  File "/opt/ros/groovy/lib/python2.7/dist-packages/roslaunch/launch.py", 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...

add_rostest(test/simple_driving_test.xml)
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

Comments

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
1

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
                    cores.

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
1

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
1

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 (https://github.com/ros/catkin/commit/c199d7b2f356b55ba4bf83ea45900482f8bd7a96) which will be available with the next patch release.

edit flag offensive delete link more

Question Tools

Stats

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

Seen: 1,401 times

Last updated: May 12 '13