From 1a0092a65b2d0f97b57a31321d44827f07b0320e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Wed, 2 Oct 2024 19:59:48 +0200 Subject: [PATCH] Fixed test qos rmw zenoh (#2639) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed test qos rmw zenoh Signed-off-by: Alejandro Hernández Cordero * Update rclcpp/test/rclcpp/test_qos.cpp Co-authored-by: Yadu Signed-off-by: Alejandro Hernández Cordero --------- Signed-off-by: Alejandro Hernández Cordero Co-authored-by: Yadu --- rclcpp/test/rclcpp/test_qos.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rclcpp/test/rclcpp/test_qos.cpp b/rclcpp/test/rclcpp/test_qos.cpp index b2446beed3..eecfaf97a7 100644 --- a/rclcpp/test/rclcpp/test_qos.cpp +++ b/rclcpp/test/rclcpp/test_qos.cpp @@ -17,6 +17,7 @@ #include #include "rclcpp/qos.hpp" +#include "rmw/rmw.h" #include "rmw/types.h" @@ -241,13 +242,20 @@ TEST(TestQoS, qos_check_compatible) // TODO(jacobperron): programmatically check if current RMW is one of the officially // supported DDS middlewares before running the following tests + // If the RMW implementation is rmw_zenoh_cpp, we do not expect any QoS incompatibilities. + std::string rmw_implementation_str = std::string(rmw_get_implementation_identifier()); // Incompatible { rclcpp::QoS pub_qos = rclcpp::QoS(1).best_effort(); rclcpp::QoS sub_qos = rclcpp::QoS(1).reliable(); rclcpp::QoSCheckCompatibleResult ret = rclcpp::qos_check_compatible(pub_qos, sub_qos); - EXPECT_EQ(ret.compatibility, rclcpp::QoSCompatibility::Error); - EXPECT_FALSE(ret.reason.empty()); + if (rmw_implementation_str == "rmw_zenoh_cpp") { + EXPECT_EQ(ret.compatibility, rclcpp::QoSCompatibility::Ok); + EXPECT_TRUE(ret.reason.empty()); + } else { + EXPECT_EQ(ret.compatibility, rclcpp::QoSCompatibility::Error); + EXPECT_FALSE(ret.reason.empty()); + } } // Warn of possible incompatibility @@ -255,7 +263,12 @@ TEST(TestQoS, qos_check_compatible) rclcpp::SystemDefaultsQoS pub_qos; rclcpp::QoS sub_qos = rclcpp::QoS(1).reliable(); rclcpp::QoSCheckCompatibleResult ret = rclcpp::qos_check_compatible(pub_qos, sub_qos); - EXPECT_EQ(ret.compatibility, rclcpp::QoSCompatibility::Warning); - EXPECT_FALSE(ret.reason.empty()); + if (rmw_implementation_str == "rmw_zenoh_cpp") { + EXPECT_EQ(ret.compatibility, rclcpp::QoSCompatibility::Ok); + EXPECT_TRUE(ret.reason.empty()); + } else { + EXPECT_EQ(ret.compatibility, rclcpp::QoSCompatibility::Warning); + EXPECT_FALSE(ret.reason.empty()); + } } }