-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Detect when Swift Testing returns EXIT_NO_TESTS_FOUND
.
#7777
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
Detect when Swift Testing returns EXIT_NO_TESTS_FOUND
.
#7777
Conversation
This PR detects when a Swift Testing run returns `EXIT_NO_TESTS_FOUND` and treats it as a successful test run. This change handles the change from swiftlang/swift-testing#536. Separately, the refactor in #7766 stops Swift Package Manager from reporting `"No matching test cases were run"` when XCTest has no tests matching passed `--filter` arguments. A third PR after these two have been merged will restore that functionality by collating results from both XCTest and Swift Testing. This change partially resolves rdar://131704587.
@swift-ci please test |
success = success && testSuccess | ||
results.append(testSuccess) | ||
} | ||
if results.contains(.failure) { |
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.
If anything failed, the run failed. If anything passed and had matching tests, the run passed. If everything reported no matching tests, then there were no matching tests.
|
||
/// Executes and returns execution status. Prints test output on standard streams if requested | ||
/// - Returns: Result of spawning and running the test process, and the output stream result | ||
@_disfavoredOverload |
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.
Temporarily disfavored until #7766 is in the build in order to preserve the semantics of surrounding code, at which point the overload that returns a Bool
can be removed.
/// Because Swift Package Manager does not directly link to the testing library, | ||
/// it duplicates the definition of this constant in its own source. Any changes | ||
/// to this constant in either package must be mirrored in the other. | ||
private var EXIT_NO_TESTS_FOUND: CInt { |
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.
Copied verbatim from Swift Testing's PR.
@swift-ci please test |
@swift-ci please test Windows |
This PR detects when a Swift Testing run returns `EXIT_NO_TESTS_FOUND` and treats it as a successful test run. This change handles the change from swiftlang/swift-testing#536. Separately, the refactor in #7766 stops Swift Package Manager from reporting `"No matching test cases were run"` when XCTest has no tests matching passed `--filter` arguments. A third PR after these two have been merged will restore that functionality by collating results from both XCTest and Swift Testing. > [!NOTE] > Test coverage can be added after Swift Testing is in the Swift toolchain. This change partially resolves rdar://131704587.
This PR detects when a Swift Testing run returns `EXIT_NO_TESTS_FOUND` and treats it as a successful test run. This change handles the change from swiftlang/swift-testing#536. Separately, the refactor in #7766 stops Swift Package Manager from reporting `"No matching test cases were run"` when XCTest has no tests matching passed `--filter` arguments. A third PR after these two have been merged will restore that functionality by collating results from both XCTest and Swift Testing. > [!NOTE] > Test coverage can be added after Swift Testing is in the Swift toolchain. This change partially resolves rdar://131704587.
…Swift Testing enabled by default.) (#7794) **Explanation:** Refactors the previously-experimental Swift Testing support logic so that only a single build product is produced when using both XCTest and Swift Testing, and detection of Swift Testing usage is no longer needed at compile time. **Scope:** Implementation of Swift Testing/SwiftPM integration; touches mostly `swift test` but affects `swift build` and `swift package init` as well. **Issue:** rdar://120864035 **Original PR:** #7777, #7789, #7796 **Risk:** Moderate—refactors how we build and run tests. **Testing:** Existing test coverage in the package as well as test coverage in the Swift Testing package; additional integration testing will be added once Swift Testing is in the toolchain. **Reviewer:** @bnbarham @xedin @briancroom @dennisweissmann --------- Co-authored-by: Pavel Yaskevich <[email protected]>
This PR detects when a Swift Testing run returns
EXIT_NO_TESTS_FOUND
and treats it as a successful test run.This change handles the change from swiftlang/swift-testing#536. Separately, the refactor in #7766 stops Swift Package Manager from reporting
"No matching test cases were run"
when XCTest has no tests matching passed--filter
arguments. A third PR after these two have been merged will restore that functionality by collating results from both XCTest and Swift Testing.Note
Test coverage can be added after Swift Testing is in the Swift toolchain.
This change partially resolves rdar://131704587.