From e76ef6a156a104b2369757438b6d8fc253d661e6 Mon Sep 17 00:00:00 2001 From: Michel Hidalgo Date: Thu, 28 May 2020 11:30:07 -0300 Subject: [PATCH 1/2] Do not compile assert death tests in Release builds. Signed-off-by: Michel Hidalgo --- rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp | 4 ++++ rmw_fastrtps_shared_cpp/test/test_names.cpp | 2 ++ 2 files changed, 6 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..bb893d28d 100644 --- a/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp +++ b/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp @@ -25,15 +25,19 @@ static constexpr size_t byte_array_size = eprosima::fastrtps::rtps::GuidPrefix_t::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) { uint8_t input_byte_array[byte_array_size] = {0}; input_byte_array[0] = 0xA5; 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( From 31ee7146a6dbbf594841be7eb039cff4011b8ad3 Mon Sep 17 00:00:00 2001 From: Michel Hidalgo Date: Thu, 28 May 2020 19:19:08 -0300 Subject: [PATCH 2/2] Drop extra lines. Signed-off-by: Michel Hidalgo --- rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp b/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp index bb893d28d..588da9ecd 100644 --- a/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp +++ b/rmw_fastrtps_shared_cpp/test/test_guid_utils.cpp @@ -25,7 +25,6 @@ static constexpr size_t byte_array_size = eprosima::fastrtps::rtps::GuidPrefix_t::size + eprosima::fastrtps::rtps::EntityId_t::size; - TEST(GUIDUtilsTest, bad_arguments) { #ifndef NDEBUG eprosima::fastrtps::rtps::GUID_t guid; @@ -37,7 +36,6 @@ TEST(GUIDUtilsTest, bad_arguments) { #endif } - TEST(GUIDUtilsTest, byte_array_to_guid_and_back) { uint8_t input_byte_array[byte_array_size] = {0}; input_byte_array[0] = 0xA5;