Skip to content

Commit d9648a8

Browse files
committed
Make concurrency test more reliable
1 parent 7edc517 commit d9648a8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Tests/ConcurrencyTests/Executor/ConcurrentSequenceExecutorTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import XCTest
1818
@testable import Concurrency
1919

20-
class ConcurrentConcurrentSequenceExecutorTests: XCTestCase {
20+
class ConcurrentSequenceExecutorTests: XCTestCase {
2121

2222
static var allTests = [
2323
("test_executeSequence_withSingle_verifyConcurrency", test_executeSequence_withSingle_verifyConcurrency),
@@ -32,7 +32,7 @@ class ConcurrentConcurrentSequenceExecutorTests: XCTestCase {
3232
var threadHashes = [Int: Int]()
3333
let threadHashesLock = NSRecursiveLock()
3434

35-
for i in 0 ..< 10000 {
35+
for i in 0 ..< 30000 {
3636
let didComplete = expectation(description: "task-\(i)")
3737
let task = MockSelfRepeatingTask {
3838
threadHashesLock.lock()
@@ -52,7 +52,7 @@ class ConcurrentConcurrentSequenceExecutorTests: XCTestCase {
5252
waitForExpectations(timeout: 3, handler: nil)
5353

5454
threadHashesLock.lock()
55-
XCTAssertGreaterThan(threadHashes.count, 4)
55+
XCTAssertGreaterThan(threadHashes.count, 2)
5656
threadHashesLock.unlock()
5757
}
5858

Tests/LinuxMain.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ XCTMain([
2222
testCase(AtomicIntTests.allTests),
2323
testCase(AtomicReferenceTests.allTests),
2424
testCase(CountDownLatchTests.allTests),
25+
testCase(ConcurrentSequenceExecutorTests.allTests),
2526
])

0 commit comments

Comments
 (0)