From c086d8b84381a698d809a2fa1f394c857559edef Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Sun, 8 Mar 2020 23:17:57 -0400 Subject: [PATCH] Move test_utils from tracetools to tracetools_test Signed-off-by: Christophe Bedard --- tracetools/CMakeLists.txt | 11 ----------- tracetools/package.xml | 1 - tracetools_test/CMakeLists.txt | 10 ++++++++-- tracetools_test/package.xml | 1 + {tracetools => tracetools_test}/test/test_utils.cpp | 0 5 files changed, 9 insertions(+), 14 deletions(-) rename {tracetools => tracetools_test}/test/test_utils.cpp (100%) diff --git a/tracetools/CMakeLists.txt b/tracetools/CMakeLists.txt index 741216f..34742da 100644 --- a/tracetools/CMakeLists.txt +++ b/tracetools/CMakeLists.txt @@ -125,19 +125,8 @@ endif() if(BUILD_TESTING) set(ament_cmake_cppcheck_ADDITIONAL_INCLUDE_DIRS ${LTTNG_INCLUDE_DIRS}) - - find_package(ament_cmake_gtest REQUIRED) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() - - # Only build tracetools utils tests if LTTng is enabled and found - if(TRACETOOLS_LTTNG_ENABLED) - ament_add_gtest(test_utils test/test_utils.cpp) - if(TARGET test_utils) - # Since we cannot use ament_target_dependencies(... tracetools) in the same file - target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic) - endif() - endif() endif() ament_package() diff --git a/tracetools/package.xml b/tracetools/package.xml index 35e0276..201e985 100644 --- a/tracetools/package.xml +++ b/tracetools/package.xml @@ -13,7 +13,6 @@ ament_cmake_ros pkg-config - ament_cmake_gtest ament_lint_auto ament_lint_common diff --git a/tracetools_test/CMakeLists.txt b/tracetools_test/CMakeLists.txt index 9bace43..14141fa 100644 --- a/tracetools_test/CMakeLists.txt +++ b/tracetools_test/CMakeLists.txt @@ -103,8 +103,15 @@ if(BUILD_TESTING) # Only build tracing tests if LTTng is enabled and found if(TRACING_ENABLED) - find_package(ament_cmake_pytest REQUIRED) + find_package(ament_cmake_gtest REQUIRED) + ament_add_gtest(test_utils test/test_utils.cpp) + if(TARGET test_utils) + ament_target_dependencies(test_utils + tracetools + ) + endif() + find_package(ament_cmake_pytest REQUIRED) # Run each test in its own pytest invocation set(_tracetools_test_pytest_tests test/test_intra.py @@ -114,7 +121,6 @@ if(BUILD_TESTING) test/test_subscription.py test/test_timer.py ) - foreach(_test_path ${_tracetools_test_pytest_tests}) get_filename_component(_test_name ${_test_path} NAME_WE) ament_add_pytest_test(${_test_name} ${_test_path} diff --git a/tracetools_test/package.xml b/tracetools_test/package.xml index 62142d9..f8cc79e 100644 --- a/tracetools_test/package.xml +++ b/tracetools_test/package.xml @@ -20,6 +20,7 @@ std_msgs std_srvs + ament_cmake_gtest ament_cmake_mypy ament_cmake_pytest ament_lint_auto diff --git a/tracetools/test/test_utils.cpp b/tracetools_test/test/test_utils.cpp similarity index 100% rename from tracetools/test/test_utils.cpp rename to tracetools_test/test/test_utils.cpp