Skip to content
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

[SR-362] Run swiftpm tests in parallel #5329

Closed
gribozavr opened this issue Dec 24, 2015 · 15 comments
Closed

[SR-362] Run swiftpm tests in parallel #5329

gribozavr opened this issue Dec 24, 2015 · 15 comments
Assignees
Labels

Comments

@gribozavr
Copy link
Collaborator

Previous ID SR-362
Radar None
Original Reporter @gribozavr
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @gribozavr
Priority Medium

md5: ca375caeed16f1e747510ff7e4098d65

relates to:

  • SR-804 Improve SwiftPM Testing Time

Issue Description:

swiftpm tests should run in parallel. This will save us time in CI.

@mxcl
Copy link
Contributor

mxcl commented Dec 24, 2015

We'll wait for the testing proposal integration since it will change how this all works.

@mxcl
Copy link
Contributor

mxcl commented Dec 24, 2015

Well maybe it wouldn't be too hard to do it currently? /cc @ddunbar

@gribozavr
Copy link
Collaborator Author

If there is a real solution coming soon, I wouldn't worry about spending effort trying to implement a temporary stand-in.

@ddunbar
Copy link
Member

ddunbar commented Dec 25, 2015

Yeah, I agree we should focus on getting the real testing solution in place, and then tackle this there.

@modocache
Copy link
Mannequin

modocache mannequin commented Dec 25, 2015

Just my two cents: the parallelization of tests should be left to the test runner. A proposal should be made on swift-corelibs-xctest that allows the user to specify the number of concurrent runners when invoking XCTMain(). Supporting test parallelization in the package manager would cause some serious integration issues with Apple XCTest down the line, should we ever choose to do so--that framework is coupled to serial execution of tests.

Last I checked, the testing proposal was headed in a direction where test execution itself was left to testing frameworks like swift-corelibs-xctest, so I'm sure we can support parallelization in swift-corelibs-xctest after that proposal is merged.

@mxcl
Copy link
Contributor

mxcl commented Feb 19, 2016

@modocache I agree. So the XCTest runner certainly can have parallelism.

I'm assuming there's a way to hook into the pretty graphic that runs as part of the swift build-script --test option?

@modocache
Copy link
Mannequin

modocache mannequin commented Feb 23, 2016

By pretty graphic, I assume you mean the progress bar? I like it a lot, too! I'm not sure how easy it would be to reuse it--last I checked the progress bar animation was part of @ddunbar's lit test runner. We'd have to port that Python code over to something the SwiftPM or XCTest could use in Swift.

@ddunbar
Copy link
Member

ddunbar commented Feb 23, 2016

Yeah, the progress bar comes from lit. It is pretty straightforward and could be ported easily (minus the usual pain of bridging to nasty C APIs).

I am of two minds on the parallelization of tests:

  • On the one hand, I generally agree with Brian, it is a responsibility that should be left to the test framework.

  • On the other, lit has proven incredibly useful at adapting existing test suites and running them in parallel (I even have an implementation that works with XCTest, using one process per test). I have used lit to execute, in parallel, tests written using: Python unittest, Google test, XCTest, and DejaGNU.

In addition, there are a couple of arguments for why an ideal system would integrate the parallelization of tests:

  • Managing parallel execution of the build + test process is something the build system is designed for.

  • Any system capable of doing particularly fancy things with tests (e.g., automatically running in the background, or only running the ones whose inputs have changed) likely already has the information necessary to run them in parallel.

  • The actual implementation of parallelization is often not particularly interesting, having a single implementation instead of needing each testing framework to provide one reduces overall effort.

Given those, I am tempted to argue that defining the testing framework in such a way that swiftpm may run the tests in parallel would be useful, but allow options such that if the testing framework would rather manage it it can.

@mxcl
Copy link
Contributor

mxcl commented Feb 23, 2016

Having mulled on this I think we should leave it up to the XCTest team to add parallelization support, however we can still do it for SwiftPM by special casing our test product output, though this will need to wait on our Package.swift proposal.

In the mean time we can speed up our tests a good deal, I just opened a ticket about this. SR-804

@abertelrud
Copy link
Contributor

Looks like @aciidb0mb3r has a PR open for this now: #583

@heckj
Copy link
Contributor

heckj commented Mar 16, 2017

This looks like an old bug that can be closed - the PR landed and you can invoke `swift test --parallel` to leverage it

@ddunbar
Copy link
Member

ddunbar commented Mar 16, 2017

Agreed... we don't currently run the tests in parallel in CI, but maybe we should?

@ankitspd
Copy link
Member

I recently added a --test-parallel option to bootstrap script but forgot to ask if we should enable that for Swift CI!

@ddunbar
Copy link
Member

ddunbar commented Mar 16, 2017

I think we should, it speeds things up and will ensure we keep it working.

@ankitspd
Copy link
Member

apple/swift#8153

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants