Skip to content

Commit d8da87a

Browse files
[test] enable async_task_sleep_cancel.swift for non-libdispatch global executor
1 parent 0ecd831 commit d8da87a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/Concurrency/Runtime/async_task_sleep_cancel.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input always
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
4-
// REQUIRES: libdispatch
54

65
// rdar://76038845
76
// REQUIRES: concurrency_runtime
87
// UNSUPPORTED: back_deployment_runtime
98

109
import _Concurrency
10+
#if canImport(Dispatch)
1111
// FIXME: should not depend on Dispatch
1212
import Dispatch
13+
#endif
1314

1415
@available(SwiftStdlib 5.5, *)
1516
@main struct Main {
@@ -25,6 +26,7 @@ import Dispatch
2526
}
2627

2728
static func testSleepFinished() async {
29+
#if canImport(Dispatch)
2830
// CHECK-NEXT: Testing sleep that completes
2931
print("Testing sleep that completes")
3032
let start = DispatchTime.now()
@@ -39,6 +41,11 @@ import Dispatch
3941

4042
// CHECK-NEXT: Wakey wakey!
4143
print("Wakey wakey!")
44+
#else
45+
// dummy output to pass FileCheck
46+
print("Testing sleep that completes")
47+
print("Wakey wakey!")
48+
#endif
4249
}
4350

4451
static func testSleepMomentary() async {
@@ -75,6 +82,7 @@ import Dispatch
7582
}
7683

7784
static func testSleepCancelled() async {
85+
#if canImport(Dispatch)
7886
// CHECK-NEXT: Testing sleep that gets cancelled before it completes
7987
print("Testing sleep that gets cancelled before it completes")
8088
let start = DispatchTime.now()
@@ -110,5 +118,11 @@ import Dispatch
110118

111119
// CHECK-NEXT: Cancelled!
112120
print("Cancelled!")
121+
#else
122+
// dummy output to pass FileCheck
123+
print("Testing sleep that gets cancelled before it completes")
124+
print("Caught the cancellation error")
125+
print("Cancelled!")
126+
#endif
113127
}
114128
}

0 commit comments

Comments
 (0)