Ask Your Question

Rostest arguments in CMakeLists

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

ct2034 gravatar image

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

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

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

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


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 image ct2034  ( 2014-06-24 13:15:49 -0500 )edit

This is the third result for `rostest arguments`: which I see you've already found.

William gravatar image William  ( 2014-06-24 13:34:47 -0500 )edit

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

ct2034 gravatar image ct2034  ( 2014-06-24 13:35:57 -0500 )edit

answered 2014-06-24 13:06:13 -0500

William gravatar image

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

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.

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

EDIT: @Dirk Thomas's answers is better.

edit flag offensive delete link more


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 image ct2034  ( 2014-06-24 13:14:31 -0500 )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


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

Seen: 779 times

Last updated: Jun 24 '14