From bd4e975d23fa5c7da816de415b8b36e9d44cd5d9 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Fri, 1 May 2020 16:17:55 -0300 Subject: [PATCH 1/4] Make test_executor.spin_some_max_duration more reliable Signed-off-by: Ivan Santiago Paunovic --- test_rclcpp/test/test_executor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_rclcpp/test/test_executor.cpp b/test_rclcpp/test/test_executor.cpp index d18de25a..4e5f8e31 100644 --- a/test_rclcpp/test/test_executor.cpp +++ b/test_rclcpp/test/test_executor.cpp @@ -61,7 +61,7 @@ TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), spin_some_max_duration) { rclcpp::executors::SingleThreadedExecutor executor; auto node = rclcpp::Node::make_shared("spin_some_max_duration"); auto lambda = []() { - std::this_thread::sleep_for(1ms); + std::this_thread::sleep_for(100ms); }; std::vector>> timers; // creating 20 timers which will try to do 1 ms of work each @@ -72,12 +72,12 @@ TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), spin_some_max_duration) { } executor.add_node(node); - const auto max_duration = 10ms; + const auto max_duration = 1s; const auto start = std::chrono::steady_clock::now(); executor.spin_some(max_duration); const auto end = std::chrono::steady_clock::now(); ASSERT_LT(max_duration, end - start); - ASSERT_GT(max_duration + 5ms, end - start); + ASSERT_GT(max_duration + 100ms, end - start); } TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), multithreaded_spin_call) { From 2d0e91cc77c569049844ad410df4a6fa3956b728 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Fri, 1 May 2020 17:34:52 -0300 Subject: [PATCH 2/4] Update comment Signed-off-by: Ivan Santiago Paunovic --- test_rclcpp/test/test_executor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_rclcpp/test/test_executor.cpp b/test_rclcpp/test/test_executor.cpp index 4e5f8e31..a2c56c35 100644 --- a/test_rclcpp/test/test_executor.cpp +++ b/test_rclcpp/test/test_executor.cpp @@ -64,8 +64,8 @@ TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), spin_some_max_duration) { std::this_thread::sleep_for(100ms); }; std::vector>> timers; - // creating 20 timers which will try to do 1 ms of work each - // only about 10ms worth of them should actually be performed + // creating 20 timers which will try to do 100 ms of work each + // only about 1s worth of them should actually be performed for (int i = 0; i < 20; i++) { auto timer = node->create_wall_timer(0s, lambda); timers.push_back(timer); From 2184dbce4354bcdb3f1b94d8e533aee727ea0087 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Tue, 5 May 2020 18:19:48 -0300 Subject: [PATCH 3/4] Use bigger tolerance Signed-off-by: Ivan Santiago Paunovic --- test_rclcpp/test/test_executor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_rclcpp/test/test_executor.cpp b/test_rclcpp/test/test_executor.cpp index a2c56c35..8d701071 100644 --- a/test_rclcpp/test/test_executor.cpp +++ b/test_rclcpp/test/test_executor.cpp @@ -77,7 +77,7 @@ TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), spin_some_max_duration) { executor.spin_some(max_duration); const auto end = std::chrono::steady_clock::now(); ASSERT_LT(max_duration, end - start); - ASSERT_GT(max_duration + 100ms, end - start); + ASSERT_GT(max_duration + 200ms, end - start); } TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), multithreaded_spin_call) { From 7d5cdafae45912910542fe0c88247035af24d822 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Wed, 6 May 2020 11:42:06 -0300 Subject: [PATCH 4/4] Use bigger time tolerance Signed-off-by: Ivan Santiago Paunovic --- test_rclcpp/test/test_executor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_rclcpp/test/test_executor.cpp b/test_rclcpp/test/test_executor.cpp index 8d701071..ec66636e 100644 --- a/test_rclcpp/test/test_executor.cpp +++ b/test_rclcpp/test/test_executor.cpp @@ -77,7 +77,7 @@ TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), spin_some_max_duration) { executor.spin_some(max_duration); const auto end = std::chrono::steady_clock::now(); ASSERT_LT(max_duration, end - start); - ASSERT_GT(max_duration + 200ms, end - start); + ASSERT_GT(max_duration + 500ms, end - start); } TEST(CLASSNAME(test_executor, RMW_IMPLEMENTATION), multithreaded_spin_call) {