-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
79 lines (70 loc) · 2.55 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# This CMakeLists.txt only include the lines needed to set up this test
# in your own custom ROS 2 package. Other necessary CMake commands
# (such as the boilerplate ROS 2 items added when using ros2 pkg create)
# are omitted.
# THIS LINE SHOULD BE UNCOMMENTED - it is only commented here
# so this file can be included in the top level CMakeLists.txt
# find_package(catch_ros2 REQUIRED) # UNCOMMENT
find_package(rclcpp REQUIRED)
find_package(std_srvs REQUIRED)
##########################
## INTEGRATION AUX NODE ##
##########################
# This could be any node in your ROS 2 package
# Likely you are looking to test some functionality of this node
add_executable(integration_aux_node
examples/integration_test/integration_aux_node.cpp
)
ament_target_dependencies(integration_aux_node
rclcpp std_srvs
)
install(TARGETS
integration_aux_node
DESTINATION lib/${PROJECT_NAME}
)
if(BUILD_TESTING)
include(CTest)
###########################
## INTEGRATION TEST NODE ##
###########################
# This is the node in which integration tests occur
add_executable(integration_test_node
examples/integration_test/integration_test_node.cpp
)
# The link libraries call links this node with catch_ros2::catch_ros2_with_node_main
# to get the default integration test node main function
target_link_libraries(integration_test_node
catch_ros2::catch_ros2_with_node_main
)
ament_target_dependencies(integration_test_node
rclcpp std_srvs
)
install(TARGETS
integration_test_node
DESTINATION lib/${PROJECT_NAME}
)
#################
## LAUNCH FILE ##
#################
# This is the launch file that will be used to run the integration test
install(FILES
examples/integration_test/example_integration_test.launch.py # example in Python
examples/integration_test/example_integration_test.launch.xml # example in XML
examples/integration_test/example_integration_test.launch.yaml # example in YAML
DESTINATION share/${PROJECT_NAME}
)
######################
## INTEGRATION TEST ##
######################
# This CMake function allows the integration test to be run
# when running "colcon test".
catch_ros2_add_integration_test(ExampleIntegration_TestPython
LAUNCH_FILE example_integration_test.launch.py # example in Python
)
catch_ros2_add_integration_test(ExampleIntegration_TestXML
LAUNCH_FILE example_integration_test.launch.xml # example in XML
)
catch_ros2_add_integration_test(ExampleIntegration_TestYAML
LAUNCH_FILE example_integration_test.launch.xml # example in YAML
)
endif()