Skip to content

Commit e023695

Browse files
author
Julian Lettner
committed
actor_counters.swift: allow specifying of parameters
This is useful during debugging when manually running the test.
1 parent e08cf61 commit e023695

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

test/Concurrency/Runtime/actor_counters.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
6969

7070
@main struct Main {
7171
static func main() async {
72-
await runTest(numCounters: 10, numWorkers: 100, numIterations: 1000)
72+
// Useful for debugging: specify counter/worker/iteration counts
73+
let args = CommandLine.arguments
74+
let counters = args.count >= 2 ? Int(args[1])! : 10
75+
let workers = args.count >= 3 ? Int(args[2])! : 100
76+
let iterations = args.count >= 4 ? Int(args[3])! : 1000
77+
print("counters: \(counters), workers: \(workers), iterations: \(iterations)")
78+
await runTest(numCounters: counters, numWorkers: workers, numIterations: iterations)
7379
}
7480
}

test/Sanitizers/tsan/actor_counters.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
7070

7171
@main struct Main {
7272
static func main() async {
73-
await runTest(numCounters: 10, numWorkers: 100, numIterations: 1000)
73+
// Useful for debugging: specify counter/worker/iteration counts
74+
let args = CommandLine.arguments
75+
let counters = args.count >= 2 ? Int(args[1])! : 10
76+
let workers = args.count >= 3 ? Int(args[2])! : 100
77+
let iterations = args.count >= 4 ? Int(args[3])! : 1000
78+
print("counters: \(counters), workers: \(workers), iterations: \(iterations)")
79+
await runTest(numCounters: counters, numWorkers: workers, numIterations: iterations)
7480
}
7581
}

0 commit comments

Comments
 (0)