Skip to content

Commit

Permalink
Add support for rostest files (closes #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-arjones committed Aug 6, 2019
1 parent 29621c2 commit d85221a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions helpers/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, run_id, roslaunch_files, exclude_node=None, port=None):
self.roslaunch_files = roslaunch_files
self.port = port
self.exclude_node = exclude_node
self.is_test = False

self._shutting_down = False
self.config = self.runner = self.server = self.pm = self.remote_runner = None
Expand All @@ -37,7 +38,7 @@ def _exclude_node(self, node_list):
def _load_config(self):
self.config = roslaunch.config.load_config_default(self.roslaunch_files, self.port)
self._exclude_node(self.config.nodes)
self._exclude_node(self.config.tests)
self.is_test = (len(filter(lambda x: rosgraph.names.ns_join(x.namespace, x.name) == self.exclude_node, self.config.tests)) > 0)

def _start_pm(self):
self.pm = roslaunch.pmon.start_process_monitor()
Expand Down Expand Up @@ -127,6 +128,10 @@ def start(self, auto_terminate=True):
self.pm.registrations_complete()

self.logger.info("... roslaunch parent running, waiting for process exit")
if not self.is_test:
for test in self.config.tests:
test.output = 'screen'
self.runner.run_test(test)

def spin(self):
if not self.runner:
Expand Down Expand Up @@ -162,4 +167,7 @@ def get_or_generate_uuid():
roslaunch.configure_logging(uuid)
parent = ROSLaunchParent(uuid, [debug_launch_file], exclude_node=debug_node_name)
parent.start()
parent.spin()
if parent.is_test:
parent.spin()
else:
parent.runner.stop()
2 changes: 1 addition & 1 deletion helpers/node_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
debug_node = None

config = roslaunch.config.load_config_default([debug_launch_file], None)
for node in config.nodes:
for node in (config.nodes + config.tests):
fullname = rosgraph.names.ns_join(node.namespace, node.name)
if fullname == debug_node_name:
debug_node = node
Expand Down

0 comments on commit d85221a

Please sign in to comment.