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
|
@ -3,17 +3,9 @@ variables:
|
||||||
PACKAGES_LIST: ros2trace tracetools tracetools_launch tracetools_read tracetools_test tracetools_trace
|
PACKAGES_LIST: ros2trace tracetools tracetools_launch tracetools_read tracetools_test tracetools_trace
|
||||||
base_image_id: registry.gitlab.com/micro-ros/ros_tracing/ci_base
|
base_image_id: registry.gitlab.com/micro-ros/ros_tracing/ci_base
|
||||||
|
|
||||||
build_enabled:
|
image: $base_image_id
|
||||||
image: $base_image_id
|
|
||||||
script:
|
.global_artifacts: &global_artifacts
|
||||||
- vcs import < instrumentation.repos
|
|
||||||
- rosdep install --from-paths . -i . -i /root/ws --rosdistro dashing -y
|
|
||||||
- lttng-sessiond --daemonize
|
|
||||||
- . /root/ws/install/local_setup.sh
|
|
||||||
- colcon build --symlink-install --packages-up-to $PACKAGES_LIST
|
|
||||||
- . install/local_setup.sh
|
|
||||||
- colcon test --packages-select $PACKAGES_LIST
|
|
||||||
- colcon test-result
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- install
|
- install
|
||||||
|
@ -23,3 +15,26 @@ build_enabled:
|
||||||
junit:
|
junit:
|
||||||
- build/*/test_results/*/*.xunit.xml
|
- build/*/test_results/*/*.xunit.xml
|
||||||
- build/*/pytest.xml
|
- build/*/pytest.xml
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- vcs import < instrumentation.repos
|
||||||
|
- rosdep install --from-paths . -i . -i /root/ws --rosdistro dashing -y
|
||||||
|
- . /root/ws/install/local_setup.sh
|
||||||
|
|
||||||
|
build_enabled:
|
||||||
|
script:
|
||||||
|
- lttng-sessiond --daemonize
|
||||||
|
- colcon build --symlink-install --packages-up-to $PACKAGES_LIST
|
||||||
|
- . install/local_setup.sh
|
||||||
|
- colcon test --packages-select $PACKAGES_LIST
|
||||||
|
- colcon test-result
|
||||||
|
<<: *global_artifacts
|
||||||
|
|
||||||
|
build:
|
||||||
|
script:
|
||||||
|
- rm colcon.meta
|
||||||
|
- colcon build --symlink-install --packages-up-to $PACKAGES_LIST
|
||||||
|
- . install/local_setup.sh
|
||||||
|
- colcon test --packages-select $PACKAGES_LIST
|
||||||
|
- colcon test-result
|
||||||
|
<<: *global_artifacts
|
||||||
|
|
|
@ -5,5 +5,10 @@
|
||||||
"-DWITH_LTTNG=ON",
|
"-DWITH_LTTNG=ON",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
"tracetools_test": {
|
||||||
|
"cmake-args": [
|
||||||
|
"-DWITH_LTTNG=ON",
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,12 @@ 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()
|
||||||
|
|
||||||
ament_add_gtest(test_utils test/test_utils.cpp)
|
# Only build tracetools utils tests if LTTng is enabled and found
|
||||||
if(TARGET test_utils)
|
if(TRACETOOLS_LTTNG_ENABLED)
|
||||||
target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic)
|
ament_add_gtest(test_utils test/test_utils.cpp)
|
||||||
|
if(TARGET test_utils)
|
||||||
|
target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -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,29 +118,38 @@ 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()
|
||||||
|
|
||||||
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
|
find_package(ament_cmake_pytest REQUIRED)
|
||||||
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})
|
# Run each test in its own pytest invocation
|
||||||
get_filename_component(_test_name ${_test_path} NAME_WE)
|
set(_tracetools_test_pytest_tests
|
||||||
ament_add_pytest_test(${_test_name} ${_test_path}
|
test/test_intra.py
|
||||||
PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}"
|
test/test_node.py
|
||||||
APPEND_ENV AMENT_PREFIX_PATH=${ament_index_build_path}
|
test/test_publisher.py
|
||||||
PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}
|
test/test_service.py
|
||||||
TIMEOUT 60
|
test/test_service_callback.py
|
||||||
)
|
test/test_subscription.py
|
||||||
endforeach()
|
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()
|
endif()
|
||||||
|
|
||||||
ament_package()
|
ament_package()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue