Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

fix "pass_all_args" for roslaunch-check#1368

Merged
mikepurvis merged 2 commits intoros:melodic-develfrom
jabbenseth:feature/fix_pass_all_args
Apr 26, 2018
Merged

fix "pass_all_args" for roslaunch-check#1368
mikepurvis merged 2 commits intoros:melodic-develfrom
jabbenseth:feature/fix_pass_all_args

Conversation

@jabbenseth
Copy link
Copy Markdown
Contributor

@jabbenseth jabbenseth commented Apr 17, 2018

the option "pass_all_args" was not recognized by roslaunch checks. This works as expected on "our" launch files which create a mixed tree using the "pass_all_args" option as well as explicit argument forwarding

@mikepurvis mikepurvis changed the base branch from kinetic-devel to melodic-devel April 24, 2018 14:04
@mikepurvis
Copy link
Copy Markdown
Member

Thanks for this contribution. As the active branch has changed, please retarget this to melodic-devel, and it will be considered after merge for backport to Kinetic and Lunar.

Please also add a test-case which exposes the problem and is fixed by your proposed change. I would suggest doing so in this file:

https://github.com/ros/ros_comm/blob/melodic-devel/tools/roslaunch/resources/example.launch

There are several tests which load and process this launch file in different contexts; it shouldn't be hard to make one of them fail.

@jabbenseth jabbenseth force-pushed the feature/fix_pass_all_args branch 2 times, most recently from 1870017 to c8ed560 Compare April 25, 2018 14:05
@jabbenseth
Copy link
Copy Markdown
Contributor Author

I added a test which exposed the mentioned problem. However if i ran the test manually (rosrun test_roslaunch test_roslaunch_check.py) it worked but with rostest test_roslaunch roslaunch.test I ran into troubles:

'unused args [__name, __log] for include of [/…/src/ros_comm/tools/roslaunch/resources/example-args.launch]' is not None

Somehow the implicitly defined arguments "__name" and "__log" for the node specified in the testfile get forwarded and end up in the test environment as well. They are blacklisted in 7fb090f

Finally my original fix is applied in c8ed560

self.assertIsNone(error_msg)

if __name__ == '__main__':
rostest.run(PKG, NAME, TestRoslaunchCheck, sys.argv)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can filter argv using a rospy helper, see: http://wiki.ros.org/rospy/Overview/Initialization%20and%20Shutdown#Accessing_your_command-line_arguments

However, I don't think that's quite the right approach here— AFAICT this doesn't need to be a rostest at all. Rostests are specifically tests which take place in the full roslaunch environment (where a rosmaster and param server are present). What you have here could just be a regular nosetest. See catkin_add_nosetests documentation and some examples:

http://docs.ros.org/melodic/api/catkin/html/howto/format2/python_nose_configuration.html
https://github.com/ros/ros_comm/search?q=catkin_add_nosetests

This should allow you to drop the hack in xmlloader.py as well.

@jabbenseth jabbenseth force-pushed the feature/fix_pass_all_args branch from c8ed560 to bb474ec Compare April 26, 2018 11:03
@mikepurvis
Copy link
Copy Markdown
Member

Looks great, thanks for your patience in iterating on this with me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants