From 08a51c29da3d7a2f9c7ed0fc4f7331db89ef8ced Mon Sep 17 00:00:00 2001 From: Michel Hidalgo Date: Thu, 28 May 2020 19:32:55 -0300 Subject: [PATCH] Do not compile assert death tests in Release builds. (#393) Signed-off-by: Michel Hidalgo --- rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp | 2 ++ rmw_fastrtps_shared_cpp/test/test_names.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp b/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp index 5e45b17a8..588da9ecd 100644 --- a/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp +++ b/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp @@ -26,12 +26,14 @@ static constexpr size_t byte_array_size = eprosima::fastrtps::rtps::EntityId_t::size; TEST(GUIDUtilsTest, bad_arguments) { +#ifndef NDEBUG eprosima::fastrtps::rtps::GUID_t guid; uint8_t byte_array[byte_array_size] = {0}; uint8_t * null_byte_array = nullptr; EXPECT_DEATH(copy_from_byte_array_to_fastrtps_guid(byte_array, nullptr), ""); EXPECT_DEATH(copy_from_byte_array_to_fastrtps_guid(null_byte_array, &guid), ""); EXPECT_DEATH(copy_from_fastrtps_guid_to_byte_array(guid, null_byte_array), ""); +#endif } TEST(GUIDUtilsTest, byte_array_to_guid_and_back) { diff --git a/rmw_fastrtps_shared_cpp/test/test_names.cpp b/rmw_fastrtps_shared_cpp/test/test_names.cpp index 3d9a40bcc..9f30c99ef 100644 --- a/rmw_fastrtps_shared_cpp/test/test_names.cpp +++ b/rmw_fastrtps_shared_cpp/test/test_names.cpp @@ -67,9 +67,11 @@ TEST(NamespaceTest, name_mangling) { rmw_qos_profile_t qos_profile = rmw_qos_profile_unknown; qos_profile.avoid_ros_namespace_conventions = false; +#ifndef NDEBUG EXPECT_DEATH(_create_topic_name(nullptr, "", "", ""), ""); EXPECT_DEATH(_create_topic_name(&qos_profile, "", nullptr, ""), ""); +#endif EXPECT_STREQ( "some_ros_prefix/test__suffix", _create_topic_name(