-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[5.6] Allow running tests from a command plugin (#4002) #4008
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
[5.6] Allow running tests from a command plugin (#4002) #4008
Conversation
@swift-ci test |
@swift-ci please test |
91ab64f
to
c49cf4a
Compare
This wraps up the last piece for SE-0332, including support for filtering and for capturing code coverage while the tests are running. This uses most of the same implementation that existed in a very specify way in SwiftTestTool.swift, factoring it out into a new shared TestingSupport.swift file and making it more generic. Future refactoring should move it down to a new module that provides the shared test support for use from everywhere. rdar://87529139 (cherry picked from commit d43183a)
c49cf4a
to
14a6f94
Compare
@swift-ci please test |
@@ -461,70 +461,6 @@ public struct SwiftTestTool: SwiftCommand { | |||
} | |||
} | |||
|
|||
/// Locates XCTestHelper tool inside the libexec directory and bin directory. |
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.
This code is not removed but is moved out into a separate file where it can be used by both SwiftTestTool and SwiftPackageTool.
import Workspace | ||
|
||
|
||
/// Internal helper functionality for the SwiftTestTool command and for the |
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.
This code is not new but is moved out from SwiftTestTool into a separate file where it can be used by both SwiftTestTool and SwiftPackageTool.
This is a cherry-pick of #4002.
Explanation: This cherrypicks the change to allow package command plugins to run tests in SwiftPM and get the results back in structured form. This change is on the main branch but should be included in the 5.6 release as command plugins are available in SwiftPM 5.6 for the first time.
Scope of Issue: This applies to command plugins that want to use the
PackageManager.test(_:parameters:)
function.Reason for Nominating to 5.6: This allows command plugins to use the new
PackageManager.test(_:parameters:)
function in SE-0332.Risk: Low — the material changes affects only a new code path that was introduced for command plugins, so only plugins that use
PackageManager.test(_:parameters:)
are affected.Reviewed By: @tomerd
Automated Testing: A new unit test verifies the information sent to the plugin.
Dependencies: None
Impact on CI: None
How to Verify: Create a command package plugin that calls
PackageManager.test(_:parameters:)
and verify the return results. See the new unit test for an example.rdar://87529139