Skip to content

Commit

Permalink
Included clock system test in CMake (#324)
Browse files Browse the repository at this point in the history
* Included clock system test in CMake

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

---------

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
  • Loading branch information
ahcorde authored Dec 28, 2023
1 parent b7193ad commit 5661886
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 10 additions & 0 deletions drake_ros/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,14 @@ if(BUILD_TESTING)

ament_add_gtest(test_geometry_conversions test/test_geometry_conversions.cc)
target_link_libraries(test_geometry_conversions drake_ros_core)

ament_add_gtest(test_clock_system test/test_clock_system.cc)
target_compile_definitions(test_clock_system
PRIVATE
# We do not expose `rmw_isoliation` via CMake.
_TEST_DISABLE_RMW_ISOLATION
)
target_link_libraries(test_clock_system
drake_ros_core
)
endif()
6 changes: 2 additions & 4 deletions drake_ros/core/test/test_clock_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@ TEST(Integration, clock_system) {
auto subscription =
direct_ros_node->create_subscription<rosgraph_msgs::msg::Clock>(
"/clock", rclcpp::ClockQoS(),
[&](const rosgraph_msgs::msg::Clock::SharedPtr msg) {
msg_counter++;
});
[&](const rosgraph_msgs::msg::Clock::SharedPtr) { msg_counter++; });

simulator->AdvanceTo(simulator_context.get_time() + 1.0);
rclcpp::spin_some(direct_ros_node);
EXPECT_GE(msg_counter, 1);
EXPECT_GE(msg_counter, 1u);

drake_ros::core::shutdown();
}
Expand Down

0 comments on commit 5661886

Please sign in to comment.