From 283e476c26c59fe8f921b0b7adfa212cf7b52bf1 Mon Sep 17 00:00:00 2001 From: William Woodall Date: Wed, 12 Apr 2017 15:47:31 -0700 Subject: [PATCH 1/3] reenable tests for rcl_node_get_graph_guard_condition for all rmw impl --- rcl/test/rcl/test_node.cpp | 45 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/rcl/test/rcl/test_node.cpp b/rcl/test/rcl/test_node.cpp index 62967ee..7d17eb6 100644 --- a/rcl/test/rcl/test_node.cpp +++ b/rcl/test/rcl/test_node.cpp @@ -272,31 +272,26 @@ TEST_F(CLASSNAME(TestNodeFixture, RMW_IMPLEMENTATION), test_rcl_node_accessors) stop_memory_checking(); EXPECT_NE(0u, instance_id); // Test rcl_node_get_graph_guard_condition - std::string rmw_id(rmw_get_implementation_identifier()); - if (rmw_id.find("opensplice") != std::string::npos) { - // Only test with opensplice for now, as connext and fastrtps are not working. - // TODO(wjwwood): remove this check when more middlewares implement this - const rcl_guard_condition_t * graph_guard_condition = nullptr; - graph_guard_condition = rcl_node_get_graph_guard_condition(nullptr); - EXPECT_EQ(nullptr, graph_guard_condition); - rcl_reset_error(); - graph_guard_condition = rcl_node_get_graph_guard_condition(&zero_node); - EXPECT_EQ(nullptr, graph_guard_condition); - rcl_reset_error(); - graph_guard_condition = rcl_node_get_graph_guard_condition(&invalid_node); - EXPECT_EQ(nullptr, graph_guard_condition); - rcl_reset_error(); - start_memory_checking(); - assert_no_malloc_begin(); - assert_no_realloc_begin(); - assert_no_free_begin(); - graph_guard_condition = rcl_node_get_graph_guard_condition(&node); - assert_no_malloc_end(); - assert_no_realloc_end(); - assert_no_free_end(); - stop_memory_checking(); - EXPECT_NE(nullptr, graph_guard_condition); - } + const rcl_guard_condition_t * graph_guard_condition = nullptr; + graph_guard_condition = rcl_node_get_graph_guard_condition(nullptr); + EXPECT_EQ(nullptr, graph_guard_condition); + rcl_reset_error(); + graph_guard_condition = rcl_node_get_graph_guard_condition(&zero_node); + EXPECT_EQ(nullptr, graph_guard_condition); + rcl_reset_error(); + graph_guard_condition = rcl_node_get_graph_guard_condition(&invalid_node); + EXPECT_EQ(nullptr, graph_guard_condition); + rcl_reset_error(); + start_memory_checking(); + assert_no_malloc_begin(); + assert_no_realloc_begin(); + assert_no_free_begin(); + graph_guard_condition = rcl_node_get_graph_guard_condition(&node); + assert_no_malloc_end(); + assert_no_realloc_end(); + assert_no_free_end(); + stop_memory_checking(); + EXPECT_NE(nullptr, graph_guard_condition); } /* Tests the node life cycle, including rcl_node_init() and rcl_node_fini(). From 517b79bac663bb52513c31a4dd4567153ead62ac Mon Sep 17 00:00:00 2001 From: William Woodall Date: Wed, 12 Apr 2017 16:22:38 -0700 Subject: [PATCH 2/3] found more disabled tests that shouldn't be for Fast-RTPS --- rcl/test/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rcl/test/CMakeLists.txt b/rcl/test/CMakeLists.txt index a13ba46..3238f14 100644 --- a/rcl/test/CMakeLists.txt +++ b/rcl/test/CMakeLists.txt @@ -64,10 +64,9 @@ function(test_target_function) ) set(SKIP_TEST "") - # TODO(wjwwood): remove this when the graph API works properly for FastRTPS + # TODO(wjwwood): remove this when the graph API works properly for connext dynamic if( - rmw_implementation STREQUAL "rmw_connext_dynamic_cpp" OR - rmw_implementation STREQUAL "rmw_fastrtps_cpp" + rmw_implementation STREQUAL "rmw_connext_dynamic_cpp" ) message(STATUS "Skipping test_graph${target_suffix} test.") set(SKIP_TEST "SKIP_TEST") From ee03d1a7cc634b32b0902755fb86fc4f3533b669 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Fri, 19 May 2017 10:19:36 -0700 Subject: [PATCH 3/3] add debug output which part of the state is incorrect --- rcl/test/rcl/test_graph.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rcl/test/rcl/test_graph.cpp b/rcl/test/rcl/test_graph.cpp index ea8ebec..de4a686 100644 --- a/rcl/test/rcl/test_graph.cpp +++ b/rcl/test/rcl/test_graph.cpp @@ -263,7 +263,7 @@ check_graph_state( rcl_reset_error(); is_in_tnat = false; for (size_t i = 0; RCL_RET_OK == ret && i < tnat.topic_count; ++i) { - if (topic_name == std::string(tnat.topic_names[i])) { + if (topic_name == tnat.topic_names[i]) { ASSERT_FALSE(is_in_tnat) << "duplicates in the tnat"; // Found it more than once! is_in_tnat = true; } @@ -288,6 +288,16 @@ check_graph_state( { printf(" state correct!\n"); break; + } else { + if (expected_publisher_count != publisher_count) { + printf(" pub count incorrect!\n"); + } + if (expected_subscriber_count != subscriber_count) { + printf(" sub count incorrect!\n"); + } + if (expected_in_tnat != is_in_tnat) { + printf(" in tnat incorrect!\n"); + } } // Wait for graph change before trying again. if ((i + 1) == number_of_tries) {