Skip to content

Commit cc1ae9f

Browse files
committed
merge coverage of multiple transport args into a runtime test
the SIL test for ensuring that the transport argument is chosen correctly can also be covered by a runtime test. It also gives me an excuse to add some async init coverage too.
1 parent 0651ace commit cc1ae9f

File tree

2 files changed

+23
-88
lines changed

2 files changed

+23
-88
lines changed

test/Distributed/Runtime/distributed_actor_init_local.swift

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@
1010

1111
import _Distributed
1212

13+
@available(SwiftStdlib 5.5, *)
14+
distributed actor PickATransport1 {
15+
init(kappa transport: ActorTransport, other: Int) {}
16+
}
17+
18+
@available(SwiftStdlib 5.5, *)
19+
distributed actor PickATransport2 {
20+
init(other: Int, theTransport: ActorTransport) async {}
21+
}
22+
1323
@available(SwiftStdlib 5.5, *)
1424
distributed actor LocalWorker {
15-
init(transport: ActorTransport) {
16-
defer { transport.actorReady(self) } // FIXME(distributed): rdar://81783599 this should be injected automatically
17-
}
25+
init(transport: ActorTransport) {}
1826
}
1927

2028
// ==== Fake Transport ---------------------------------------------------------
@@ -57,18 +65,28 @@ struct FakeTransport: ActorTransport {
5765
// ==== Execute ----------------------------------------------------------------
5866

5967
@available(SwiftStdlib 5.5, *)
60-
func test() {
68+
func test() async {
6169
let transport = FakeTransport()
6270

6371
_ = LocalWorker(transport: transport)
6472
// CHECK: assign type:LocalWorker, id:ActorAddress(address: "[[ID:.*]]")
6573
// CHECK: ready actor:main.LocalWorker, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
6674
// CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
75+
76+
_ = PickATransport1(kappa: transport, other: 0)
77+
// CHECK: assign type:PickATransport1, id:ActorAddress(address: "[[ID:.*]]")
78+
// CHECK: ready actor:main.PickATransport1, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
79+
// CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
80+
81+
_ = await PickATransport2(other: 1, theTransport: transport)
82+
// CHECK: assign type:PickATransport2, id:ActorAddress(address: "[[ID:.*]]")
83+
// CHECK: ready actor:main.PickATransport2, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
84+
// CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
6785
}
6886

6987
@available(SwiftStdlib 5.5, *)
7088
@main struct Main {
7189
static func main() async {
72-
test()
90+
await test()
7391
}
7492
}

test/SIL/Distributed/distributed_actor_user_transport_init_sil.swift

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)