Skip to content

Commit

Permalink
Make sure to call rcutils_logging_shutdown().
Browse files Browse the repository at this point in the history
This ensures we don't have a memory leak from the rcutils
logging subsystem at the end of the test run.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
clalancette committed Jun 25, 2020
1 parent a170fa0 commit 57f93b5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rcl/test/rcl/test_log_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,15 @@ TEST(TestLogLevel, multiple_log_level_with_default_at_back) {
EXPECT_STREQ("rcl", log_level->logger_settings[0].name);
EXPECT_EQ(static_cast<int>(RCUTILS_LOG_SEVERITY_DEBUG), log_level->logger_settings[0].level);
}

int main(int argc, char ** argv)
{
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
// We need to do rcutils_logging_shutdown() since the tests above may
// have initialized logging.
if (rcutils_logging_shutdown() != RCUTILS_RET_OK) {
fprintf(stderr, "Failed shutting down rcutils logging\n");
}
return ret;
}

0 comments on commit 57f93b5

Please sign in to comment.