Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rcl_action/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ if(BUILD_TESTING)
${PROJECT_NAME}
)
ament_target_dependencies(test_action_server
"osrf_testing_tools_cpp"
"rcl"
"test_msgs"
)
Expand Down
2 changes: 2 additions & 0 deletions rcl_action/test/rcl_action/test_action_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class TestActionClientBaseFixture : public ::testing::Test
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
ret = rcl_shutdown(&this->context);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
ret = rcl_context_fini(&this->context);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

rcl_context_t context;
Expand Down
7 changes: 7 additions & 0 deletions rcl_action/test/rcl_action/test_action_communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
#include <gtest/gtest.h>

#include "osrf_testing_tools_cpp/scope_exit.hpp"

#include "rcl_action/action_client.h"
#include "rcl_action/action_server.h"
#include "rcl_action/wait.h"
Expand Down Expand Up @@ -41,6 +43,9 @@ class CLASSNAME (TestActionCommunication, RMW_IMPLEMENTATION) : public ::testing
rcl_init_options_t init_options = rcl_get_zero_initialized_init_options();
ret = rcl_init_options_init(&init_options, allocator);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
EXPECT_EQ(RCL_RET_OK, rcl_init_options_fini(&init_options)) << rcl_get_error_string().str;
});
context = rcl_get_zero_initialized_context();
ret = rcl_init(0, nullptr, &init_options, &context);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
Expand Down Expand Up @@ -119,6 +124,8 @@ class CLASSNAME (TestActionCommunication, RMW_IMPLEMENTATION) : public ::testing
EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;
ret = rcl_shutdown(&context);
EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;
ret = rcl_context_fini(&this->context);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

void init_test_uuid0(uint8_t * uuid)
Expand Down
7 changes: 7 additions & 0 deletions rcl_action/test/rcl_action/test_action_interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
#include <gtest/gtest.h>

#include "osrf_testing_tools_cpp/scope_exit.hpp"

#include "rcl_action/action_client.h"
#include "rcl_action/action_server.h"
#include "rcl_action/wait.h"
Expand Down Expand Up @@ -53,6 +55,9 @@ class CLASSNAME (TestActionClientServerInteraction, RMW_IMPLEMENTATION) : public
rcl_init_options_t init_options = rcl_get_zero_initialized_init_options();
ret = rcl_init_options_init(&init_options, allocator);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
EXPECT_EQ(RCL_RET_OK, rcl_init_options_fini(&init_options)) << rcl_get_error_string().str;
});
context = rcl_get_zero_initialized_context();
ret = rcl_init(0, nullptr, &init_options, &context);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
Expand Down Expand Up @@ -141,6 +146,8 @@ class CLASSNAME (TestActionClientServerInteraction, RMW_IMPLEMENTATION) : public
EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;
ret = rcl_shutdown(&context);
EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;
ret = rcl_context_fini(&this->context);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

void init_test_uuid0(uint8_t * uuid)
Expand Down
16 changes: 16 additions & 0 deletions rcl_action/test/rcl_action/test_action_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "action_msgs/srv/cancel_goal.h"

#include "osrf_testing_tools_cpp/scope_exit.hpp"

#include "rcl_action/action_server.h"

#include "rcl/error_handling.h"
Expand Down Expand Up @@ -137,12 +139,21 @@ TEST(TestActionServerInitFini, test_action_server_init_fini)
ret = rcl_clock_fini(&clock);
EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;

// Finalize init_options
ret = rcl_init_options_fini(&init_options);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

// Finalize node
ret = rcl_node_fini(&node);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

// Shutdown node
ret = rcl_shutdown(&context);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

// Finalize context
ret = rcl_context_fini(&context);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

class TestActionServer : public ::testing::Test
Expand All @@ -155,6 +166,9 @@ class TestActionServer : public ::testing::Test
rcl_init_options_t init_options = rcl_get_zero_initialized_init_options();
ret = rcl_init_options_init(&init_options, allocator);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
EXPECT_EQ(RCL_RET_OK, rcl_init_options_fini(&init_options)) << rcl_get_error_string().str;
});
context = rcl_get_zero_initialized_context();
ret = rcl_init(0, nullptr, &init_options, &context);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
Expand Down Expand Up @@ -185,6 +199,8 @@ class TestActionServer : public ::testing::Test
EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string().str;
ret = rcl_shutdown(&context);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
ret = rcl_context_fini(&this->context);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
}

void init_test_uuid0(uint8_t * uuid)
Expand Down