11// RUN: %empty-directory(%t)
22// 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
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- @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- }
8022
8123@available ( SwiftStdlib 5 . 7 , * )
8224@main struct Main {
@@ -86,7 +28,6 @@ distributed actor FiveSevenActor_FiveNineExecutor {
8628
8729 let system = LocalTestingDistributedActorSystem ( )
8830
89- #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
9031 tests. test ( " 5.7 actor, no availability executor property => no custom executor " ) {
9132 expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
9233 try ! await FiveSevenActor_NothingExecutor ( actorSystem: system) . test ( x: 42 )
@@ -100,22 +41,6 @@ distributed actor FiveSevenActor_FiveNineExecutor {
10041 expectCrashLater ( withMessage: " Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor. " )
10142 try ! await FiveSevenActor_FiveNineExecutor ( actorSystem: system) . test ( x: 42 )
10243 }
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
11944
12045 await runAllTestsAsync ( )
12146 }
0 commit comments