Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test logging rosout more reliable #846

Merged
merged 1 commit into from
Oct 28, 2020
Merged
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
13 changes: 7 additions & 6 deletions rcl/test/rcl/test_logging_rosout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class TEST_FIXTURE_P_RMW (TestLoggingRosoutFixture)
};

void
wait_for_subscription_to_be_ready(
check_if_rosout_subscription_gets_a_message(
const char * logger_name,
rcl_subscription_t * subscription,
rcl_context_t * context,
size_t max_tries,
Expand All @@ -159,6 +160,7 @@ wait_for_subscription_to_be_ready(
});
size_t iteration = 0;
do {
RCUTILS_LOG_INFO_NAMED(logger_name, "SOMETHING");
++iteration;
ret = rcl_wait_set_clear(&wait_set);
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
Expand All @@ -182,11 +184,10 @@ wait_for_subscription_to_be_ready(
/* Testing the subscriber of topic 'rosout' whether to get event from logging or not.
*/
TEST_P_RMW(TestLoggingRosoutFixture, test_logging_rosout) {
// log
RCUTILS_LOG_INFO_NAMED(rcl_node_get_logger_name(this->node_ptr), "SOMETHING");

bool success;
wait_for_subscription_to_be_ready(this->subscription_ptr, this->context_ptr, 10, 100, success);
bool success = false;
check_if_rosout_subscription_gets_a_message(
rcl_node_get_logger_name(this->node_ptr), this->subscription_ptr,
this->context_ptr, 30, 100, success);
ASSERT_EQ(success, GetParam().expected_success);
}

Expand Down