================ @@ -223,6 +220,61 @@ TEST_F(MainLoopTest, ManyPendingCallbacks) { ASSERT_TRUE(loop.Run().Success()); } +TEST_F(MainLoopTest, CallbackWithTimeout) { + MainLoop loop; + loop.AddCallback([](MainLoopBase &loop) { loop.RequestTermination(); }, + std::chrono::seconds(2)); + auto start = std::chrono::steady_clock::now(); + ASSERT_THAT_ERROR(loop.Run().takeError(), llvm::Succeeded()); + EXPECT_GE(std::chrono::steady_clock::now() - start, std::chrono::seconds(2)); ---------------- DavidSpickett wrote:
FYI this test is flaky on Windows on Arm: https://lab.llvm.org/buildbot/#/builders/141/builds/4179 ``` ******************** TEST 'lldb-unit :: Host/./HostTests.exe/0/9' FAILED ******************** Script(shard): -- GTEST_OUTPUT=json:C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\unittests\Host\.\HostTests.exe-lldb-unit-16696-0-9.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=9 GTEST_SHARD_INDEX=0 C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\unittests\Host\.\HostTests.exe -- Script: -- C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\unittests\Host\.\HostTests.exe --gtest_filter=MainLoopTest.CallbackWithTimeout -- C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\unittests\Host\MainLoopTest.cpp(229): error: Expected: (std::chrono::steady_clock::now() - start) >= (std::chrono::seconds(2)), actual: 8-byte object <DC-4E 35-77 00-00 00-00> vs 8-byte object <02-00 00-00 00-00 00-00> C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\unittests\Host\MainLoopTest.cpp:229 Expected: (std::chrono::steady_clock::now() - start) >= (std::chrono::seconds(2)), actual: 8-byte object <DC-4E 35-77 00-00 00-00> vs 8-byte object <02-00 00-00 00-00 00-00> ******************** ``` If anything I would think our bot might take way longer than 2 seconds but this test would pass if that were the case. The expected object is clearly looks like 2 seconds but the one we got I've no idea of the layout. I don't see it failing in any other build and it could be some bug in MSVC's STL, but letting you know in case you can spot something obvious in the code. https://github.com/llvm/llvm-project/pull/112895 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits