1919
2020#include " osrf_testing_tools_cpp/scope_exit.hpp"
2121#include " rcl/error_handling.h"
22+ #include " rcl/logging.h"
2223#include " rcl/rcl.h"
2324#include " rcl/subscription.h"
2425#include " rcl_interfaces/msg/log.h"
@@ -70,8 +71,9 @@ class TEST_FIXTURE_P_RMW (TestLoggingRosoutFixture)
7071 {
7172 auto param = GetParam ();
7273 rcl_ret_t ret;
74+ rcl_allocator_t allocator = rcl_get_default_allocator ();
7375 rcl_init_options_t init_options = rcl_get_zero_initialized_init_options ();
74- ret = rcl_init_options_init (&init_options, rcl_get_default_allocator () );
76+ ret = rcl_init_options_init (&init_options, allocator );
7577 ASSERT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
7678 OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT (
7779 {
@@ -83,6 +85,11 @@ class TEST_FIXTURE_P_RMW (TestLoggingRosoutFixture)
8385 ret = rcl_init (param.argc , param.argv , &init_options, this ->context_ptr );
8486 ASSERT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
8587
88+ EXPECT_EQ (
89+ RCL_RET_OK,
90+ rcl_logging_configure (&this ->context_ptr ->global_arguments , &allocator)
91+ ) << rcl_get_error_string ().str ;
92+
8693 // create node
8794 rcl_node_options_t node_options = rcl_node_get_default_options ();
8895 if (!param.enable_node_option_rosout ) {
@@ -120,6 +127,7 @@ class TEST_FIXTURE_P_RMW (TestLoggingRosoutFixture)
120127 ret = rcl_context_fini (this ->context_ptr );
121128 delete this ->context_ptr ;
122129 EXPECT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
130+ EXPECT_EQ (RCL_RET_OK, rcl_logging_fini ()) << rcl_get_error_string ().str ;
123131 }
124132
125133protected:
0 commit comments