1
1
// RUN: %empty-directory(%t)
2
- // RUN: %target-build-swift %s -target %target-future -triple -o %t/voucher_propagation
2
+ // RUN: %target-build-swift %s -target %target-swift-5.1-abi -triple -o %t/voucher_propagation
3
3
// RUN: %target-codesign %t/voucher_propagation
4
4
// RUN: MallocStackLogging=1 %target-run %t/voucher_propagation
5
5
@@ -75,6 +75,7 @@ actor Counter {
75
75
func get( ) -> Int { n }
76
76
}
77
77
78
+ @available ( SwiftStdlib 6 . 1 , * )
78
79
actor ActorWithSelfIsolatedDeinit {
79
80
let expectedVoucher : voucher_t ?
80
81
let group : DispatchGroup
@@ -101,6 +102,7 @@ actor ActorWithSelfIsolatedDeinit {
101
102
}
102
103
}
103
104
105
+ @available ( SwiftStdlib 6 . 1 , * )
104
106
actor ActorWithDeinitIsolatedOnAnother {
105
107
let expectedVoucher : voucher_t ?
106
108
let group : DispatchGroup
@@ -120,6 +122,7 @@ actor ActorWithDeinitIsolatedOnAnother {
120
122
}
121
123
}
122
124
125
+ @available ( SwiftStdlib 6 . 1 , * )
123
126
class ClassWithIsolatedDeinit {
124
127
let expectedVoucher : voucher_t ?
125
128
let group : DispatchGroup
@@ -426,47 +429,49 @@ if #available(SwiftStdlib 5.1, *) {
426
429
group. wait ( )
427
430
}
428
431
}
429
-
430
- tests. test ( " voucher propagation in isolated deinit [fast path] " ) {
431
- withVouchers { v1, v2, v3 in
432
- let group = DispatchGroup ( )
433
- group. enter ( )
434
- group. enter ( )
435
- group. enter ( )
436
- Task {
437
- await AnotherActor . shared. performTesting {
438
- adopt ( voucher: v1)
439
- _ = ClassWithIsolatedDeinit ( expectedVoucher: v1, group: group)
440
- }
441
- await AnotherActor . shared. performTesting {
442
- adopt ( voucher: v2)
443
- _ = ActorWithSelfIsolatedDeinit ( expectedVoucher: v2, group: group)
444
- }
445
- await AnotherActor . shared. performTesting {
446
- adopt ( voucher: v3)
447
- _ = ActorWithDeinitIsolatedOnAnother ( expectedVoucher: v3, group: group)
432
+
433
+ if #available( SwiftStdlib 6 . 1 , * ) {
434
+ tests. test ( " voucher propagation in isolated deinit [fast path] " ) {
435
+ withVouchers { v1, v2, v3 in
436
+ let group = DispatchGroup ( )
437
+ group. enter ( )
438
+ group. enter ( )
439
+ group. enter ( )
440
+ Task {
441
+ await AnotherActor . shared. performTesting {
442
+ adopt ( voucher: v1)
443
+ _ = ClassWithIsolatedDeinit ( expectedVoucher: v1, group: group)
444
+ }
445
+ await AnotherActor . shared. performTesting {
446
+ adopt ( voucher: v2)
447
+ _ = ActorWithSelfIsolatedDeinit ( expectedVoucher: v2, group: group)
448
+ }
449
+ await AnotherActor . shared. performTesting {
450
+ adopt ( voucher: v3)
451
+ _ = ActorWithDeinitIsolatedOnAnother ( expectedVoucher: v3, group: group)
452
+ }
448
453
}
454
+ group. wait ( )
449
455
}
450
- group. wait ( )
451
456
}
452
- }
453
-
454
- tests . test ( " voucher propagation in isolated deinit [slow path] " ) {
455
- withVouchers { v1 , v2 , v3 in
456
- let group = DispatchGroup ( )
457
- group. enter ( )
458
- group . enter ( )
459
- Task {
460
- do {
461
- adopt ( voucher : v1)
462
- _ = ActorWithDeinitIsolatedOnAnother ( expectedVoucher : v1 , group : group )
463
- }
464
- do {
465
- adopt ( voucher : v2)
466
- _ = ClassWithIsolatedDeinit ( expectedVoucher : v2 , group : group )
457
+
458
+ tests . test ( " voucher propagation in isolated deinit [slow path] " ) {
459
+ withVouchers { v1 , v2 , v3 in
460
+ let group = DispatchGroup ( )
461
+ group . enter ( )
462
+ group. enter ( )
463
+ Task {
464
+ do {
465
+ adopt ( voucher : v1 )
466
+ _ = ActorWithDeinitIsolatedOnAnother ( expectedVoucher : v1, group : group )
467
+ }
468
+ do {
469
+ adopt ( voucher : v2 )
470
+ _ = ClassWithIsolatedDeinit ( expectedVoucher : v2, group : group )
471
+ }
467
472
}
473
+ group. wait ( )
468
474
}
469
- group. wait ( )
470
475
}
471
476
}
472
477
}
0 commit comments