Rosanswers logo

I created a gtest test class for obvious reasons. I made the necessary adjustments to CMakefile.txt, and the package builds both the node and test executables fine. When I run 'make test', the tests complete with no failures. Then, I made a test launch file (armMotion.test) that contains the following:

In the terminals that I will run this test file and my roscore, I change the ROS_URI_MASTER port to 22422. Then, I perform the command 'rostest --text armMotion.test'. As soon as I execute this, my roscore dies. From the master.log file:

" ... [INFO] 2011-07-07 19:15:35,639: +SUB [/LowerPanTilt/start_velocity_control] /LowerPanTilt/LowerPanTilt http://darpa-arm-gfe:41147/
[INFO] 2011-07-07 19:15:45,530: stopping master... "

In another log file: "
[INFO] 2011-07-07 19:15:45,390: rostest starting with options {'text_mode': True, 'bare_name': None, 'bare': False, 'bare_limit': 60}, args ['armMotion.test']
[INFO] 2011-07-07 19:15:45,390: loading roscore config file /home/arm_user/darpa_arm_cturtle/stacks/ros/tools/roslaunch/roscore.xml
[INFO] 2011-07-07 19:15:45,390: Added core node of type [rosout/rosout] in namespace [/]
[INFO] 2011-07-07 19:15:45,391: loading config file armMotion.test
[INFO] 2011-07-07 19:15:45,391: overriding master port to 22422
[INFO] 2011-07-07 19:15:45,391: ... selected machine [] for node of type [arm_motion/utest]
[INFO] 2011-07-07 19:15:45,460: setup[armMotion.test] run_id[0ae5d9fc-a8ef-11e0-b30b-b8ac6f4327b2] starting
[INFO] 2011-07-07 19:15:45,460: start_process_monitor: creating ProcessMonitor
[INFO] 2011-07-07 19:15:45,460: created process monitor <ProcessMonitor(ProcessMonitor-1, initial daemon)>
[INFO] 2011-07-07 19:15:45,461: start_process_monitor: ProcessMonitor started
[INFO] 2011-07-07 19:15:45,461: starting parent XML-RPC server
[INFO] 2011-07-07 19:15:45,461: starting roslaunch XML-RPC server
[INFO] 2011-07-07 19:15:45,461: waiting for roslaunch XML-RPC server to initialize
[INFO] 2011-07-07 19:15:45,474: started roslaunch server http://darpa-arm-gfe:53403/
[INFO] 2011-07-07 19:15:45,474: ... parent XML-RPC server started
[INFO] 2011-07-07 19:15:45,475: _addRostestParent [<rostest.rostest_parent.ROSTestLaunchParent object at 0x11d8790>]
[INFO] 2011-07-07 19:15:45,475: setup[armMotion.test] run_id[0ae5d9fc-a8ef-11e0-b30b-b8ac6f4327b2] done
[INFO] 2011-07-07 19:15:45,475: Running test [arm_motion_test]
[INFO] 2011-07-07 19:15:45,475: initial ROS_MASTER_URI is http://darpa-arm-gfe:22422/
[INFO] 2011-07-07 19:15:45,475: master.is_running[http://darpa-arm-gfe:22422/]
[INFO] 2011-07-07 19:15:45,477: master.is_running[http://darpa-arm-gfe:22422/]
[INFO] 2011-07-07 19:15:45,579: master.is_running[http://darpa-arm-gfe:22422/]
[INFO] 2011-07-07 19:15:45,580: master.is_running[http://darpa-arm-gfe:22422/]
[INFO] 2011-07-07 19:15:45,580: master.is_running[http://darpa-arm-gfe:22422/]
[INFO] 2011-07-07 19:15:45,580: starting new master (master configured for auto restart)
[INFO] 2011-07-07 19:15:45,580: create_master_process: rosmaster, /home/arm_user/darpa_arm_cturtle/stacks/ros, 22422
[INFO] 2011-07-07 19:15:45,580: process[master]: launching with args [['/home/arm_user/darpa_arm_cturtle/stacks/ros/bin/rosmaster', '--core', '-p', '22422']]
[INFO] 2011-07-07 19:15:45,580: ProcessMonitor.register[master]
[INFO] 2011-07-07 19:15:45,581: ProcessMonitor.register[master] complete
[INFO] 2011-07-07 19:15:45,581: process[master]: starting os process
[INFO] 2011-07-07 19:15:45,581: process[master]: start w/ args [['/home/arm_user/darpa_arm_cturtle/stacks/ros/bin/rosmaster', '--core', '-p', '22422', '__log:=/home/arm_user/.r$<br> [INFO] 2011-07-07 19:15:45,581: process[master]: cwd will be [/home/arm_user/.ros]<br> [INFO] 2011-07-07 19:15:45,583: process[master]: started with pid [825]<br> [INFO] 2011-07-07 19:15:45,583: master.is_running[http://darpa-arm-gfe:22422/]<br> [INFO] 2011-07-07 19:15:45,683: master.is_running[http://darpa-arm-gfe:22422/]<br> [INFO] 2011-07-07 19:15:45,685: master.is_running[http://darpa-arm-gfe:22422/]<br> [INFO] 2011-07-07 19:15:45,687: ROS_MASTER_URI=http://darpa-arm-gfe:22422/<br> [INFO] 2011-07-07 19:15:45,688: setting /run_id to 0ae5d9fc-a8ef-11e0-b30b-b8ac6f4327b2<br> [INFO] 2011-07-07 19:15:45,690: setting /roslaunch/uris/host_darpa_arm_gfe__53403' to http://darpa-arm-gfe:53403/<br> [INFO] 2011-07-07 19:15:45,692: ... preparing to launch node of type [rosout/rosout]<br> [INFO] 2011-07-07 19:15:45,692: create_node_process: package[rosout] type[rosout] machine[Machine(name[] ros_root[/home/arm_user/darpa_arm_cturtle/stacks/ros] ros_package_path[$
[INFO] 2011-07-07 19:15:45,693: process[rosout-1]: env[{'USERNAME': 'arm_user', 'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'ORBIT_SOCKETDIR': '/tmp/orbit-arm_user', 'LES$<br> [INFO] 2011-07-07 19:15:45,693: find_node(rosout, rosout, /home/arm_user/darpa_arm_cturtle/stacks/ros, /home/arm_user/darpa_arm_cturtle/stacks/motion_planning_common:/home/arm_$
[INFO] 2011-07-07 19:15:45,694: process[rosout-1]: args[[u'/home/arm_user/darpa_arm_cturtle/stacks/ros/core/rosout/rosout', u'__name:=rosout']]
[INFO] 2011-07-07 19:15:45,694: ... created process [rosout-1]
[INFO] 2011-07-07 19:15:45,694: ProcessMonitor.register[rosout-1]
[INFO] 2011-07-07 19:15:45,694: ProcessMonitor.register[rosout-1] complete
[INFO] 2011-07-07 19:15:45,694: ... registered process [rosout-1]
[INFO] 2011-07-07 19:15:45,694: process[rosout-1]: starting os process
[INFO] 2011-07-07 19:15:45,694: process[rosout-1]: start w/ args [[u'/home/arm_user/darpa_arm_cturtle/stacks/ros/core/rosout/rosout', u'__name:=rosout', u'__log:=/home/arm_user$
[INFO] 2011-07-07 19:15:45,694: process[rosout-1]: cwd will be [/home/arm_user/.ros]
[INFO] 2011-07-07 19:15:45,696: process[rosout-1]: started with pid [839]
[INFO] 2011-07-07 19:15:45,696: ... successfully launched [rosout-1] [INFO] 2011-07-07 19:15:45,696: load_parameters starting ...
[INFO] 2011-07-07 19:15:45,698: ... load_parameters complete
[INFO] 2011-07-07 19:15:45,698: launch_nodes: launching local nodes ...
[INFO] 2011-07-07 19:15:45,698: ... launch_nodes complete
[INFO] 2011-07-07 19:15:45,698: removing previous test results file [/home/arm_user/.ros/test_results/arm_motion/TEST-arm_motion_test.xml]
[INFO] 2011-07-07 19:15:45,699: running test arm_motion_test

In conclusion, my only guess is that rostest tries to create its own roscore by default. In doing so, any running roscore is lost, as well as any nodes that were attached to it. Is there a way to prevent this behavior? To force rostest not to start another roscore (if that is indeed what's happening)?

Originally posted by seanarm on ROS Answers with karma: 753 on 2011-07-08

Post score: 1

Original comments

Comment by seanarm on 2011-07-08:
Temporary dyslexia.. but I'm glad to have finally incurred the wrath of the robot devil.

Comment by Felix Endres on 2011-07-08:
You mention that you change ROS_URI_MASTER. It should be ROS_MASTER_URI, but from your log it seems you did it right anyway


1 Answer 1


Rosanswers logo

Your guess is right. rostest tries to bring up its own ros environment to create an isolated test.

The idea is that you put all the things you want to test in the launch/test file.

Originally posted by dornhege with karma: 31395 on 2011-07-08

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by kwc on 2011-07-08:
no, there is no way to change this behavior right now. It's intentional -- in order for the integration test to be repeatable, every test runs in a fresh graph. rostest files are just roslaunch files, so you can 'roslaunch' them and then run your gtest by hand.

Comment by seanarm on 2011-07-08:
Is there anyway to prevent the behavior?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.