Skip to content

Commit 5649bc8

Browse files
committed
Merge pull request #2566 from bitjammer/atomic-int-debug-operations
AtomicInt.swift: Halve the test iterations on debug builds
2 parents 17036b4 + 224d318 commit 5649bc8

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

validation-test/stdlib/AtomicInt.swift

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import Darwin
1414
import Glibc
1515
#endif
1616

17+
func operationCount(_ n: Int) -> Int {
18+
return _isDebugAssertConfiguration() ? n/2 : n
19+
}
20+
1721
final class HeapBool {
1822
var value: Bool
1923
init(_ value: Bool) {
@@ -792,47 +796,47 @@ struct AtomicInitializeARCRefRaceTest : RaceTestWithPerTrialData {
792796
var AtomicIntTestSuite = TestSuite("AtomicInt")
793797

794798
AtomicIntTestSuite.test("fetchAndAdd/1") {
795-
runRaceTest(AtomicInt_fetchAndAdd_1_RaceTest.self, operations: 6400)
799+
runRaceTest(AtomicInt_fetchAndAdd_1_RaceTest.self, operations: operationCount(6400))
796800
}
797801

798802
AtomicIntTestSuite.test("fetchAndAdd/ReleaseAtomicStores/1") {
799803
runRaceTest(
800804
AtomicInt_fetchAndAdd_ReleaseAtomicStores_1_RaceTest.self,
801-
operations: 12800)
805+
operations: operationCount(12800))
802806
}
803807

804808
AtomicIntTestSuite.test("fetchAndAdd/ReleaseAtomicStores/2") {
805809
runRaceTest(
806810
AtomicInt_fetchAndAdd_ReleaseAtomicStores_2_RaceTest.self,
807-
operations: 12800)
811+
operations: operationCount(12800))
808812
}
809813

810814
AtomicIntTestSuite.test("fetchAndAdd/ReleaseNonAtomicStores/1") {
811815
runRaceTest(
812816
AtomicInt_fetchAndAdd_ReleaseNonAtomicStores_RaceTest.self,
813-
operations: 25600)
817+
operations: operationCount(25600))
814818
}
815819

816820
AtomicIntTestSuite.test("fetchAndAnd/1") {
817-
runRaceTest(AtomicInt_fetchAndAnd_1_RaceTest.self, operations: 6400)
821+
runRaceTest(AtomicInt_fetchAndAnd_1_RaceTest.self, operations: operationCount(6400))
818822
}
819823
// FIXME: add more tests for fetchAndAnd, like we have for fetchAndAdd.
820824

821825
AtomicIntTestSuite.test("fetchAndOr/1") {
822-
runRaceTest(AtomicInt_fetchAndOr_1_RaceTest.self, operations: 6400)
826+
runRaceTest(AtomicInt_fetchAndOr_1_RaceTest.self, operations: operationCount(6400))
823827
}
824828
// FIXME: add more tests for fetchAndOr, like we have for fetchAndAdd.
825829

826830
AtomicIntTestSuite.test("fetchAndXor/1") {
827-
runRaceTest(AtomicInt_fetchAndXor_1_RaceTest.self, operations: 6400)
831+
runRaceTest(AtomicInt_fetchAndXor_1_RaceTest.self, operations: operationCount(6400))
828832
}
829833
// FIXME: add more tests for fetchAndXor, like we have for fetchAndAdd.
830834

831835

832836
var AtomicARCRefTestSuite = TestSuite("AtomicARCRef")
833837

834838
AtomicARCRefTestSuite.test("initialize,load") {
835-
runRaceTest(AtomicInitializeARCRefRaceTest.self, operations: 25600)
839+
runRaceTest(AtomicInitializeARCRefRaceTest.self, operations: operationCount(25600))
836840
expectEqual(0, dummyObjectCount.getSum())
837841
}
838842

0 commit comments

Comments
 (0)