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:
Christophe Bedard 2019-07-12 11:46:43 +00:00
commit 5bc10cace2
4 changed files with 69 additions and 35 deletions

View file

@ -3,17 +3,9 @@ variables:
PACKAGES_LIST: ros2trace tracetools tracetools_launch tracetools_read tracetools_test tracetools_trace
base_image_id: registry.gitlab.com/micro-ros/ros_tracing/ci_base
build_enabled:
image: $base_image_id
script:
- 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
.global_artifacts: &global_artifacts
artifacts:
paths:
- install
@ -23,3 +15,26 @@ build_enabled:
junit:
- build/*/test_results/*/*.xunit.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

View file

@ -5,5 +5,10 @@
"-DWITH_LTTNG=ON",
],
},
"tracetools_test": {
"cmake-args": [
"-DWITH_LTTNG=ON",
],
},
},
}

View file

@ -91,11 +91,14 @@ if(BUILD_TESTING)
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)
target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic)
endif()
endif()
endif()
ament_package()

View file

@ -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,6 +118,13 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
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)
# Run each test in its own pytest invocation
@ -140,5 +149,7 @@ if(BUILD_TESTING)
)
endforeach()
endif()
endif()
endif()
ament_package()