Skip to content

Commit cc1af53

Browse files
authored
Merge pull request #69298 from ktoso/wip-disable-async_taskgroup_next_on_pending-on-watch
Simplify test which is problematic on 32bit watch
2 parents 3c7343d + 5ddc1a1 commit cc1af53

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

test/Concurrency/Runtime/async_taskgroup_next_on_pending.swift

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,19 @@
99
import Dispatch
1010

1111
func completeSlowly(n: Int) async -> Int {
12-
await Task.sleep(UInt64((n * 1_000_000_000) + 1_000_000_000))
13-
print(" complete group.spawn { \(n) }")
12+
try? await Task.sleep(for: .milliseconds(n * 300))
1413
return n
1514
}
1615

1716
/// Tasks complete AFTER they are next() polled.
1817
func test_sum_nextOnPending() async {
1918
let numbers = [1, 2, 3]
20-
let expected = 6 // FIXME: numbers.reduce(0, +) this hangs?
19+
let expected = 6
2120

2221
let sum = try! await withTaskGroup(of: Int.self) { (group) async -> Int in
2322
for n in numbers {
24-
group.spawn {
25-
let res = await completeSlowly(n: n)
26-
return res
23+
group.addTask {
24+
await completeSlowly(n: n)
2725
}
2826
}
2927

@@ -42,13 +40,6 @@ func test_sum_nextOnPending() async {
4240

4341
// The completions are set apart by n seconds, so we expect them to arrive
4442
// in the order as the numbers (and delays) would suggest:
45-
//
46-
// CHECK: complete group.spawn { 1 }
47-
// CHECK: next: 1
48-
// CHECK: complete group.spawn { 2 }
49-
// CHECK: next: 2
50-
// CHECK: complete group.spawn { 3 }
51-
// CHECK: next: 3
5243

5344
// CHECK: task group returning: 6
5445

0 commit comments

Comments
 (0)