ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
![]() | 1 | initial version |
ament_add_gtest_executable
only calls add_executable() and links the target against the gtest libraries. It does not register the executable as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake#L16-L19)
What you want instead is ament_add_gtest
. This macro calls add_executable()
, links the target against the gtest libraries, and registers the executable as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest.cmake#L16-L19)
For completeness, if you were using ament_add_gtest_executable
, you would have to supplement it with a call to ament_add_gtest_test
, which registers an executable created with ament_add_gtest_executable
as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest_test.cmake#L16-L19)
![]() | 2 | No.2 Revision |
ament_add_gtest_executable
only calls add_executable() and links the target against the gtest libraries. It does not register the executable as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake#L16-L19)
What you want instead is ament_add_gtest
. This macro calls add_executable()
, links the target against the gtest libraries, and registers the executable as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest.cmake#L16-L19)
For completeness, if you were using ament_add_gtest_executable
, you would have to supplement it with a call to ament_add_gtest_test
, which registers an executable created with ament_add_gtest_executable
as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest_test.cmake#L16-L19)
So you either do:
ament_add_gtest(driverobot_test
test/driverobot_test.cpp
)
or
ament_add_gtest_executable(driverobot_test
test/driverobot_test.cpp
)
ament_add_gtest_test(driverobot_test)
![]() | 3 | No.3 Revision |
ament_add_gtest_executable
only calls add_executable() and links the target against the gtest libraries. It does not register the executable as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake#L16-L19)
What you want instead is ament_add_gtest
. This macro calls add_executable(), links the target against the gtest libraries, and registers the executable as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest.cmake#L16-L19)add_executable()
,
For completeness, if you were using ament_add_gtest_executable
, you would have to supplement it with a call to ament_add_gtest_test
, which registers an executable created with ament_add_gtest_executable
as a test. (Check https://github.com/ament/ament_cmake/blob/2bf27ce5ad01af340e1f4efd44232c1067d0dbda/ament_cmake_gtest/cmake/ament_add_gtest_test.cmake#L16-L19)
So you either do:
ament_add_gtest(driverobot_test
test/driverobot_test.cpp
)
or
ament_add_gtest_executable(driverobot_test
test/driverobot_test.cpp
)
ament_add_gtest_test(driverobot_test)