Add an experimental interface for custom test libraries. #9424
+168
−66
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.
This PR adds command-line experimental support for custom test libraries that don't sit on top of XCTest or Swift Testing (irony inbound). Developers can specify additional libraries to invoke using the
--experimental-testing-libraryargument.In a separate PR, I will teach Swift Testing how to read the
--experimental-testing-libraryargument (forwarded as--testing-libraryonce per, er, library.) A developer can write a small shim function that gets added to the__swift5_testssection as a special test content record and which, when called, invokes its corresponding testing library and translates output to the "language" Swift Testing speaks.The above description is light on details because we haven't designed out the mechanisms in question. In particular, we don't have a stable configuration/input mechanism, so for the moment I'm just forwarding command-line arguments. We also need to teach some part of the stack how to collate results from multiple libraries to produce a single unified test report in various formats. This PR is just one step.
You can use the new argument like so:
swift test --experimental-testing-library xctest --experimental-testing-library pytest --experimental-testing-library junit [...]The above command would try to run XCTest, pytest, and JUnit tests hosted in the current Swift package. As of right now, it will run XCTest and then
fatalError()on pytest and JUnit (until I can plumb things through Swift Testing.)