Skip to content

Commit 4eee328

Browse files
committed
Merge bitcoin/bitcoin#32318: Fix failing util_time_GetTime test on Windows
3dbd50a Fix failing util_time_GetTime test on Windows (VolodymyrBg) Pull request description: 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. ACKs for top commit: maflcko: lgtm ACK 3dbd50a achow101: ACK 3dbd50a laanwj: re-ACK 3dbd50a Tree-SHA512: 25c80558d9587c7845d3c14464e8d263c8bd9838a510faf44926e5cda5178aee10b03a52464246604e5d27544011d936442ecfa1e4cdaacb66d32c35f7213902
2 parents 458720e + 3dbd50a commit 4eee328

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)