11// RUN: %empty-directory(%t)
22// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
3- // RUN: %target-build-swift -Xfrontend -disable-availability-checking -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
3+ // RUN: %target-build-swift -parse-as-library -target %target-swift-abi-5.7-triple -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift %S/../Inputs/CustomSerialExecutorAvailability .swift -o %t/a.out
44// RUN: %target-codesign %t/a.out
5- // RUN: %target-run %t/a.out
5+ // RUN: %target-run %t/a.out
6+
7+ // These are the only platforms for which compiling a Swift 5.7 aligned deployment target is possible.
8+ // REQUIRES: OS=macosx || OS=ios || OS=watchos || OS=tvos
69
710// REQUIRES: executable_test
811// REQUIRES: concurrency
1619
1720import StdlibUnittest
1821import Distributed
19- import FakeDistributedActorSystems
20-
21- @available ( SwiftStdlib 5 . 7 , * )
22- typealias DefaultDistributedActorSystem = LocalTestingDistributedActorSystem
23-
24- @available ( SwiftStdlib 5 . 7 , * )
25- distributed actor FiveSevenActor_NothingExecutor {
26- nonisolated var unownedExecutor : UnownedSerialExecutor {
27- print ( " get unowned executor " )
28- return MainActor . sharedUnownedExecutor
29- }
30-
31- distributed func test( x: Int ) async throws {
32- print ( " executed: \( #function) " )
33- defer {
34- print ( " done executed: \( #function) " )
35- }
36- MainActor . assumeIsolated {
37- // ignore
38- }
39- }
40- }
41-
42- @available ( SwiftStdlib 5 . 9 , * )
43- distributed actor FiveNineActor_NothingExecutor {
44- nonisolated var unownedExecutor : UnownedSerialExecutor {
45- print ( " get unowned executor " )
46- return MainActor . sharedUnownedExecutor
47- }
48-
49- distributed func test( x: Int ) async throws {
50- print ( " executed: \( #function) " )
51- defer {
52- print ( " done executed: \( #function) " )
53- }
54- MainActor . assumeIsolated {
55- // ignore
56- }
57- }
58- }
59-
60- @available ( SwiftStdlib 5 . 7 , * )
61- distributed actor FiveSevenActor_FiveNineExecutor {
62- @available ( SwiftStdlib 5 . 9 , * )
63- nonisolated var unownedExecutor : UnownedSerialExecutor {
64- print ( " get unowned executor " )
65- return MainActor . sharedUnownedExecutor
66- }
67-
68- distributed func test( x: Int ) async throws {
69- print ( " executed: \( #function) " )
70- defer {
71- print ( " done executed: \( #function) " )
72- }
73- MainActor . assumeIsolated {
74- // ignore
75- }
76- }
77- }
7822
7923@main struct Main {
8024 static func main( ) async {
@@ -83,7 +27,6 @@ distributed actor FiveSevenActor_FiveNineExecutor {
8327
8428 let system = LocalTestingDistributedActorSystem ( )
8529
86- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
8730 tests. test ( " 5.7 actor, no availability executor property => no custom executor " ) {
8831 expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
8932 try ! await FiveSevenActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
@@ -97,22 +40,6 @@ distributed actor FiveSevenActor_FiveNineExecutor {
9740 expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
9841 try ! await FiveSevenActor_FiveNineExecutor ( actorSystem: system) . test ( x: 42 )
9942 }
100- #else
101- // On non-apple platforms the SDK comes with the toolchains,
102- // so the feature works because we're executing in a 5.9 context already,
103- // which otherwise could not have been compiled
104- tests. test ( " non apple platform: 5.7 actor, no availability executor property => no custom executor " ) {
105- try ! await FiveSevenActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
106- }
107-
108- tests. test ( " non apple platform: 5.9 actor, no availability executor property => custom executor " ) {
109- try ! await FiveNineActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
110- }
111-
112- tests. test ( " non apple platform: 5.7 actor, 5.9 executor property => no custom executor " ) {
113- try ! await FiveSevenActor_FiveNineExecutor ( actorSystem: system) . test ( x: 42 )
114- }
115- #endif
11643
11744 await runAllTestsAsync ( )
11845 }
0 commit comments