From 316c62d20d99cac178c0e2d51ec6719eb89c9de7 Mon Sep 17 00:00:00 2001 From: Alexis Pojomovsky Date: Tue, 4 Dec 2018 13:48:25 -0300 Subject: [PATCH 1/3] Make test_action_communication to be compiled against all available rmw" --- rcl_action/CMakeLists.txt | 74 +++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 11 deletions(-) diff --git a/rcl_action/CMakeLists.txt b/rcl_action/CMakeLists.txt index 2fc49b9..e2c7b16 100644 --- a/rcl_action/CMakeLists.txt +++ b/rcl_action/CMakeLists.txt @@ -9,6 +9,7 @@ find_package(action_msgs REQUIRED) find_package(rcl REQUIRED) find_package(rcutils REQUIRED) find_package(rmw REQUIRED) +find_package(rmw_implementation_cmake REQUIRED) include_directories( include @@ -95,19 +96,70 @@ if(BUILD_TESTING) ) ament_target_dependencies(test_action_client "rcl" "test_msgs") endif() - ament_add_gtest(test_action_communication - test/rcl_action/test_action_communication.cpp - ) - if(TARGET test_action_communication) - target_include_directories(test_action_communication PUBLIC - include - ${rcl_INCLUDE_DIRS} + + # get the rmw implementations ahead of time + find_package(rmw_implementation_cmake REQUIRED) + get_available_rmw_implementations(rmw_implementations) + foreach(rmw_implementation ${rmw_implementations}) + find_package("${rmw_implementation}" REQUIRED) + endforeach() + + function(custom_test_c target) + ament_add_gtest( + "test_action_communication_${target_suffix}" ${ARGN} + TIMEOUT 10 + APPEND_LIBRARY_DIRS "${append_library_dirs}" + ENV + RCL_ASSERT_RMW_ID_MATCHES=${rmw_implementation} + RMW_IMPLEMENTATION=${rmw_implementation} + ROS_SECURITY_ROOT_DIRECTORY="${VALID_ROS_SECURITY_ROOT_DIRECTORY}" + PATH="${TEST_PATH}" ) - target_link_libraries(test_action_communication - ${PROJECT_NAME} + if(TARGET test_action_communication_${target_suffix}) + target_compile_definitions(test_action_communication_${target_suffix} + PUBLIC "RMW_IMPLEMENTATION=${rmw_implementation}") + target_include_directories(test_action_communication_${target_suffix} PUBLIC + include + ${rcl_INCLUDE_DIRS} + ) + target_link_libraries(test_action_communication_${target_suffix} + ${PROJECT_NAME} + ) + ament_target_dependencies(test_action_communication_${target_suffix} + "test_msgs") + endif() + endfunction() + + macro(targets) + set(VALID_ROS_SECURITY_ROOT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test/test_security_files") + + set(ENV_PATH "$ENV{PATH}") + file(TO_CMAKE_PATH "${ENV_PATH}" ENV_PATH) + set(TEST_PATH "${ENV_PATH}") + if(rmw_implementation STREQUAL "rmw_connext_cpp") + if(UNIX AND NOT APPLE) + set(RTI_BIN_PATH "$ENV{RTI_OPENSSL_BIN}") + file(TO_CMAKE_PATH "${RTI_BIN_PATH}" RTI_BIN_PATH) + set(TEST_PATH "${RTI_BIN_PATH};${ENV_PATH}") + if(NOT WIN32) + string(REPLACE ";" ":" TEST_PATH "${TEST_PATH}") + endif() + endif() + endif() + + if( + rmw_implementation STREQUAL "rmw_connext_cpp" OR + rmw_implementation STREQUAL "rmw_connext_dynamic_cpp" OR + rmw_implementation STREQUAL "rmw_fastrtps_cpp" OR + rmw_implementation STREQUAL "rmw_fastrtps_dynamic_cpp" ) - ament_target_dependencies(test_action_communication "test_msgs") - endif() + custom_test_c(rcl_action + "test/rcl_action/test_action_communication.cpp") + endif() + endmacro() + + call_for_each_rmw_implementation(targets) + ament_add_gtest(test_action_server test/rcl_action/test_action_server.cpp ) From 46e2911d4514e07f70204cb9f6a5bb7573092fcf Mon Sep 17 00:00:00 2001 From: Alexis Pojomovsky Date: Wed, 5 Dec 2018 17:37:21 -0300 Subject: [PATCH 2/3] Removed unnecessary condition in cmake --- rcl_action/CMakeLists.txt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/rcl_action/CMakeLists.txt b/rcl_action/CMakeLists.txt index e2c7b16..8ec06d8 100644 --- a/rcl_action/CMakeLists.txt +++ b/rcl_action/CMakeLists.txt @@ -146,16 +146,8 @@ if(BUILD_TESTING) endif() endif() endif() - - if( - rmw_implementation STREQUAL "rmw_connext_cpp" OR - rmw_implementation STREQUAL "rmw_connext_dynamic_cpp" OR - rmw_implementation STREQUAL "rmw_fastrtps_cpp" OR - rmw_implementation STREQUAL "rmw_fastrtps_dynamic_cpp" - ) - custom_test_c(rcl_action - "test/rcl_action/test_action_communication.cpp") - endif() + custom_test_c(rcl_action + "test/rcl_action/test_action_communication.cpp") endmacro() call_for_each_rmw_implementation(targets) From f9ce6bd186f5a884578397831bcbb7eb8fed75c4 Mon Sep 17 00:00:00 2001 From: Alexis Pojomovsky Date: Thu, 6 Dec 2018 14:41:09 -0300 Subject: [PATCH 3/3] Increased gtest timeout for communication tests --- rcl_action/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcl_action/CMakeLists.txt b/rcl_action/CMakeLists.txt index 8ec06d8..3a57fcd 100644 --- a/rcl_action/CMakeLists.txt +++ b/rcl_action/CMakeLists.txt @@ -107,7 +107,7 @@ if(BUILD_TESTING) function(custom_test_c target) ament_add_gtest( "test_action_communication_${target_suffix}" ${ARGN} - TIMEOUT 10 + TIMEOUT 60 APPEND_LIBRARY_DIRS "${append_library_dirs}" ENV RCL_ASSERT_RMW_ID_MATCHES=${rmw_implementation}