ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
5

Is test_depend actually used for anything?

asked 2014-01-07 05:05:25 -0600

hersh gravatar image

updated 2014-01-07 05:08:32 -0600

Under catkin (in hydro), package.xml files can have "test_depend" entries. This seems like a good idea, as sometimes our tests have dependencies that the rest of our code does not have. HOWEVER, I can't see any way that those test_depend entries are actually used or referenced by the catkin build machinery or rosdep or anything. Are they just there to be informative to developers who want to run tests? Or does catkin actually download and install those dependencies when you type "catkin run_tests"? Or do those dependencies get installed when you use "rosdep install"?

I see in the documentation http://wiki.ros.org/catkin/package.xml and http://wiki.ros.org/catkin/conceptual_overview#Dependency_Management specifics on when one should declare test_depend-encies, but I don't see any mention of what is actually done with them. What are the consequences of putting them in? Leaving them out?

Is this a feature that is yet to be implemented, or is it implemented and not documented? Or do I just need help finding the docs?

(The motivation for this question is that I'm trying to automate the running of tests with Travis, and my package has some test_dependencies which are not build_dependencies, and I want to make sure the test script installs the test dependencies, since Travis runs essentially on a blank machine every time.)

Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-12-08 11:30:20 -0600

130s gravatar image

REP-140, which @joq authored and whose definition is implemented into Groovy onward, should answer the question raised here.

Making <test_depend> easier to use

With format one, <test_depend> could not co-exist with other types of dependencies, nor could testing-only packages provide any build or configuration information.

For example, rostest defines an add_rostest() CMake command. Using it required a <build_depend>rostest</build_depend>, even though it was only needed when testing is enabled. Even worse, also declaring <test_depend>rostest</test_depend> was considered an error.

With format two, a <test_depend> for rostest works as expected, no separate <build_depend> is required in that case. That assumes that the configure step is done with the flag CATKIN_ENABLE_TESTING being set and that the package correctly uses the flag to disable all configuration of unit tests. Moreover, packages needed for several reasons may now be declared using any desired combination of dependency types, including <test_depend>.
edit flag offensive delete link more
1

answered 2014-01-08 08:54:57 -0600

joq gravatar image

The <test_depend> tag matters for running tests from source, like <test_depend>unittest</test_depend>. Unfortunately, it currently does not resolve build or configuration dependencies needed by those tests. Use a <build_depend> for that instead.

Test dependencies are ignored by bloom for Ubuntu package builds. The current ROS build and packaging scheme does not support testing of Ubuntu packages, or creating of test packages.

Once REP-0140 is approved and implemented <test_depend> will work for build and configuration dependencies, as well as for execution dependencies. That is a definite improvement, but the packaging restrictions will remain.

edit flag offensive delete link more

Comments

So, I'm not seeing information in this answer that says how test_depend is used. You say it "matters for running tests from source". So when I type "catkin_make run_tests", and I have "<test_depend>foo<...>", then catkin_make does something relating to foo?

hersh gravatar image hersh  ( 2014-01-08 10:58:40 -0600 )edit

``make run_tests`` depends on CMakeLists.txt invoking commands like ``catkin_add_nosetests()``, ``catkin_addgtest`` and ``add_rostest()``. Those commands define the appropriate targets. See: http://docs.ros.org/api/catkin/html/howto/index.html#configuring-and-running-unit-tests

joq gravatar image joq  ( 2014-01-08 11:14:49 -0600 )edit

I understand that "make run_tests" needs things provided by packages specified in "test_depend" tags. What I don't understand is what actually reads the "test_depend" flags and does something with them. Does cmake do "find_package(foo)" during "run_tests" if I have "<test_depend>foo<>"?

hersh gravatar image hersh  ( 2014-01-08 11:20:52 -0600 )edit

Actually I would be very surprised by that, because cmake doesn't even do the find_package() calls for you even if you have declared <build_depend> or <run_depend>. You have to do that yourself with find_package(catkin COMPONENTS foo).

hersh gravatar image hersh  ( 2014-01-08 11:22:44 -0600 )edit

CMake does not do find_package() for you. You must do it yourself.

joq gravatar image joq  ( 2014-01-08 12:11:47 -0600 )edit
1

Exactly, so my question still stands: what does the <test_depend> tag actually do?

hersh gravatar image hersh  ( 2014-01-08 12:52:50 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-01-07 05:05:25 -0600

Seen: 2,325 times

Last updated: Dec 08 '15