1
1
// RUN: %empty-directory(%t)
2
2
// 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
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
- 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
- }
78
22
79
23
@main struct Main {
80
24
static func main( ) async {
@@ -83,7 +27,6 @@ distributed actor FiveSevenActor_FiveNineExecutor {
83
27
84
28
let system = LocalTestingDistributedActorSystem ( )
85
29
86
- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
87
30
tests. test ( " 5.7 actor, no availability executor property => no custom executor " ) {
88
31
expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
89
32
try ! await FiveSevenActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
@@ -97,22 +40,6 @@ distributed actor FiveSevenActor_FiveNineExecutor {
97
40
expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
98
41
try ! await FiveSevenActor_FiveNineExecutor ( actorSystem: system) . test ( x: 42 )
99
42
}
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
116
43
117
44
await runAllTestsAsync ( )
118
45
}
0 commit comments