Skip to content

[6.2] preset: treat swift testing the same as xctest #81505

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

bkhouri
Copy link
Contributor

@bkhouri bkhouri commented May 14, 2025

Whenever XCtest is build and installed, do the same for swift-testing and swift-testing macros.

(cherry picked from commit 2962ea2)

Based on #81401

Explanation:
The SwiftPM repository added Swift Testing helpers in a non-test target, so we can re-used common helpers (e.g.: custom traits, custom tags, etc...). As part of the toolchain build, SwiftPM builds a baseline of itself using Cmake, then build the Package.swift using the Cmake artifact. During the "second" stage SwiftPM build, this non-test target (which is meant to only be used by tests), will be complied, and would cause a "Testing module not found error".

The ideal solution would be to have a SwiftPM feature that would allow the specifying targets to only be made available for test target. Converting this target to a test targets causes swift build and swift test to succeed, but Xcode package resolution fails.

The path to least resistance was to treat Swift Testing, and Swift Testing Macros the same as XCTest in the build presets.

Scope:
This will likely cause longe build times since additional "projects" may be built.

Issues:
N/A

Original PRs:
#81401, to allow swiftlang/swift-package-manager#8495 and swiftlang/swift-package-manager#8663, and other changes to https://github.com/swiftlang/swift-package-manager Swift Testing tests.

Risk:
this is low risk as the change build extra "projects", but toolchain builds will likely fail if this is merged after the next SwiftPM main to release/6.2 merge

Testing:
If we can get a toolchain successfully built, this would yield positive results. and prefer have this merged before the next SwiftPM main to release/6.2 merge to avoid toolchain build failures.

Reviewers:
@etcwilde

Whenever XCtest is build and installed, do the same for swift-testing
and swift-testing macros.

(cherry picked from commit 2962ea2)
@bkhouri bkhouri requested a review from a team as a code owner May 14, 2025 15:02
@bkhouri
Copy link
Contributor Author

bkhouri commented May 14, 2025

@swift-ci smoke test

@bkhouri bkhouri requested review from etcwilde, edymtt and shahmishal May 14, 2025 15:02
@bkhouri
Copy link
Contributor Author

bkhouri commented May 14, 2025

@swift-ci test

@bkhouri bkhouri enabled auto-merge May 14, 2025 17:01
@bkhouri bkhouri changed the title preset: treat swift testing the same as xctest [6.2] preset: treat swift testing the same as xctest May 14, 2025
@bkhouri bkhouri merged commit 236c0fe into swiftlang:release/6.2 May 15, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants