From aefdc7bb9a93943033eb1d35b300b7791655c252 Mon Sep 17 00:00:00 2001 From: Bjar Ne Date: Mon, 8 Feb 2021 17:55:41 +0000 Subject: [PATCH] make tf2_eigen_test a ROS node --- tf2_eigen/CMakeLists.txt | 7 +++++-- tf2_eigen/package.xml | 3 ++- tf2_eigen/test/test.launch | 3 +++ tf2_eigen/test/tf2_eigen-test.cpp | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tf2_eigen/test/test.launch diff --git a/tf2_eigen/CMakeLists.txt b/tf2_eigen/CMakeLists.txt index 8fcc34718..371f48a3d 100644 --- a/tf2_eigen/CMakeLists.txt +++ b/tf2_eigen/CMakeLists.txt @@ -40,7 +40,10 @@ install(DIRECTORY include/${PROJECT_NAME}/ if(CATKIN_ENABLE_TESTING) - catkin_add_gtest(tf2_eigen-test test/tf2_eigen-test.cpp) - target_link_libraries(tf2_eigen-test ${catkin_LIBRARIES} ${GTEST_LIBRARIES}) + find_package(rostest REQUIRED) + + add_executable(tf2_eigen_test test/tf2_eigen-test.cpp) + target_link_libraries(tf2_eigen_test ${catkin_LIBRARIES} ${GTEST_LIBRARIES}) + add_rostest(${CMAKE_CURRENT_SOURCE_DIR}/test/test.launch) endif() diff --git a/tf2_eigen/package.xml b/tf2_eigen/package.xml index 4b804ffb8..ee77542d6 100644 --- a/tf2_eigen/package.xml +++ b/tf2_eigen/package.xml @@ -11,11 +11,12 @@ geometry_msgs tf2 - tf2_ros cmake_modules eigen + tf2_ros eigen + rostest diff --git a/tf2_eigen/test/test.launch b/tf2_eigen/test/test.launch new file mode 100644 index 000000000..1ccc919bb --- /dev/null +++ b/tf2_eigen/test/test.launch @@ -0,0 +1,3 @@ + + + diff --git a/tf2_eigen/test/tf2_eigen-test.cpp b/tf2_eigen/test/tf2_eigen-test.cpp index 59ff0b8e4..e931f6e07 100644 --- a/tf2_eigen/test/tf2_eigen-test.cpp +++ b/tf2_eigen/test/tf2_eigen-test.cpp @@ -38,6 +38,7 @@ #include +#include #include #include #include @@ -336,7 +337,8 @@ TEST_F(EigenBufferTransform, QuaternionRotZ) int main(int argc, char ** argv) { testing::InitGoogleTest(&argc, argv); - ros::Time::init(); + ros::init(argc, argv, "test"); + ros::NodeHandle n; return RUN_ALL_TESTS(); }