Add tracetools_test package with simple test
This commit is contained in:
parent
372f0296c0
commit
6caaa51764
5 changed files with 166 additions and 0 deletions
49
tracetools_test/CMakeLists.txt
Normal file
49
tracetools_test/CMakeLists.txt
Normal file
|
@ -0,0 +1,49 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
project(tracetools_test)
|
||||
|
||||
# Default to C++14
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic -fPIC)
|
||||
endif()
|
||||
|
||||
find_package(ament_cmake REQUIRED)
|
||||
find_package(rclcpp REQUIRED)
|
||||
find_package(std_msgs REQUIRED)
|
||||
|
||||
# Tests
|
||||
if(BUILD_TESTING)
|
||||
add_executable(test_publisher
|
||||
test/test_publisher.cpp
|
||||
)
|
||||
ament_target_dependencies(test_publisher
|
||||
rclcpp
|
||||
std_msgs
|
||||
)
|
||||
install(TARGETS
|
||||
test_publisher
|
||||
DESTINATION lib/${PROJECT_NAME}
|
||||
)
|
||||
|
||||
find_package(ament_cmake_pytest REQUIRED)
|
||||
|
||||
# Run each test in its own pytest invocation
|
||||
set(_tracetools_test_pytest_tests
|
||||
test/test_publisher.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()
|
||||
|
||||
ament_package()
|
Loading…
Add table
Add a link
Reference in a new issue