Make test multi threaded executor more reliable (#1105)
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
This commit is contained in:
parent
9f04391fbb
commit
0dd14baa32
2 changed files with 5 additions and 5 deletions
|
@ -604,7 +604,6 @@ if(BUILD_TESTING)
|
|||
ament_target_dependencies(test_multi_threaded_executor
|
||||
"rcl")
|
||||
target_link_libraries(test_multi_threaded_executor ${PROJECT_NAME})
|
||||
ament_add_test_label(test_multi_threaded_executor xfail)
|
||||
endif()
|
||||
|
||||
ament_add_gtest(test_guard_condition test/test_guard_condition.cpp
|
||||
|
|
|
@ -34,6 +34,10 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
constexpr std::chrono::milliseconds PERIOD_MS = 1000ms;
|
||||
constexpr double PERIOD = PERIOD_MS.count() / 1000.0;
|
||||
constexpr double TOLERANCE = PERIOD / 4.0;
|
||||
|
||||
/*
|
||||
Test that timers are not taken multiple times when using reentrant callback groups.
|
||||
*/
|
||||
|
@ -70,9 +74,6 @@ TEST_F(TestMultiThreadedExecutor, timer_over_take) {
|
|||
// While this tolerance is a little wide, if the bug occurs, the next step will
|
||||
// happen almost instantly. The purpose of this test is not to measure the jitter
|
||||
// in timers, just assert that a reasonable amount of time has passed.
|
||||
const double PERIOD = 0.1f;
|
||||
const double TOLERANCE = 0.025f;
|
||||
|
||||
rclcpp::Time now = system_clock.now();
|
||||
timer_count++;
|
||||
|
||||
|
@ -92,7 +93,7 @@ TEST_F(TestMultiThreadedExecutor, timer_over_take) {
|
|||
}
|
||||
};
|
||||
|
||||
auto timer = node->create_wall_timer(100ms, timer_callback, cbg);
|
||||
auto timer = node->create_wall_timer(PERIOD_MS, timer_callback, cbg);
|
||||
executor.add_node(node);
|
||||
executor.spin();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue