Skip to content

Commit c10764f

Browse files
authored
Split test_executors up into smaller chunks. (#2421)
The original reason is that on Windows Debug, we were failing to compile because the compilation unit was too large. But also this file was way too large (1200 lines), so it makes sense to split it up. Signed-off-by: Chris Lalancette <[email protected]>
1 parent 99f0fc9 commit c10764f

File tree

5 files changed

+624
-523
lines changed

5 files changed

+624
-523
lines changed

rclcpp/test/rclcpp/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,24 @@ if(TARGET test_executors)
441441
target_link_libraries(test_executors ${PROJECT_NAME} rcl::rcl ${test_msgs_TARGETS})
442442
endif()
443443

444+
ament_add_gtest(
445+
test_executors_timer_cancel_behavior
446+
executors/test_executors_timer_cancel_behavior.cpp
447+
APPEND_LIBRARY_DIRS "${append_library_dirs}"
448+
TIMEOUT 180)
449+
if(TARGET test_executors)
450+
target_link_libraries(test_executors_timer_cancel_behavior ${PROJECT_NAME} ${rosgraph_msgs_TARGETS})
451+
endif()
452+
453+
ament_add_gtest(
454+
test_executors_intraprocess
455+
executors/test_executors_intraprocess.cpp
456+
APPEND_LIBRARY_DIRS "${append_library_dirs}"
457+
TIMEOUT 180)
458+
if(TARGET test_executors)
459+
target_link_libraries(test_executors_intraprocess ${PROJECT_NAME} ${test_msgs_TARGETS})
460+
endif()
461+
444462
ament_add_gtest(test_static_single_threaded_executor executors/test_static_single_threaded_executor.cpp
445463
APPEND_LIBRARY_DIRS "${append_library_dirs}")
446464
if(TARGET test_static_single_threaded_executor)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2017 Open Source Robotics Foundation, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef RCLCPP__EXECUTORS__EXECUTOR_TYPES_HPP_
16+
#define RCLCPP__EXECUTORS__EXECUTOR_TYPES_HPP_
17+
18+
#include <gtest/gtest.h>
19+
20+
#include <string>
21+
#include <type_traits>
22+
23+
#include "rclcpp/experimental/executors/events_executor/events_executor.hpp"
24+
#include "rclcpp/executors/single_threaded_executor.hpp"
25+
#include "rclcpp/executors/static_single_threaded_executor.hpp"
26+
#include "rclcpp/executors/multi_threaded_executor.hpp"
27+
28+
using ExecutorTypes =
29+
::testing::Types<
30+
rclcpp::executors::SingleThreadedExecutor,
31+
rclcpp::executors::MultiThreadedExecutor,
32+
rclcpp::executors::StaticSingleThreadedExecutor,
33+
rclcpp::experimental::executors::EventsExecutor>;
34+
35+
class ExecutorTypeNames
36+
{
37+
public:
38+
template<typename T>
39+
static std::string GetName(int idx)
40+
{
41+
(void)idx;
42+
if (std::is_same<T, rclcpp::executors::SingleThreadedExecutor>()) {
43+
return "SingleThreadedExecutor";
44+
}
45+
46+
if (std::is_same<T, rclcpp::executors::MultiThreadedExecutor>()) {
47+
return "MultiThreadedExecutor";
48+
}
49+
50+
if (std::is_same<T, rclcpp::executors::StaticSingleThreadedExecutor>()) {
51+
return "StaticSingleThreadedExecutor";
52+
}
53+
54+
if (std::is_same<T, rclcpp::experimental::executors::EventsExecutor>()) {
55+
return "EventsExecutor";
56+
}
57+
58+
return "";
59+
}
60+
};
61+
62+
// StaticSingleThreadedExecutor is not included in these tests for now, due to:
63+
// https://github.com/ros2/rclcpp/issues/1219
64+
using StandardExecutors =
65+
::testing::Types<
66+
rclcpp::executors::SingleThreadedExecutor,
67+
rclcpp::executors::MultiThreadedExecutor,
68+
rclcpp::experimental::executors::EventsExecutor>;
69+
70+
#endif // RCLCPP__EXECUTORS__EXECUTOR_TYPES_HPP_

0 commit comments

Comments
 (0)