Ask Your Question
1

Rostest arguments in CMakeLists

asked 2014-06-24 12:39:51 -0600

ct2034 gravatar image

updated 2014-06-24 13:00:34 -0600

I want to hand arguments to a test script which I can do with a regular call:

rostest package_name testlaunchfile.test argument1:=vaule1 argument2:=value2

But what do I do in CMakeLists:

add_rostest(test/testlaunchfile.test argument1:=vaule1 argument2:=value2)

I realize that it wount be working like this because the arguments are interpreted as source files.
But what can I do?

Edit: What I tried before:

I was giving the arguments to the launchfile via env vars. which seems to not work either. when i set them manually, it works. but catkin seems to fail setting them correctly. Any Ideas on that?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2014-06-24 13:01:55 -0600

Dirk Thomas gravatar image

You can pass arbitrary arguments to rostest using the ARGS KEYWORD, e.g.

add_rostest(test/testlaunchfile.test ARGS argument1:=vaule1 argument2:=value2)
edit flag offensive delete link more

Comments

Thank you! This is really helpful. But could I have found this out by miself? I am just asking whether I am missing out on a great ressource or unable to google any more. ;)

ct2034 gravatar imagect2034 ( 2014-06-24 13:15:49 -0600 )edit

This is the third result for `rostest arguments`: https://github.com/ros/ros_comm/issues/232 which I see you've already found.

William gravatar imageWilliam ( 2014-06-24 13:34:47 -0600 )edit

I tested it - it is actually working. YEAH!! Thank you so much :D I was already going crazy for a bit .. ;)

ct2034 gravatar imagect2034 ( 2014-06-24 13:35:57 -0600 )edit
3

answered 2014-06-24 13:06:13 -0600

William gravatar image

updated 2014-06-24 13:11:43 -0600

You shouldn't need to pass in arguments from the CMakeLists.txt like that. If test/testlaunchfile.test requires arguments you should wrap it in another .test file which includes it and sets the arguments.

<launch>
  <include file="$(find package_name)/test/testlaunchfile.test">
    <arg name="argument1" value="value1" />
    <arg name="argument2" value="value2" />
  </include>
</launch>

EDIT: @Dirk Thomas's answers is better.

edit flag offensive delete link more

Comments

Thanks for your answer. My Problem is that i decide at compile time what i want to test and due to that i have to pass arguments to the test script.

ct2034 gravatar imagect2034 ( 2014-06-24 13:14:31 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-06-24 12:39:51 -0600

Seen: 674 times

Last updated: Jun 24 '14