Debug info for test_rcl_get_node_names (#133)

* Debug output for failed node_names test

* Give test nodes unique names

* Put test name in printout
This commit is contained in:
dhood 2017-05-02 10:25:48 -07:00 committed by GitHub
parent 309fa5cf0f
commit fc75c58962
11 changed files with 19 additions and 12 deletions

View file

@ -107,7 +107,7 @@ int main(int argc, char ** argv)
return -1;
}
rcl_node_t node = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "client_fixture_node";
rcl_node_options_t node_options = rcl_node_get_default_options();
if (rcl_node_init(&node, name, "", &node_options) != RCL_RET_OK) {
fprintf(stderr, "Error in node init: %s\n", rcl_get_error_string_safe());

View file

@ -81,7 +81,7 @@ int main(int argc, char ** argv)
return -1;
}
rcl_node_t node = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "service_fixture_node";
rcl_node_options_t node_options = rcl_node_get_default_options();
if (rcl_node_init(&node, name, "", &node_options) != RCL_RET_OK) {
fprintf(stderr, "Error in node init: %s\n", rcl_get_error_string_safe());

View file

@ -37,7 +37,7 @@ public:
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();
this->node_ptr = new rcl_node_t;
*this->node_ptr = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_client_node";
rcl_node_options_t node_options = rcl_node_get_default_options();
ret = rcl_node_init(this->node_ptr, name, "", &node_options);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();

View file

@ -15,6 +15,8 @@
#include <gtest/gtest.h>
#include <chrono>
#include <iostream>
#include <sstream>
#include <thread>
#include "rcutils/types.h"
@ -81,7 +83,12 @@ TEST_F(CLASSNAME(TestGetNodeNames, RMW_IMPLEMENTATION), test_rcl_get_node_names)
ret = rcl_get_node_names(node1_ptr, node1_options.allocator, &node_names);
ASSERT_EQ(RCUTILS_RET_OK, ret) << rcl_get_error_string_safe();
EXPECT_EQ(size_t(2), node_names.size);
std::stringstream ss;
ss << "[test_rcl_get_node_names]: Found node names:" << std::endl;
for (size_t i = 0; i < node_names.size; ++i) {
ss << node_names.data[i] << std::endl;
}
EXPECT_EQ(size_t(2), node_names.size) << ss.str();
EXPECT_EQ(0, strcmp(node1_name, node_names.data[0]));
EXPECT_EQ(0, strcmp(node2_name, node_names.data[1]));

View file

@ -72,7 +72,7 @@ public:
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();
this->node_ptr = new rcl_node_t;
*this->node_ptr = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_graph_node";
ret = rcl_node_init(this->node_ptr, name, "", &node_options);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();

View file

@ -72,7 +72,7 @@ TEST_F(CLASSNAME(TestNodeFixture, RMW_IMPLEMENTATION), test_rcl_node_accessors)
ASSERT_EQ(RCL_RET_OK, ret); // Shutdown later after invalid node.
// Create an invalid node (rcl_shutdown).
rcl_node_t invalid_node = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_rcl_node_accessors_node";
const char * namespace_ = "/ns";
rcl_node_options_t default_options = rcl_node_get_default_options();
default_options.domain_id = 42; // Set the domain id to something explicit.
@ -305,7 +305,7 @@ TEST_F(CLASSNAME(TestNodeFixture, RMW_IMPLEMENTATION), test_rcl_node_life_cycle)
stop_memory_checking();
rcl_ret_t ret;
rcl_node_t node = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_rcl_node_life_cycle_node";
const char * namespace_ = "/ns";
rcl_node_options_t default_options = rcl_node_get_default_options();
// Trying to init before rcl_init() should fail.

View file

@ -44,7 +44,7 @@ public:
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();
this->node_ptr = new rcl_node_t;
*this->node_ptr = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_publisher_node";
rcl_node_options_t node_options = rcl_node_get_default_options();
ret = rcl_node_init(this->node_ptr, name, "", &node_options);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();

View file

@ -47,7 +47,7 @@ public:
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();
this->node_ptr = new rcl_node_t;
*this->node_ptr = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_service_node";
rcl_node_options_t node_options = rcl_node_get_default_options();
ret = rcl_node_init(this->node_ptr, name, "", &node_options);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();

View file

@ -48,7 +48,7 @@ public:
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();
this->node_ptr = new rcl_node_t;
*this->node_ptr = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_subscription_node";
rcl_node_options_t node_options = rcl_node_get_default_options();
ret = rcl_node_init(this->node_ptr, name, "", &node_options);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();

View file

@ -40,7 +40,7 @@ protected:
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();
this->node_ptr = new rcl_node_t;
*this->node_ptr = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_state_machine_node";
rcl_node_options_t node_options = rcl_node_get_default_options();
ret = rcl_node_init(this->node_ptr, name, "", &node_options);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();

View file

@ -40,7 +40,7 @@ protected:
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();
this->node_ptr = new rcl_node_t;
*this->node_ptr = rcl_get_zero_initialized_node();
const char * name = "node_name";
const char * name = "test_multiple_instances_node";
rcl_node_options_t node_options = rcl_node_get_default_options();
ret = rcl_node_init(this->node_ptr, name, "", &node_options);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string_safe();