1
1
// RUN: %empty-directory(%t)
2
2
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems %S/../Inputs/FakeDistributedActorSystems.swift
3
- // RUN: %target-build-swift -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
4
4
// 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
6
9
7
10
// REQUIRES: executable_test
8
11
// REQUIRES: concurrency
16
19
17
20
import StdlibUnittest
18
21
import 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
- @available ( SwiftStdlib 5 . 9 , * )
32
- distributed func test( x: Int ) throws {
33
- print ( " executed: \( #function) " )
34
- defer {
35
- print ( " done executed: \( #function) " )
36
- }
37
- MainActor . assumeIsolated {
38
- // ignore
39
- }
40
- }
41
- }
42
-
43
- @available ( SwiftStdlib 5 . 9 , * )
44
- distributed actor FiveNineActor_NothingExecutor {
45
- nonisolated var unownedExecutor : UnownedSerialExecutor {
46
- print ( " get unowned executor " )
47
- return MainActor . sharedUnownedExecutor
48
- }
49
-
50
- distributed func test( x: Int ) throws {
51
- print ( " executed: \( #function) " )
52
- defer {
53
- print ( " done executed: \( #function) " )
54
- }
55
- MainActor . assumeIsolated {
56
- // ignore
57
- }
58
- }
59
- }
60
-
61
- @available ( SwiftStdlib 5 . 7 , * )
62
- distributed actor FiveSevenActor_FiveNineExecutor {
63
- @available ( SwiftStdlib 5 . 9 , * )
64
- nonisolated var unownedExecutor : UnownedSerialExecutor {
65
- print ( " get unowned executor " )
66
- return MainActor . sharedUnownedExecutor
67
- }
68
-
69
- @available ( SwiftStdlib 5 . 9 , * )
70
- distributed func test( x: Int ) throws {
71
- print ( " executed: \( #function) " )
72
- defer {
73
- print ( " done executed: \( #function) " )
74
- }
75
- MainActor . assumeIsolated {
76
- // ignore
77
- }
78
- }
79
- }
80
22
81
23
@available ( SwiftStdlib 5 . 7 , * )
82
24
@main struct Main {
@@ -86,7 +28,6 @@ distributed actor FiveSevenActor_FiveNineExecutor {
86
28
87
29
let system = LocalTestingDistributedActorSystem ( )
88
30
89
- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
90
31
tests. test ( " 5.7 actor, no availability executor property => no custom executor " ) {
91
32
expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
92
33
try ! await FiveSevenActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
@@ -100,22 +41,6 @@ distributed actor FiveSevenActor_FiveNineExecutor {
100
41
expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
101
42
try ! await FiveSevenActor_FiveNineExecutor ( actorSystem: system) . test ( x: 42 )
102
43
}
103
- #else
104
- // On non-apple platforms the SDK comes with the toolchains,
105
- // so the feature works because we're executing in a 5.9 context already,
106
- // which otherwise could not have been compiled
107
- tests. test ( " non apple platform: 5.7 actor, no availability executor property => no custom executor " ) {
108
- try ! await FiveSevenActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
109
- }
110
-
111
- tests. test ( " non apple platform: 5.9 actor, no availability executor property => custom executor " ) {
112
- try ! await FiveNineActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
113
- }
114
-
115
- tests. test ( " non apple platform: 5.7 actor, 5.9 executor property => no custom executor " ) {
116
- try ! await FiveSevenActor_FiveNineExecutor ( actorSystem: system) . test ( x: 42 )
117
- }
118
- #endif
119
44
120
45
await runAllTestsAsync ( )
121
46
}
0 commit comments