[Windows] Stop skipping the event loop tick metrics tests - #3687
Open
jakepetroules wants to merge 1 commit into
Open
[Windows] Stop skipping the event loop tick metrics tests#3687jakepetroules wants to merge 1 commit into
jakepetroules wants to merge 1 commit into
Conversation
These were skipped on the grounds that the WSAPoll selector wakes far more often than epoll or kqueue, making the tick counts unreliable. Measuring it does not bear that out: `testMetricsDelegateTickInfo` observes 2 ticks with tasks [2, 1] on Windows, which is identical to macOS and is the low end of the 2...5 ticks the test allows, so there are three spare ticks of headroom. The tests pass on Windows in isolation and in three separate full unfiltered runs of the whole test suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
EventLoopMetricsDelegateTestsis skipped in its entirety on Windows, on the grounds that the WSAPoll selector wakes far more often than epoll or kqueue and so the tick counts are unreliable and flaky.Measuring it does not bear that out.
Modifications:
Remove the skip. No source changes are needed.
Evidence gathered on a Windows ARM64 VM (Swift 6.3.2):
testMetricsDelegateTickInfoobservesticks=2,numberOfTasksper tick[2, 1]. That is identical to what the same instrumentation reports on macOS, and it is the low end of the2...5range the test allows, so there are three spare ticks of headroom rather than a count pressed up against the limit.For completeness, while investigating I did find one real asymmetry, which turns out not to affect these tests:
whenReady0converts its timeout withInt32(clamping: timeAmount.nanoseconds / 1_000_000), so a sub-millisecond timeout truncates to0where epoll arms a nanosecond-precisiontimerfdand kqueue uses atimespec. Probing it showed the cost is at most one extra poll (a 500µs sleep scheduled from inside an idle loop produced 1 extra tick, not a spin), and these tests use 100ms and 1s delays so they never encounter it. Worth knowing about, but not a correctness problem and out of scope here.Result:
Two more tests run on Windows.