Skip to content

[6.0] Generated code for XCTest on non-Darwin needs to be actor-isolated. #7569

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, 2024

Conversation

grynspan
Copy link
Contributor

Explanation: Ensure that the synthesized entry point for swift-corelibs-xctest is concurrency-safe by marking it @MainActor.
Scope: All XCTest-based tests built/run on non-Darwin platforms.
Original PR: #7566
Risk: Low. The change is necessary to suppress a concurrency diagnostic. The synthesized main() function is implicitly main-actor-isolated.
Testing: Added unit test to check for the diagnostic, verified it did not occur anymore with the change in place.
Reviewer: @bnbarham, @MaxDesiatov, @stmontgomery, @briancroom

…7566)

On Linux, Windows, etc. (anywhere that uses swift-corelibs-xctest
instead of XCTest.framework), SwiftPM is responsible for generating an
entry point function that passes in all tests discovered at compile
time. The compiler cannot tell whether the generated code is
concurrency-safe. This PR modifies the generated code and makes it
main-actor-isolated. Since it's only ever used in the program's main
function, this is safe.

Resolves #7556.
@grynspan grynspan added bug concurrency swift test Changes impacting `swift test` tool swift 6.0 Related to Swift 6.0 release branch labels May 15, 2024
@grynspan grynspan self-assigned this May 15, 2024
@grynspan grynspan changed the base branch from main to release/6.0 May 15, 2024 20:12
@grynspan grynspan requested a review from tomerd as a code owner May 15, 2024 20:12
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan merged commit d192ad0 into release/6.0 May 15, 2024
@grynspan grynspan deleted the jgrynspan/actor-isolate-xctest-main-6.0 branch May 15, 2024 22:50
@Lukasa
Copy link
Contributor

Lukasa commented May 23, 2024

When are we expecting this in a 6.0 release snapshot image?

@bnbarham
Copy link
Contributor

Whenever a nightly toolchain actually succeeds 😅 (https://ci.swift.org/view/Swift%206.0/job/oss-swift-6.0-package-trigger/)

@MaxDesiatov
Copy link
Contributor

@Lukasa have you had a chance to check out swift-6.0-DEVELOPMENT-SNAPSHOT-2024-05-26-a?

@Lukasa
Copy link
Contributor

Lukasa commented May 28, 2024

Not yet, will aim to do so soon.

@Lukasa
Copy link
Contributor

Lukasa commented May 28, 2024

Fantastic news, that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug concurrency swift test Changes impacting `swift test` tool swift 6.0 Related to Swift 6.0 release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants