Skip to content

Commit be1e8f6

Browse files
Merge pull request swiftlang#35642 from nate-chandler/test/20210128/1
[Test] Replaced temporary function with async main.
2 parents 9209e23 + 798f869 commit be1e8f6

21 files changed

+161
-102
lines changed

test/Concurrency/Runtime/actor_counters.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency %import-libdispatch)
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency %import-libdispatch -parse-as-library)
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency
@@ -81,6 +81,8 @@ func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
8181
print("DONE!")
8282
}
8383

84-
runAsyncAndBlock {
85-
await runTest(numCounters: 10, numWorkers: 100, numIterations: 1000)
84+
@main struct Main {
85+
static func main() async {
86+
await runTest(numCounters: 10, numWorkers: 100, numIterations: 1000)
87+
}
8688
}

test/Concurrency/Runtime/async_let_fibonacci.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency %import-libdispatch)
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency %import-libdispatch -parse-as-library)
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency
@@ -48,6 +48,8 @@ func runFibonacci(_ n: Int) async {
4848
assert(result == fib(n))
4949
}
5050

51-
runAsyncAndBlock {
52-
await runFibonacci(10)
51+
@main struct Main {
52+
static func main() async {
53+
await runFibonacci(10)
54+
}
5355
}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
44

5-
func test_getPriority() {
6-
runAsyncAndBlock {
5+
@main struct Main {
6+
static func main() async {
77
let p = await Task.currentPriority()
88
// CHECK: priority: default
99
print("priority: \(p)")
1010
assert(p == Task.Priority.default)
1111
}
1212
}
13-
14-
test_getPriority()

test/Concurrency/Runtime/async_taskgroup_add_handle_completion.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input=always
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
44
// REQUIRES: OS=macosx
@@ -65,4 +65,8 @@ func test_sum_nextOnPending() async {
6565
assert(sum == 6, "Expected \(6) but got \(sum)")
6666
}
6767

68-
runAsyncAndBlock(test_sum_nextOnPending)
68+
@main struct Main {
69+
static func main() async {
70+
await test_sum_nextOnPending()
71+
}
72+
}

test/Concurrency/Runtime/async_taskgroup_is_empty.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) | %FileCheck %s --dump-input always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input always
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
44
// REQUIRES: OS=macosx
@@ -40,4 +40,8 @@ func test_taskGroup_isEmpty() async {
4040
}
4141
}
4242

43-
runAsyncAndBlock(test_taskGroup_isEmpty)
43+
@main struct Main {
44+
static func main() async {
45+
await test_taskGroup_isEmpty()
46+
}
47+
}

test/Concurrency/Runtime/async_taskgroup_next_not_invoked_cancelAll.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input=always
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
44
// REQUIRES: OS=macosx
@@ -43,4 +43,8 @@ func test_skipCallingNext_butInvokeCancelAll() async {
4343
assert(result == 0)
4444
}
4545

46-
runAsyncAndBlock(test_skipCallingNext_butInvokeCancelAll)
46+
@main struct Main {
47+
static func main() async {
48+
await test_skipCallingNext_butInvokeCancelAll()
49+
}
50+
}

test/Concurrency/Runtime/async_taskgroup_next_not_invoked_without_cancelAll.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input=always
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
44
// REQUIRES: OS=macosx
@@ -36,5 +36,9 @@ func test_skipCallingNext() async {
3636
assert(result == 0)
3737
}
3838

39-
runAsyncAndBlock(test_skipCallingNext)
39+
@main struct Main {
40+
static func main() async {
41+
await test_skipCallingNext()
42+
}
43+
}
4044

test/Concurrency/Runtime/async_taskgroup_next_on_completed.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input=always
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
44
// REQUIRES: OS=macosx
@@ -69,4 +69,8 @@ func test_sum_nextOnCompleted() async {
6969
print("result: \(sum)")
7070
}
7171

72-
runAsyncAndBlock(test_sum_nextOnCompleted)
72+
@main struct Main {
73+
static func main() async {
74+
await test_sum_nextOnCompleted()
75+
}
76+
}

test/Concurrency/Runtime/async_taskgroup_next_on_pending.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input=always
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
44
// REQUIRES: OS=macosx
@@ -56,4 +56,8 @@ func test_sum_nextOnPending() async {
5656
assert(sum == expected, "Expected: \(expected), got: \(sum)")
5757
}
5858

59-
runAsyncAndBlock(test_sum_nextOnPending)
59+
@main struct Main {
60+
static func main() async {
61+
await test_sum_nextOnPending()
62+
}
63+
}

test/Concurrency/Runtime/async_taskgroup_throw_recover.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency) | %FileCheck %s --dump-input always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input always
22
// REQUIRES: executable_test
33
// REQUIRES: concurrency
44
// REQUIRES: OS=macosx
@@ -83,4 +83,9 @@ func test_taskGroup_throws() async {
8383
}
8484
}
8585

86-
runAsyncAndBlock(test_taskGroup_throws)
86+
87+
@main struct Main {
88+
static func main() async {
89+
await test_taskGroup_throws()
90+
}
91+
}

0 commit comments

Comments
 (0)