Skip to content

Commit 931be88

Browse files
committed
fix distributed_actor_custom_executor_availability for non apple platforms
1 parent 9d7e698 commit 931be88

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/Distributed/Runtime/distributed_actor_custom_executor_availability.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ typealias DefaultDistributedActorSystem = LocalTestingDistributedActorSystem
2323

2424
@available(SwiftStdlib 5.7, *)
2525
distributed actor FiveSevenActor_NothingExecutor {
26-
// @available(SwiftStdlib 5.9, *) // because of `localUnownedExecutor`
2726
nonisolated var localUnownedExecutor: UnownedSerialExecutor? {
2827
print("get unowned executor")
2928
return MainActor.sharedUnownedExecutor
@@ -85,6 +84,7 @@ distributed actor FiveSevenActor_FiveNineExecutor {
8584

8685
let system = LocalTestingDistributedActorSystem()
8786

87+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
8888
tests.test("5.7 actor, no availability executor property => no custom executor") {
8989
expectCrashLater(withMessage: "Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor.")
9090
try! await FiveSevenActor_NothingExecutor(actorSystem: system).test(x: 42)
@@ -98,6 +98,22 @@ distributed actor FiveSevenActor_FiveNineExecutor {
9898
expectCrashLater(withMessage: "Fatal error: Incorrect actor executor assumption; Expected 'MainActor' executor.")
9999
try! await FiveSevenActor_FiveNineExecutor(actorSystem: system).test(x: 42)
100100
}
101+
#else
102+
// On non-apple platforms the SDK comes with the toolchains,
103+
// so the feature works because we're executing in a 5.9 context already,
104+
// which otherwise could not have been compiled
105+
tests.test("non apple platform: 5.7 actor, no availability executor property => no custom executor") {
106+
try! await FiveSevenActor_NothingExecutor(actorSystem: system).test(x: 42)
107+
}
108+
109+
tests.test("non apple platform: 5.9 actor, no availability executor property => custom executor") {
110+
try! await FiveNineActor_NothingExecutor(actorSystem: system).test(x: 42)
111+
}
112+
113+
tests.test("non apple platform: 5.7 actor, 5.9 executor property => no custom executor") {
114+
try! await FiveSevenActor_FiveNineExecutor(actorSystem: system).test(x: 42)
115+
}
116+
#endif
101117

102118
await runAllTestsAsync()
103119
}

0 commit comments

Comments
 (0)