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

catkin_add_gtest usage

asked 2014-04-16 15:05:51 -0500

Adam YH Lee gravatar image

Hello everyone, turtlebot-description package has a CMakeLists as below:

cmake_minimum_required(VERSION 2.8.3)

project(turtlebot_description)
find_package(catkin REQUIRED COMPONENTS urdf xacro)

catkin_package(
   CATKIN_DEPENDS urdf xacro
)

install(DIRECTORY robots
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY meshes
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY test
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY urdf
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

catkin_add_gtest(${PROJECT_NAME}_test_urdf test/test_urdf.cpp)

During the build, I get an error message as below:

| CMake Error at /media/Build/next/build/tmp/sysroots/duovero/usr/share/catkin/cmake/test/tests.cmake:17 (message):
|   catkin_add_gtest() is not available when tests are not enabled.  The CMake
|   code should only use it inside a conditional block which checks that
|   testing is enabled:
| 
|   if(CATKIN_ENABLE_TESTING)
| 
|     catkin_add_gtest(...)
| 
|   endif()

It's obvious that the unit test should be only called when testing is enabled. However, the last commit on this code was 7 months ago. I am sure some would have caught the error by now. So I began looking for the correct use case for this macro, and the ROS doc doesn't mention much about it. Can someone verify that it indeed needs to check whether testing is enabled?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-04-16 15:13:30 -0500

ahendrix gravatar image

Confirmed; that is the correct use of catkin_add_gtest()

You should open this as a bug against the turtlebot_description package.

edit flag offensive delete link more

Comments

great thank you!

Adam YH Lee gravatar image Adam YH Lee  ( 2014-04-17 06:47:21 -0500 )edit
2

answered 2014-04-16 22:18:06 -0500

fergs gravatar image

CATKIN_ENABLE_TESTING was a late addition to catkin, and not every package has been updated to wrap their tests with the if/endif block. File a bug report, or create a pull request (preferred!).

edit flag offensive delete link more

Comments

Thanks, I created a pull request =)

Adam YH Lee gravatar image Adam YH Lee  ( 2014-04-17 06:47:52 -0500 )edit

Question Tools

Stats

Asked: 2014-04-16 15:05:51 -0500

Seen: 1,760 times

Last updated: Apr 16 '14