Skip to content

Commit

Permalink
Merge pull request ros2#24 from ros2/opensplice_node_test
Browse files Browse the repository at this point in the history
Fix node test for opensplice on Windows
  • Loading branch information
tfoote committed Feb 17, 2016
2 parents 02cc077 + 7e578a8 commit 9b2199f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 1 addition & 0 deletions rcl/src/rcl/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ rcl_node_init(rcl_node_t * node, const char * name, const rcl_node_options_t * o
if (node->impl) {
allocator->deallocate(node->impl, allocator->state);
}
*node = rcl_get_zero_initialized_node();
return fail_ret;
}

Expand Down
6 changes: 0 additions & 6 deletions rcl/test/rcl/test_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ TEST_F(TestNodeFixture, test_rcl_node_life_cycle) {
ret = rcl_node_init(&node, name, &options_with_invalid_allocator);
EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, ret) << "Expected RCL_RET_INVALID_ARGUMENT";
rcl_reset_error();
node = rcl_get_zero_initialized_node();
// Try with failing allocator.
rcl_node_options_t options_with_failing_allocator = rcl_node_get_default_options();
options_with_failing_allocator.allocator.allocate = failing_malloc;
Expand All @@ -270,7 +269,6 @@ TEST_F(TestNodeFixture, test_rcl_node_life_cycle) {
ret = rcl_node_init(&node, name, &options_with_failing_allocator);
EXPECT_EQ(RCL_RET_BAD_ALLOC, ret) << "Expected RCL_RET_BAD_ALLOC";
rcl_reset_error();
node = rcl_get_zero_initialized_node();
// Try fini with invalid arguments.
ret = rcl_node_fini(nullptr);
EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, ret) << "Expected RCL_RET_INVALID_ARGUMENT";
Expand All @@ -283,7 +281,6 @@ TEST_F(TestNodeFixture, test_rcl_node_life_cycle) {
EXPECT_EQ(RCL_RET_OK, ret);
ret = rcl_node_fini(&node);
EXPECT_EQ(RCL_RET_OK, ret);
node = rcl_get_zero_initialized_node();
// Try repeated init and fini calls.
ret = rcl_node_init(&node, name, &default_options);
EXPECT_EQ(RCL_RET_OK, ret);
Expand All @@ -293,20 +290,17 @@ TEST_F(TestNodeFixture, test_rcl_node_life_cycle) {
EXPECT_EQ(RCL_RET_OK, ret);
ret = rcl_node_fini(&node);
EXPECT_EQ(RCL_RET_OK, ret);
node = rcl_get_zero_initialized_node();
// Try with a specific domain id.
rcl_node_options_t options_with_custom_domain_id = rcl_node_get_default_options();
options_with_custom_domain_id.domain_id = 42;
ret = rcl_node_init(&node, name, &options_with_custom_domain_id);
if (is_windows && is_opensplice) {
// A custom domain id is not expected to work on Windows with Opensplice.
EXPECT_NE(RCL_RET_OK, ret);
node = rcl_get_zero_initialized_node();
} else {
// This is the normal check.
EXPECT_EQ(RCL_RET_OK, ret);
ret = rcl_node_fini(&node);
EXPECT_EQ(RCL_RET_OK, ret);
node = rcl_get_zero_initialized_node();
}
}

0 comments on commit 9b2199f

Please sign in to comment.