Skip to content

Commit 3dbd50a

Browse files
VolodymyrBgmaflcko
andcommitted
Fix failing util_time_GetTime test on Windows
Remove unreliable steady clock time checking from the test that was causing CI failures primarily on Windows. The test previously tried to verify that steady_clock time increases after a 1ms sleep, but this approach is not reliable on all platforms where such a short sleep interval may not consistently result in observable clock changes. This addresses issue #32197 where the test was reporting failures in the cross-built Windows CI environment. As noted in the discussion, the test is not critical to the functionality of Bitcoin Core, and removing the unreliable part is the most straightforward solution. Rename and refocus util_time_GetTime test to util_mocktime Co-Authored-By: maflcko <6399679+maflcko@users.noreply.github.com>
1 parent d91a746 commit 3dbd50a

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/test/util_tests.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,9 @@ BOOST_AUTO_TEST_CASE(strprintf_numbers)
567567
#undef B
568568
#undef E
569569

570-
BOOST_AUTO_TEST_CASE(util_time_GetTime)
570+
BOOST_AUTO_TEST_CASE(util_mocktime)
571571
{
572-
SetMockTime(111);
572+
SetMockTime(111s);
573573
// Check that mock time does not change after a sleep
574574
for (const auto& num_sleep : {0ms, 1ms}) {
575575
UninterruptibleSleep(num_sleep);
@@ -583,13 +583,6 @@ BOOST_AUTO_TEST_CASE(util_time_GetTime)
583583
BOOST_CHECK_EQUAL(111000000, GetTime<std::chrono::microseconds>().count());
584584
}
585585
SetMockTime(0s);
586-
587-
// Check that steady time changes after a sleep
588-
const auto steady_ms_0 = Now<SteadyMilliseconds>();
589-
const auto steady_0 = std::chrono::steady_clock::now();
590-
UninterruptibleSleep(1ms);
591-
BOOST_CHECK(steady_ms_0 < Now<SteadyMilliseconds>());
592-
BOOST_CHECK(steady_0 + 1ms <= std::chrono::steady_clock::now());
593586
}
594587

595588
BOOST_AUTO_TEST_CASE(test_IsDigit)

0 commit comments

Comments
 (0)