-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Testing: Run all test SPM executable actions in a operation queue #9243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing: Run all test SPM executable actions in a operation queue #9243
Conversation
Add an operation queue around execution of swiftPM process execution. swift-testing based test will run all tests in parallel at the same time, causing each invocation to spawn a process which will then spawn many other subprocesses. These leads to a process bomb and consumes all CPU and causes massive I/O blocking. Add a limit to how many swiftPM top level processes at the same time.
@swift-ci test |
@swift-ci test windows |
Fixes #9245 Test times are roughly equivalent, locally the CPU usage and number of processes created during test are significantly | Build/Test Times
Versus without the Q
|
|
||
import enum TSCBasic.ProcessEnv | ||
|
||
private let swiftPMExecutionQueue = AsyncOperationQueue(concurrentTasks: 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be ProcessInfo.processInfo.activeProcessorCount * x
for some x
instead, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swift-build where the AsyncOperationQueue was pulled from also uses 6, I started from there.
Maybe NCPUs * 0.5 The process fanout from invoking things like swift build is quite large.
* Initialize the queue size to some fraction of number of CPUs. * Add a comment on why we are running executions on a queue.
@swift-ci test |
@swift-ci test windows |
1 similar comment
@swift-ci test windows |
@swift-ci test macos |
Add an operation queue around execution of swiftPM process execution.
swift-testing based test will run all tests in parallel at the same time, causing each invocation to spawn a process which will then spawn many other subprocesses. This is compounded by tests that use arguments, as each combination will create another test that will run in parallel.
These leads to a process bomb consuming all CPU and causes massive I/O blocking.
Add a limit to how many swiftPM top level processes can run at the same time during testing. This is similar behaviour to XCtest based testing with the --num-workers option limiting the number of occurrent tests.