From 55d559f7c9ea1715db9f0422d589efd7bea6481a Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Thu, 13 Jul 2023 16:04:14 -0400 Subject: [PATCH] fix flakiness of profile-handler_unittest When checking if timer is enabled, we should look at it_interval. --- src/tests/profile-handler_unittest.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/tests/profile-handler_unittest.cc b/src/tests/profile-handler_unittest.cc index c2f0089..d7678ba 100644 --- a/src/tests/profile-handler_unittest.cc +++ b/src/tests/profile-handler_unittest.cc @@ -130,14 +130,8 @@ void Delay(int delay_ns) { bool IsTimerEnabled() { itimerval current_timer; EXPECT_EQ(0, getitimer(timer_type_, ¤t_timer)); - if ((current_timer.it_value.tv_sec == 0) && - (current_timer.it_value.tv_usec != 0)) { - // May be the timer has expired. Sleep for a bit and check again. - Delay(kTimerResetInterval); - EXPECT_EQ(0, getitimer(timer_type_, ¤t_timer)); - } - return (current_timer.it_value.tv_sec != 0 || - current_timer.it_value.tv_usec != 0); + return (current_timer.it_interval.tv_sec != 0 || + current_timer.it_interval.tv_usec != 0); } // Dummy worker thread to accumulate cpu time.