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_two_timers_ready_before_timeout more reliable #640

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
16 changes: 8 additions & 8 deletions rcl/test/rcl/test_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ TEST_F(TestTimerFixture, test_two_timers) {
rcl_timer_t timer2 = rcl_get_zero_initialized_timer();

ret = rcl_timer_init(
&timer, &clock, this->context_ptr, RCL_MS_TO_NS(5), nullptr, rcl_get_default_allocator());
&timer, &clock, this->context_ptr, RCL_MS_TO_NS(50), nullptr, rcl_get_default_allocator());
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

ret = rcl_timer_init(
&timer2, &clock, this->context_ptr, RCL_MS_TO_NS(20), nullptr, rcl_get_default_allocator());
&timer2, &clock, this->context_ptr, RCL_MS_TO_NS(1000), nullptr, rcl_get_default_allocator());
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

rcl_wait_set_t wait_set = rcl_get_zero_initialized_wait_set();
Expand All @@ -141,7 +141,7 @@ TEST_F(TestTimerFixture, test_two_timers) {
ret = rcl_wait_set_fini(&wait_set);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
});
ret = rcl_wait(&wait_set, RCL_MS_TO_NS(10));
ret = rcl_wait(&wait_set, RCL_MS_TO_NS(100));
ivanpauno marked this conversation as resolved.
Show resolved Hide resolved
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
uint8_t nonnull_timers = 0;
for (uint8_t i = 0; i < wait_set.size_of_timers; i++) {
Expand Down Expand Up @@ -174,11 +174,11 @@ TEST_F(TestTimerFixture, test_two_timers_ready_before_timeout) {
rcl_timer_t timer2 = rcl_get_zero_initialized_timer();

ret = rcl_timer_init(
&timer, &clock, this->context_ptr, RCL_MS_TO_NS(5), nullptr, rcl_get_default_allocator());
&timer, &clock, this->context_ptr, RCL_MS_TO_NS(50), nullptr, rcl_get_default_allocator());
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

ret = rcl_timer_init(
&timer2, &clock, this->context_ptr, RCL_MS_TO_NS(10), nullptr, rcl_get_default_allocator());
&timer2, &clock, this->context_ptr, RCL_MS_TO_NS(1000), nullptr, rcl_get_default_allocator());
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

rcl_wait_set_t wait_set = rcl_get_zero_initialized_wait_set();
Expand All @@ -198,7 +198,7 @@ TEST_F(TestTimerFixture, test_two_timers_ready_before_timeout) {
ret = rcl_wait_set_fini(&wait_set);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
});
ret = rcl_wait(&wait_set, RCL_MS_TO_NS(20));
ret = rcl_wait(&wait_set, RCL_MS_TO_NS(100));
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
uint8_t nonnull_timers = 0;
for (uint8_t i = 0; i < wait_set.size_of_timers; i++) {
Expand Down Expand Up @@ -230,7 +230,7 @@ TEST_F(TestTimerFixture, test_timer_not_ready) {
rcl_timer_t timer = rcl_get_zero_initialized_timer();

ret = rcl_timer_init(
&timer, &clock, this->context_ptr, RCL_MS_TO_NS(5), nullptr, rcl_get_default_allocator());
&timer, &clock, this->context_ptr, RCL_MS_TO_NS(1000), nullptr, rcl_get_default_allocator());
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;

rcl_wait_set_t wait_set = rcl_get_zero_initialized_wait_set();
Expand All @@ -247,7 +247,7 @@ TEST_F(TestTimerFixture, test_timer_not_ready) {
ret = rcl_wait_set_fini(&wait_set);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
});
ret = rcl_wait(&wait_set, RCL_MS_TO_NS(1));
ret = rcl_wait(&wait_set, RCL_MS_TO_NS(100));
EXPECT_EQ(RCL_RET_TIMEOUT, ret) << rcl_get_error_string().str;
uint8_t nonnull_timers = 0;
for (uint8_t i = 0; i < wait_set.size_of_timers; i++) {
Expand Down