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

How do I conditionally include a catkin component only for testing?

asked 2014-01-08 05:49:48 -0500

hersh gravatar image

I'm trying to include unit tests in my catkin package (moveit_core), but they require a support package (moveit_resources) which I do not want to be required for normal installation of the main package (moveit_core).

This page: http://docs.ros.org/hydro/api/catkin/html/howto/index.html#configuring-and-running-unit-tests says that the correct thing for unit tests is to test the CMake variable CATKIN_ENABLE_TESTING. But that option is defined in the catkin cmake files, so it won't be available until after the "find_package(catkin ...)" call. The support package I want to conditionally include would be an argument to that same find_package(catkin ...) call, so I can't do it that way.

If I just do it the typical cmake way with an explicit "find_package(moveit_resources)" and then check the variable moveit_resources_FOUND, it comes up false when I first run catkin_make and true on subsequent runs of catkin_make. This means I do have a workaround for my automated testing, but it means running catkin_make multiple times, which is slower.

So is there some way to simulate what find_package(catkin...) does for components even when they are not installed, when they are still just source packages in the current workspace?

Or maybe package.xml's test_depends tag could be put to use here? (see http://answers.ros.org/question/115526/is-test_depend-actually-used-for-anything/ )

Any help is appreciated. Thanks, Dave

edit retag flag offensive close merge delete

Comments

I just filed this bug: https://github.com/ros-infrastructure/catkin_pkg/issues/83 against catkin_pkg. As far as I can see, find_package(moveit_resources) fails the first time because moveit_resources comes later in the topological order.

hersh gravatar image hersh  ( 2014-01-08 06:18:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-01-08 06:25:12 -0500

Dirk Thomas gravatar image

Any dependency required at configure / build time must be listed as a build_depend. test_depend is currently only used for additional run dependencies only need when executing the tests.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-01-08 05:49:48 -0500

Seen: 656 times

Last updated: Jan 08 '14