Skip to content

[Windows] Stop skipping the event loop tick metrics tests - #3687

Merged
fabianfett merged 4 commits into
apple:mainfrom
jakepetroules:windows-el-tick-metrics
Aug 11, 2026
Merged

fabianfett merged 4 commits into
apple:mainfrom
jakepetroules:windows-el-tick-metrics

Conversation

@jakepetroules

Copy link
Copy Markdown
Member

Motivation:

EventLoopMetricsDelegateTests is 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):

  • testMetricsDelegateTickInfo observes ticks=2, numberOfTasks per tick [2, 1]. That is identical to what the same instrumentation reports on macOS, and it is the low end of the 2...5 range the test allows, so there are three spare ticks of headroom rather than a count pressed up against the limit.
  • Both tests pass in isolation across four consecutive runs, and in three separate full unfiltered runs of the entire test suite (2354 tests, 0 failures each).

For completeness, while investigating I did find one real asymmetry, which turns out not to affect these tests: whenReady0 converts its timeout with Int32(clamping: timeAmount.nanoseconds / 1_000_000), so a sub-millisecond timeout truncates to 0 where epoll arms a nanosecond-precision timerfd and kqueue uses a timespec. 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.

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.

@fabianfett fabianfett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We love more working tests on Windows!

@fabianfett
fabianfett enabled auto-merge (squash) August 10, 2026 10:38
@Lukasa Lukasa added the semver/none No version bump required. label Aug 10, 2026
@fabianfett
fabianfett merged commit 08b497c into apple:main Aug 11, 2026
54 of 58 checks passed
@jakepetroules
jakepetroules deleted the windows-el-tick-metrics branch August 12, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants