Merge bitcoin/bitcoin#32318: Fix failing util_time_GetTime test on Windows
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Windows native, VS 2022 (push) Waiting to run
CI / Windows native, fuzz, VS 2022 (push) Waiting to run
CI / Linux->Windows cross, no tests (push) Waiting to run
CI / Windows, test cross-built (push) Blocked by required conditions
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run

3dbd50a576 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 3dbd50a576
  achow101:
    ACK 3dbd50a576
  laanwj:
    re-ACK 3dbd50a576

Tree-SHA512: 25c80558d9587c7845d3c14464e8d263c8bd9838a510faf44926e5cda5178aee10b03a52464246604e5d27544011d936442ecfa1e4cdaacb66d32c35f7213902
This commit is contained in:
Ava Chow 2025-04-24 15:10:04 -07:00
commit 4eee328a98
No known key found for this signature in database
GPG key ID: 17565732E08E5E41

View file

@ -567,9 +567,9 @@ BOOST_AUTO_TEST_CASE(strprintf_numbers)
#undef B
#undef E
BOOST_AUTO_TEST_CASE(util_time_GetTime)
BOOST_AUTO_TEST_CASE(util_mocktime)
{
SetMockTime(111);
SetMockTime(111s);
// Check that mock time does not change after a sleep
for (const auto& num_sleep : {0ms, 1ms}) {
UninterruptibleSleep(num_sleep);
@ -583,13 +583,6 @@ BOOST_AUTO_TEST_CASE(util_time_GetTime)
BOOST_CHECK_EQUAL(111000000, GetTime<std::chrono::microseconds>().count());
}
SetMockTime(0s);
// Check that steady time changes after a sleep
const auto steady_ms_0 = Now<SteadyMilliseconds>();
const auto steady_0 = std::chrono::steady_clock::now();
UninterruptibleSleep(1ms);
BOOST_CHECK(steady_ms_0 < Now<SteadyMilliseconds>());
BOOST_CHECK(steady_0 + 1ms <= std::chrono::steady_clock::now());
}
BOOST_AUTO_TEST_CASE(test_IsDigit)