Skip to content

Commit 076b7de

Browse files
nickolas-pohiletsktoso
authored andcommitted
Lower target version requirement for test/Concurrency/voucher_propagation.swift using conditional availability
1 parent a182190 commit 076b7de

File tree

1 file changed

+42
-37
lines changed

1 file changed

+42
-37
lines changed

test/Concurrency/voucher_propagation.swift

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// 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
33
// RUN: %target-codesign %t/voucher_propagation
44
// RUN: MallocStackLogging=1 %target-run %t/voucher_propagation
55

@@ -75,6 +75,7 @@ actor Counter {
7575
func get() -> Int { n }
7676
}
7777

78+
@available(SwiftStdlib 6.1, *)
7879
actor ActorWithSelfIsolatedDeinit {
7980
let expectedVoucher: voucher_t?
8081
let group: DispatchGroup
@@ -101,6 +102,7 @@ actor ActorWithSelfIsolatedDeinit {
101102
}
102103
}
103104

105+
@available(SwiftStdlib 6.1, *)
104106
actor ActorWithDeinitIsolatedOnAnother {
105107
let expectedVoucher: voucher_t?
106108
let group: DispatchGroup
@@ -120,6 +122,7 @@ actor ActorWithDeinitIsolatedOnAnother {
120122
}
121123
}
122124

125+
@available(SwiftStdlib 6.1, *)
123126
class ClassWithIsolatedDeinit {
124127
let expectedVoucher: voucher_t?
125128
let group: DispatchGroup
@@ -426,47 +429,49 @@ if #available(SwiftStdlib 5.1, *) {
426429
group.wait()
427430
}
428431
}
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+
}
448453
}
454+
group.wait()
449455
}
450-
group.wait()
451456
}
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+
}
467472
}
473+
group.wait()
468474
}
469-
group.wait()
470475
}
471476
}
472477
}

0 commit comments

Comments
 (0)