Skip to content

Commit fcec1cd

Browse files
authored
Merge pull request #80720 from al45tair/eng/PR-148986812
[Test][Concurrency] Fix isIsolatingCurrentContext tests.
2 parents 433ca8e + 0ac4baa commit fcec1cd

2 files changed

+36
-42
lines changed

test/Concurrency/Runtime/actor_assert_precondition_executor_isIsolatingCurrentContext_swift62_mode.swift

+18-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift %import-libdispatch -parse-as-library %s -o %t/a.out
2+
// RUN: %target-build-swift %import-libdispatch -Xfrontend -disable-availability-checking -parse-as-library %s -o %t/a.out
33
// RUN: %target-codesign %t/a.out
44
// RUN: %target-run %t/a.out | %FileCheck %s
55

@@ -93,25 +93,22 @@ actor ActorOnIsCheckImplementingExecutor<Ex: SerialExecutor> {
9393

9494
@main struct Main {
9595
static func main() async {
96-
if #available(SwiftStdlib 6.2, *) {
97-
98-
let hasIsIsolatingCurrentContextExecutor = IsIsolatingExecutor()
99-
let justCheckIsolatedExecutor = JustCheckIsolatedExecutor()
100-
101-
print("=== do not crash with executor which implements isIsolatingCurrentContext")
102-
let hasIsCheckActor = ActorOnIsCheckImplementingExecutor(on: hasIsIsolatingCurrentContextExecutor)
103-
await hasIsCheckActor.checkPreconditionIsolated()
104-
// CHECK: Before preconditionIsolated
105-
// CHECK-NOT: called: checkIsolated
106-
// CHECK: called: isIsolatingCurrentContext
107-
// CHECK-NOT: called: checkIsolated
108-
// CHECK: After preconditionIsolated
109-
110-
// CHECK: Before assumeIsolated
111-
// CHECK-NOT: called: checkIsolated
112-
// CHECK: called: isIsolatingCurrentContext
113-
// CHECK-NOT: called: checkIsolated
114-
// CHECK: After assumeIsolated
115-
}
96+
let hasIsIsolatingCurrentContextExecutor = IsIsolatingExecutor()
97+
let justCheckIsolatedExecutor = JustCheckIsolatedExecutor()
98+
99+
print("=== do not crash with executor which implements isIsolatingCurrentContext")
100+
let hasIsCheckActor = ActorOnIsCheckImplementingExecutor(on: hasIsIsolatingCurrentContextExecutor)
101+
await hasIsCheckActor.checkPreconditionIsolated()
102+
// CHECK: Before preconditionIsolated
103+
// CHECK-NOT: called: checkIsolated
104+
// CHECK: called: isIsolatingCurrentContext
105+
// CHECK-NOT: called: checkIsolated
106+
// CHECK: After preconditionIsolated
107+
108+
// CHECK: Before assumeIsolated
109+
// CHECK-NOT: called: checkIsolated
110+
// CHECK: called: isIsolatingCurrentContext
111+
// CHECK-NOT: called: checkIsolated
112+
// CHECK: After assumeIsolated
116113
}
117114
}

test/Concurrency/Runtime/actor_assert_precondition_executor_not_implemented_isIsolatingCurrentContext_swift62_mode.swift

+18-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift %import-libdispatch -parse-as-library %s -o %t/a.out
2+
// RUN: %target-build-swift %import-libdispatch -Xfrontend -disable-availability-checking -parse-as-library %s -o %t/a.out
33
// RUN: %target-codesign %t/a.out
44
// RUN: %target-run %t/a.out | %FileCheck %s
55

@@ -80,25 +80,22 @@ actor ActorOnIsCheckImplementingExecutor<Ex: SerialExecutor> {
8080

8181
@main struct Main {
8282
static func main() async {
83-
if #available(SwiftStdlib 6.2, *) {
84-
85-
let hasIsIsolatingCurrentContextExecutor = IsIsolatingExecutor()
86-
let justCheckIsolatedExecutor = JustCheckIsolatedExecutor()
87-
88-
print("do checkIsolated with executor which does NOT implement isIsolatingCurrentContext")
89-
let checkIsolatedActor = ActorOnIsCheckImplementingExecutor(on: justCheckIsolatedExecutor)
90-
await checkIsolatedActor.checkPreconditionIsolated()
91-
// CHECK: Before preconditionIsolated
92-
// CHECK-NOT: called: isIsolatingCurrentContext
93-
// CHECK: called: checkIsolated
94-
// CHECK-NOT: called: isIsolatingCurrentContext
95-
// CHECK: After preconditionIsolated
96-
97-
// CHECK: Before assumeIsolated
98-
// CHECK-NOT: called: isIsolatingCurrentContext
99-
// CHECK: called: checkIsolated
100-
// CHECK-NOT: called: isIsolatingCurrentContext
101-
// CHECK: After assumeIsolated
102-
}
83+
let hasIsIsolatingCurrentContextExecutor = IsIsolatingExecutor()
84+
let justCheckIsolatedExecutor = JustCheckIsolatedExecutor()
85+
86+
print("do checkIsolated with executor which does NOT implement isIsolatingCurrentContext")
87+
let checkIsolatedActor = ActorOnIsCheckImplementingExecutor(on: justCheckIsolatedExecutor)
88+
await checkIsolatedActor.checkPreconditionIsolated()
89+
// CHECK: Before preconditionIsolated
90+
// CHECK-NOT: called: isIsolatingCurrentContext
91+
// CHECK: called: checkIsolated
92+
// CHECK-NOT: called: isIsolatingCurrentContext
93+
// CHECK: After preconditionIsolated
94+
95+
// CHECK: Before assumeIsolated
96+
// CHECK-NOT: called: isIsolatingCurrentContext
97+
// CHECK: called: checkIsolated
98+
// CHECK-NOT: called: isIsolatingCurrentContext
99+
// CHECK: After assumeIsolated
103100
}
104101
}

0 commit comments

Comments
 (0)