Only build and run tracing tests if LTTng is enabled and found
This commit is contained in:
parent
05863a35c6
commit
3542aab984
3 changed files with 43 additions and 24 deletions
|
@ -5,5 +5,10 @@
|
||||||
"-DWITH_LTTNG=ON",
|
"-DWITH_LTTNG=ON",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
"tracetools_test": {
|
||||||
|
"cmake-args": [
|
||||||
|
"-DWITH_LTTNG=ON",
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,10 +91,13 @@ if(BUILD_TESTING)
|
||||||
find_package(ament_lint_auto REQUIRED)
|
find_package(ament_lint_auto REQUIRED)
|
||||||
ament_lint_auto_find_test_dependencies()
|
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)
|
ament_add_gtest(test_utils test/test_utils.cpp)
|
||||||
if(TARGET test_utils)
|
if(TARGET test_utils)
|
||||||
target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic)
|
target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ament_package()
|
ament_package()
|
||||||
|
|
|
@ -12,6 +12,8 @@ endif()
|
||||||
|
|
||||||
find_package(ament_cmake REQUIRED)
|
find_package(ament_cmake REQUIRED)
|
||||||
|
|
||||||
|
option(WITH_LTTNG "Include support for tracing with LTTng" OFF)
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
find_package(rclcpp REQUIRED)
|
find_package(rclcpp REQUIRED)
|
||||||
|
@ -116,6 +118,13 @@ if(BUILD_TESTING)
|
||||||
find_package(ament_lint_auto REQUIRED)
|
find_package(ament_lint_auto REQUIRED)
|
||||||
ament_lint_auto_find_test_dependencies()
|
ament_lint_auto_find_test_dependencies()
|
||||||
|
|
||||||
|
# Only build tracing tests if LTTng is enabled and found
|
||||||
|
if(WITH_LTTNG)
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(LTTNG REQUIRED lttng-ust)
|
||||||
|
if(LTTNG_FOUND)
|
||||||
|
message("LTTng found: tracing tests enabled")
|
||||||
|
|
||||||
find_package(ament_cmake_pytest REQUIRED)
|
find_package(ament_cmake_pytest REQUIRED)
|
||||||
|
|
||||||
# Run each test in its own pytest invocation
|
# Run each test in its own pytest invocation
|
||||||
|
@ -139,6 +148,8 @@ if(BUILD_TESTING)
|
||||||
TIMEOUT 60
|
TIMEOUT 60
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ament_package()
|
ament_package()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue