diff options
| author | copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | 2026-07-21 16:10:43 +0000 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-07-21 22:42:36 +0300 |
| commit | 9fce82688f0b9f972ea49f945505ba102bac639e (patch) | |
| tree | 6b1ff97c810952701c1f13eaaf68173ff1eb6822 /indra/llcommon/tests/llprocess_test.cpp | |
| parent | 3cd27c658a4aa94f68cd2f5c96e638a28d2c4297 (diff) | |
Harden llprocess EOF timing tests
Diffstat (limited to 'indra/llcommon/tests/llprocess_test.cpp')
| -rw-r--r-- | indra/llcommon/tests/llprocess_test.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 65d797947f..84f6c131e7 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -120,6 +120,9 @@ void yield(int seconds=1) LLEventPumps::instance().obtain("mainloop").post(LLSD()); } +constexpr int EOF_EVENT_RETRY_COUNT = 20; +constexpr auto EOF_EVENT_RETRY_DELAY = std::chrono::milliseconds(50); + void waitfor(LLProcess& proc, int timeout=60) { int i = 0; @@ -1222,6 +1225,14 @@ namespace tut LLProcess::ReadPipe& childout(py.mPy->getReadPipe(LLProcess::STDOUT)); EventListener listener(childout.getPump()); waitfor(*py.mPy); + // On Windows the pipe-close EOF notification can trail the process exit + // status by a short interval, so keep pumping for up to 1 second + // (20 * 50 ms) until it arrives. + for (int i = 0; i < EOF_EVENT_RETRY_COUNT && listener.mHistory.empty(); ++i) + { + std::this_thread::sleep_for(EOF_EVENT_RETRY_DELAY); + LLEventPumps::instance().obtain("mainloop").post(LLSD()); + } // We can't be positive there will only be a single event, if the OS // (or any other intervening layer) does crazy buffering. What we want // to ensure is that there was exactly ONE event with "eof" true, and @@ -1697,6 +1708,17 @@ namespace tut EventListener errListener(childerr.getPump()); waitfor(*py.mPy); + // On Windows the pipe-close EOF notification can trail the process exit + // status by a short interval, so keep pumping for up to 1 second + // (20 * 50 ms) until both pipes report it. + for (int i = 0; + i < EOF_EVENT_RETRY_COUNT && + (outListener.mHistory.empty() || errListener.mHistory.empty()); + ++i) + { + std::this_thread::sleep_for(EOF_EVENT_RETRY_DELAY); + LLEventPumps::instance().obtain("mainloop").post(LLSD()); + } ensure_equals("stdout size", childout.size(), 0); ensure_equals("stderr size", childerr.size(), 0); |
