Hande Swift Testing-specific prefixes#10287
Open
gmedori wants to merge 2 commits into
Open
Conversation
…from running if we encounter a Swift Testing-specific prefix This commit also adds some tests to validate the behavior
gmedori
requested review from
bkhouri,
bripeticca,
cmcgee1024,
daveinglis,
daveyc123,
dschaefer2,
jakepetroules,
owenv,
plemarquand and
rconnell9
as code owners
July 11, 2026 16:05
owenv
approved these changes
Jul 14, 2026
owenv
left a comment
Contributor
There was a problem hiding this comment.
LGTM, although we should probably not merge until the swift-testing parts land
Contributor
|
@swift-ci test |
bkhouri
approved these changes
Jul 15, 2026
| var shouldPrintCodeCovPath: Bool = false | ||
|
|
||
| var testCaseSpecifier: TestCaseSpecifier { | ||
| var xctestFilterSpecifier: TestCaseSpecifier { |
Contributor
There was a problem hiding this comment.
praise: This is a wonderful rename and give clarity that it applies only to XCTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Depends on swiftlang/swift-testing#1531
This PR accompanies swiftlang/swift-testing#1531 as the implementation for ST-0025, which enables users to pass an argument prefixed with
tag:toswift test --filterin order to filter tests by tag in Swift Testing.Motivation:
This particular PR accounts for what happens to XCTests when we pass in such a filter. XCTest doesn't have a concept of tags. Another way of saying this is that every XCTest has an empty set of tags, which means that supplying
--filter tag:fooshould not run any XCTests, since none of them have the appropriate tag. Similarly, supplying--skip tag:fooshould not skip any XCTests.We generalize this idea by saying that if any prefix is encountered (with one exception), we shouldn't match any XCTests. The exception is the
id:prefix which behaves the same as passing no prefix at all. We only introduced theid:prefix in swiftlang/swift-testing#1531 in order to allow for disambiguation purposes, which don't apply when dealing with XCTests.Examples
Here's a table of select examples to help illustrate what happens when you pass in various combinations of filter & skip specifiers:
--filter id:myTestNamemyTestName--filter tag:integrationintegration--filter id:… --filter tag:…--skip id:myTestName--skip tag:integrationintegrationModifications:
testCaseSpecifier→xctestFilterSpecifier,skippedTests→xctestSkippedSpecifierto indicate their XCTest-specific nature (for Swift Testing, the arguments are passed directly and parsed over there).id:prefixes and deriving the correct behavior for other prefixes.--filterand--skipspecifiers.Result:
Existing uses won't change, but you will now be able to pass prefixes to
--filterand--skipand have well-defined behavior as described above.