Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up rmw_cyclonedds timestamp testing. #1156

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions rcl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -295,24 +295,14 @@ function(test_target)
ament_add_test_label(test_subscription${target_suffix} mimick)
# TODO(asorbini) Enable message timestamp tests for rmw_connextdds on Windows
# once clock incompatibilities are resolved.
if(rmw_implementation STREQUAL "rmw_fastrtps_cpp" OR
rmw_implementation STREQUAL "rmw_fastrtps_dynamic_cpp" OR
(rmw_implementation STREQUAL "rmw_connextdds" AND NOT WIN32))
if(rmw_implementation STREQUAL "rmw_connextdds" AND WIN32)
message(STATUS "Disabling message timestamp test for ${rmw_implementation}")
else()
message(STATUS "Enabling message timestamp test for ${rmw_implementation}")
target_compile_definitions(test_subscription${target_suffix}
PUBLIC "RMW_TIMESTAMPS_SUPPORTED=1" "RMW_RECEIVED_TIMESTAMP_SUPPORTED=1")
PRIVATE "RMW_TIMESTAMPS_SUPPORTED=1")
target_compile_definitions(test_service${target_suffix}
PUBLIC "RMW_TIMESTAMPS_SUPPORTED=1" "RMW_RECEIVED_TIMESTAMP_SUPPORTED=1")
else()
if(rmw_implementation STREQUAL "rmw_cyclonedds_cpp")
message(STATUS "Enabling only source timestamp test for ${rmw_implementation}")
target_compile_definitions(test_subscription${target_suffix}
PUBLIC "RMW_TIMESTAMPS_SUPPORTED=1")
target_compile_definitions(test_service${target_suffix}
PUBLIC "RMW_TIMESTAMPS_SUPPORTED=1")
else()
message(STATUS "Disabling message timestamp test for ${rmw_implementation}")
endif()
PRIVATE "RMW_TIMESTAMPS_SUPPORTED=1")
endif()

ament_add_gtest_test(test_events
Expand Down
8 changes: 0 additions & 8 deletions rcl/test/rcl/test_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,8 @@ TEST_F(TestServiceFixture, test_service_nominal) {
EXPECT_EQ(2UL, service_request.uint32_value);
#ifdef RMW_TIMESTAMPS_SUPPORTED
EXPECT_GE(header.source_timestamp, start_timestamp);
#ifdef RMW_RECEIVED_TIMESTAMP_SUPPORTED
EXPECT_GE(header.received_timestamp, start_timestamp);
EXPECT_GE(header.received_timestamp, header.source_timestamp);
#else
EXPECT_EQ(0u, header.received_timestamp);
#endif
#else
EXPECT_EQ(0u, header.source_timestamp);
EXPECT_EQ(0u, header.received_timestamp);
Expand All @@ -214,12 +210,8 @@ TEST_F(TestServiceFixture, test_service_nominal) {
EXPECT_EQ(header.request_id.sequence_number, 1);
#ifdef RMW_TIMESTAMPS_SUPPORTED
EXPECT_GE(header.source_timestamp, start_timestamp);
#ifdef RMW_RECEIVED_TIMESTAMP_SUPPORTED
EXPECT_GE(header.received_timestamp, start_timestamp);
EXPECT_GE(header.received_timestamp, header.source_timestamp);
#else
EXPECT_EQ(0u, header.received_timestamp);
#endif
#else
EXPECT_EQ(0u, header.source_timestamp);
EXPECT_EQ(0u, header.received_timestamp);
Expand Down
4 changes: 0 additions & 4 deletions rcl/test/rcl/test_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,9 @@ TEST_F(TestSubscriptionFixture, test_subscription_nominal) {
EXPECT_NE(0u, message_info.source_timestamp);
EXPECT_TRUE(pre_publish_time <= message_info.source_timestamp) <<
pre_publish_time << " > " << message_info.source_timestamp;
#ifdef RMW_RECEIVED_TIMESTAMP_SUPPORTED
EXPECT_NE(0u, message_info.received_timestamp);
EXPECT_TRUE(pre_publish_time <= message_info.received_timestamp);
EXPECT_TRUE(message_info.source_timestamp <= message_info.received_timestamp);
#else
EXPECT_EQ(0u, message_info.received_timestamp);
#endif
#else
EXPECT_EQ(0u, message_info.source_timestamp);
EXPECT_EQ(0u, message_info.received_timestamp);
Expand Down