Merge branch '28-fix-tests-without-with_lttng' into 'master'
Resolve "Fix tests without WITH_LTTNG" Closes #28 See merge request micro-ROS/ros_tracing/ros2_tracing!59
This commit is contained in:
commit
5bc10cace2
4 changed files with 69 additions and 35 deletions
|
@ -12,6 +12,8 @@ endif()
|
|||
|
||||
find_package(ament_cmake REQUIRED)
|
||||
|
||||
option(WITH_LTTNG "Include support for tracing with LTTng" OFF)
|
||||
|
||||
# Tests
|
||||
if(BUILD_TESTING)
|
||||
find_package(rclcpp REQUIRED)
|
||||
|
@ -116,29 +118,38 @@ if(BUILD_TESTING)
|
|||
find_package(ament_lint_auto REQUIRED)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
|
||||
find_package(ament_cmake_pytest REQUIRED)
|
||||
# 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")
|
||||
|
||||
# Run each test in its own pytest invocation
|
||||
set(_tracetools_test_pytest_tests
|
||||
test/test_intra.py
|
||||
test/test_node.py
|
||||
test/test_publisher.py
|
||||
test/test_service.py
|
||||
test/test_service_callback.py
|
||||
test/test_subscription.py
|
||||
test/test_subscription_callback.py
|
||||
test/test_timer.py
|
||||
)
|
||||
find_package(ament_cmake_pytest REQUIRED)
|
||||
|
||||
foreach(_test_path ${_tracetools_test_pytest_tests})
|
||||
get_filename_component(_test_name ${_test_path} NAME_WE)
|
||||
ament_add_pytest_test(${_test_name} ${_test_path}
|
||||
PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}"
|
||||
APPEND_ENV AMENT_PREFIX_PATH=${ament_index_build_path}
|
||||
PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}
|
||||
TIMEOUT 60
|
||||
)
|
||||
endforeach()
|
||||
# Run each test in its own pytest invocation
|
||||
set(_tracetools_test_pytest_tests
|
||||
test/test_intra.py
|
||||
test/test_node.py
|
||||
test/test_publisher.py
|
||||
test/test_service.py
|
||||
test/test_service_callback.py
|
||||
test/test_subscription.py
|
||||
test/test_subscription_callback.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}
|
||||
PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}"
|
||||
APPEND_ENV AMENT_PREFIX_PATH=${ament_index_build_path}
|
||||
PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}
|
||||
TIMEOUT 60
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ament_package()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue