Tests: Remove .seconds-based timeouts in some Suites #8810
+167
−170
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.
Refactor testSwiftRunSIGINT to use XCTestExpectation instead of DispatchGroup timeout
Motivation:
The existing
testSwiftRunSIGINT()
relied on a 60 sDispatchGroup.wait(timeout:)
, which led to flaky CI failures and unnecessarily long test runs. We want the test to react immediately to the process’s “sleeping” output and its subsequent exit, rather than guessing at a timeout duration.Modifications:
DispatchGroup
and its 60 s timeout fromtestSwiftRunSIGINT()
.XCTestExpectation
(startedExp
) that’s fulfilled when the child process prints “sleeping.”AsyncProcess
initialization to detect the “sleeping” line and fulfillstartedExp
.wait(for: [startedExp], timeout: 10.0)
to pause until the process is ready.SIGINT
immediately after that expectation and then calledprocess.waitUntilExit()
.XCTSkipIf…CI
guards now that the test is deterministic and reliably passes.Result:
testSwiftRunSIGINT()
now completes in seconds instead of minutes and no longer fails intermittently on CI.Fixes: #8770