-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Milestone
Description
Summary
Follow-up to #5137 which introduced waitForCondition() for Foundation tests.
The Net testsuite has similar patterns that could benefit from waitForCondition to eliminate flaky timing-dependent tests.
High Priority (Unbounded Loops)
| File | Line | Pattern |
|---|---|---|
PollSetTest.cpp |
451 | while (!poller.isRunning()) Thread::sleep(100); |
UDPServerTest.cpp |
122-134 | do { Thread::sleep(10); } while (count < i); |
Medium Priority (Fixed Sleeps + Assertions)
| File | Count | Notes |
|---|---|---|
DatagramSocketTest.cpp |
1 | Sleep before assertTrue(ss.available() == 5) |
WebSocketTest.cpp |
4 | Sleeps waiting for server start |
SyslogTest.cpp |
6 | Sleeps waiting for syslog processing |
TCPServerTest.cpp |
10 | Sleeps in server tests |
Scope
Total: ~49 Thread::sleep calls across 13 files, of which 2 are critical unbounded loops and ~8-10 are good candidates for condition-based waiting.
Pattern to Apply
// Before (unbounded, can hang forever):
while (condition) Thread::sleep(50);
// After (bounded, fails cleanly if condition never met):
assertTrue(waitForCondition([&]{ return condition; }, 5000));References
- PR fix(Foundation): Replace timing-dependent tests with condition-based waiting #5137 - Foundation condition-based waiting implementation
Metadata
Metadata
Assignees
Labels
No labels