Skip to content

Commit 456140b

Browse files
committed
more coverage for actorSystem assign
1 parent 74b3582 commit 456140b

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

test/Distributed/Runtime/distributed_actor_init_local.swift

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ distributed actor MaybeSystem {
7979
}
8080
}
8181

82+
distributed actor MaybeAfterAssign {
83+
var x: Int
84+
init?(fail: Bool) {
85+
actorSystem = FakeActorSystem()
86+
if fail {
87+
return nil
88+
}
89+
x = 100
90+
}
91+
}
92+
8293
// ==== Fake Transport ---------------------------------------------------------
8394

8495
struct ActorAddress: Sendable, Hashable, Codable {
@@ -222,10 +233,12 @@ func test() async {
222233
test.append(try? Throwy(system: system, doThrow: true))
223234
// CHECK: assign type:Throwy, id:ActorAddress(address: "[[ID4:.*]]")
224235
// CHECK-NOT: ready
236+
// CHECK: resign id:ActorAddress(address: "[[ID4]]")
225237

226238
test.append(try? ThrowBeforeFullyInit(system: system, doThrow: true))
227239
// CHECK: assign type:ThrowBeforeFullyInit, id:ActorAddress(address: "[[ID5:.*]]")
228240
// CHECK-NOT: ready
241+
// CHECK: resign id:ActorAddress(address: "[[ID5]]")
229242

230243
test.append(await PickATransport2(other: 1, thesystem: system))
231244
// CHECK: assign type:PickATransport2, id:ActorAddress(address: "[[ID6:.*]]")
@@ -240,6 +253,15 @@ func test() async {
240253
// CHECK: assign type:MaybeSystem, id:ActorAddress(address: "[[ID8:.*]]")
241254
// CHECK: ready actor:main.MaybeSystem, id:ActorAddress(address: "[[ID8]]")
242255

256+
test.append(MaybeAfterAssign(fail: true))
257+
// CHECK: assign type:MaybeAfterAssign, id:ActorAddress(address: "[[ID9:.*]]")
258+
// CHECK-NOT: ready
259+
// CHECK-NEXT: resign id:ActorAddress(address: "[[ID9]]")
260+
261+
test.append(MaybeAfterAssign(fail: false))
262+
// CHECK: assign type:MaybeAfterAssign, id:ActorAddress(address: "[[ID10:.*]]")
263+
// CHECK-NEXT: ready actor:main.MaybeAfterAssign, id:ActorAddress(address: "[[ID10]]")
264+
243265
// the following tests fail to initialize the actor's identity.
244266
print("-- start of no-assign tests --")
245267
test.append(MaybeSystem(nil))
@@ -249,14 +271,18 @@ func test() async {
249271
// CHECK-NOT: assign
250272
// CHECK: -- end of no-assign tests --
251273

274+
275+
// resigns that come out of the deinits:
276+
252277
// CHECK-DAG: resign id:ActorAddress(address: "[[ID1]]")
253278
// CHECK-DAG: resign id:ActorAddress(address: "[[ID2]]")
254279
// CHECK-DAG: resign id:ActorAddress(address: "[[ID3]]")
255-
// MISSING-CHECK-DAG: resign id:ActorAddress(address: "[[ID4]]") // FIXME: should eventually work (rdar://84533820).
256-
// MISSING-CHECK-DAG: resign id:ActorAddress(address: "[[ID5]]") // FIXME: should eventually work (rdar://84533820).
280+
257281
// CHECK-DAG: resign id:ActorAddress(address: "[[ID6]]")
258282
// CHECK-DAG: resign id:ActorAddress(address: "[[ID7]]")
259283
// CHECK-DAG: resign id:ActorAddress(address: "[[ID8]]")
284+
285+
// CHECK-DAG: resign id:ActorAddress(address: "[[ID10]]")
260286
}
261287

262288
@main struct Main {

0 commit comments

Comments
 (0)