Skip to content

Commit 941ac3c

Browse files
committed
Distributed: Enabled availability checking in Distributed tests.
Various distributed actors test cases were testing behavior that ultimately depends on availability checking but then disabled availability checking on the command line when building. This will break with future planned changes to availability checking infrastructure.
1 parent 967c5c6 commit 941ac3c

5 files changed

+28
-18
lines changed

test/Distributed/Runtime/distributed_actor_assume_executor.swift

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
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
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
44
// RUN: %target-codesign %t/a.out
55
// RUN: %target-run %t/a.out
66

@@ -18,21 +18,25 @@ import StdlibUnittest
1818
import Distributed
1919
import FakeDistributedActorSystems
2020

21+
@available(SwiftStdlib 5.7, *)
2122
typealias DefaultDistributedActorSystem = FakeRoundtripActorSystem
2223

24+
@available(SwiftStdlib 5.9, *)
2325
func checkAssumeLocalDistributedActor(actor: MainDistributedFriend) /* synchronous! */ -> String {
2426
actor.assumeIsolated { dist in
2527
print("gained access to: \(dist.isolatedProperty)")
2628
return dist.isolatedProperty
2729
}
2830
}
2931

32+
@available(SwiftStdlib 5.9, *)
3033
func checkAssumeMainActor(actor: MainDistributedFriend) /* synchronous! */ {
3134
MainActor.assumeIsolated {
3235
print("yay")
3336
}
3437
}
3538

39+
@available(SwiftStdlib 5.9, *)
3640
@MainActor
3741
func check(actor: MainDistributedFriend) {
3842
_ = checkAssumeLocalDistributedActor(actor: actor)
@@ -58,6 +62,7 @@ distributed actor MainDistributedFriend {
5862

5963
}
6064

65+
@available(SwiftStdlib 5.9, *)
6166
actor OtherMain {
6267
nonisolated var unownedExecutor: UnownedSerialExecutor {
6368
return MainActor.sharedUnownedExecutor
@@ -71,14 +76,14 @@ actor OtherMain {
7176
}
7277
}
7378

79+
@available(SwiftStdlib 5.7, *)
7480
@main struct Main {
7581
static func main() async {
76-
let tests = TestSuite("AssumeLocalDistributedActorExecutor")
77-
78-
let system = FakeRoundtripActorSystem()
79-
let distLocal = MainDistributedFriend(actorSystem: system)
80-
8182
if #available(SwiftStdlib 5.9, *) {
83+
let tests = TestSuite("AssumeLocalDistributedActorExecutor")
84+
85+
let system = FakeRoundtripActorSystem()
86+
let distLocal = MainDistributedFriend(actorSystem: system)
8287

8388
tests.test("assumeOnLocalDistributedActorExecutor: assume the main executor, inside the DistributedMainDistributedFriend local actor") {
8489
_ = checkAssumeLocalDistributedActor(actor: distLocal)
@@ -100,9 +105,7 @@ actor OtherMain {
100105
await OtherMain().checkAssumeLocalDistributedActor(actor: remoteRef)
101106
}
102107

103-
108+
await runAllTestsAsync()
104109
}
105-
106-
await runAllTestsAsync()
107110
}
108111
}

test/Distributed/Runtime/distributed_actor_custom_executor_availability.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
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
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
44
// RUN: %target-codesign %t/a.out
55
// RUN: %target-run %t/a.out
66

@@ -76,6 +76,7 @@ distributed actor FiveSevenActor_FiveNineExecutor {
7676
}
7777
}
7878

79+
@available(SwiftStdlib 5.7, *)
7980
@main struct Main {
8081
static func main() async {
8182
if #available(SwiftStdlib 5.9, *) {

test/Distributed/Runtime/distributed_actor_custom_executor_basic.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
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 -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
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 -module-name main -Xfrontend -enable-experimental-distributed -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
44
// RUN: %target-codesign %t/a.out
55
// RUN: %target-run %t/a.out | %FileCheck %s --color
66

@@ -19,6 +19,7 @@
1919
import Distributed
2020
import FakeDistributedActorSystems
2121

22+
@available(SwiftStdlib 5.7, *)
2223
typealias DefaultDistributedActorSystem = FakeRoundtripActorSystem
2324

2425
@available(SwiftStdlib 5.9, *) // because conforming to the protocol... that has this field in 5.9?
@@ -38,6 +39,7 @@ distributed actor Worker {
3839

3940
}
4041

42+
@available(SwiftStdlib 5.9, *)
4143
@main struct Main {
4244
static func main() async {
4345
let worker = Worker(actorSystem: DefaultDistributedActorSystem())

test/Distributed/Runtime/distributed_actor_custom_executor_from_id.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
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 -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
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 -module-name main -Xfrontend -enable-experimental-distributed -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
44
// RUN: %target-codesign %t/a.out
55
// RUN: %target-run %t/a.out | %FileCheck %s --color
66

@@ -21,6 +21,7 @@
2121
import Distributed
2222
import FakeDistributedActorSystems
2323

24+
@available(SwiftStdlib 5.7, *)
2425
typealias DefaultDistributedActorSystem = FakeRoundtripActorSystem
2526

2627
@available(SwiftStdlib 5.9, *)
@@ -43,12 +44,14 @@ distributed actor Worker {
4344
}
4445
}
4546

47+
@available(SwiftStdlib 5.7, *)
4648
extension DefaultDistributedActorSystem.ActorID {
4749
var executorPreference: UnownedSerialExecutor? {
4850
MainActor.sharedUnownedExecutor
4951
}
5052
}
5153

54+
@available(SwiftStdlib 5.9, *)
5255
@main struct Main {
5356
static func main() async {
5457
let worker = Worker(actorSystem: DefaultDistributedActorSystem())

test/Distributed/SIL/distributed_actor_initialize_nondefault.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
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-swift-frontend -module-name default_deinit -primary-file %s -emit-sil -verify -disable-availability-checking -I %t | %FileCheck %s --enable-var-scope
2+
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems %S/../Inputs/FakeDistributedActorSystems.swift
3+
// RUN: %target-swift-frontend -module-name default_deinit -primary-file %s -emit-sil -verify -I %t | %FileCheck %s --enable-var-scope
44
// REQUIRES: concurrency
55
// REQUIRES: distributed
66

@@ -9,6 +9,7 @@
99
import Distributed
1010
import FakeDistributedActorSystems
1111

12+
@available(SwiftStdlib 5.7, *)
1213
typealias DefaultDistributedActorSystem = FakeRoundtripActorSystem
1314

1415
// ==== ----------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)