Skip to content

Commit 7672c52

Browse files
committed
Consistent naming for stress tests
* All stress tests end with StressTest, also: * LFStressTest checks lock-freedom * LCStressTest checks linearizability via LinCheck * Gradle build exclusion/inclusion patterns are properly updated: - jdk16Test excludes both LFStressTest and LCStressTest since they depends on JDK8 - Regular tests exclude LFStressTest since they are long (5 sec each) - A separate lockFreedomTest target that is run on "build"
1 parent f7d0177 commit 7672c52

7 files changed

+31
-27
lines changed

kotlinx-coroutines-core/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,23 @@ jvmTest {
7272
maxHeapSize = '1g'
7373
enableAssertions = true
7474
systemProperty 'java.security.manager', 'kotlinx.coroutines.TestSecurityManager'
75-
exclude '**/*LFTest.*'
75+
exclude '**/*LFStressTest.*'
7676
systemProperty 'kotlinx.coroutines.scheduler.keep.alive.sec', '100000' // any unpark problem hangs test
7777
}
7878

7979
task lockFreedomTest(type: Test, dependsOn: compileTestKotlinJvm) {
8080
classpath = files { jvmTest.classpath }
8181
testClassesDirs = files { jvmTest.testClassesDirs }
82-
include '**/*LFTest.*'
82+
include '**/*LFStressTest.*'
8383
}
8484

8585
task jdk16Test(type: Test, dependsOn: [compileTestKotlinJvm, checkJdk16]) {
8686
classpath = files { jvmTest.classpath }
8787
testClassesDirs = files { jvmTest.testClassesDirs }
8888
executable = "$System.env.JDK_16/bin/java"
89-
exclude '**/*LinearizabilityTest*.*'
90-
exclude '**/*LFTest.*'
91-
exclude '**/exceptions/**'
89+
exclude '**/*LFStressTest.*' // lock-freedom tests use LockFreedomTestEnvironment which needs JDK8
90+
exclude '**/*LCStressTest.*' // lic-check tests use LinChecker which needs JDK8
91+
exclude '**/exceptions/**' // exceptions tests check suppressed exception which needs JDK8
9292
exclude '**/ExceptionsGuideTest.*'
9393
}
9494

kotlinx-coroutines-core/jvm/test/internal/LockFreeLinkedListAtomicStressLFTest.kt renamed to kotlinx-coroutines-core/jvm/test/internal/LockFreeLinkedListAtomicLFStressTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.coroutines.internal
@@ -16,8 +16,8 @@ import java.util.concurrent.atomic.AtomicReference
1616
* This stress test has 4 threads adding randomly to the list and them immediately undoing
1717
* this addition by remove, and 4 threads trying to remove nodes from two lists simultaneously (atomically).
1818
*/
19-
class LockFreeLinkedListAtomicStressLFTest : TestBase() {
20-
private val env = LockFreedomTestEnvironment("LockFreeLinkedListAtomicStressLFTest")
19+
class LockFreeLinkedListAtomicLFStressTest : TestBase() {
20+
private val env = LockFreedomTestEnvironment("LockFreeLinkedListAtomicLFStressTest")
2121

2222
data class IntNode(val i: Int) : LockFreeLinkedListNode()
2323

kotlinx-coroutines-core/jvm/test/internal/SegmentQueueLinearizabilityTest.kt renamed to kotlinx-coroutines-core/jvm/test/internal/SegmentQueueLCStressTest.kt

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
15
package kotlinx.coroutines.internal
26

37
import com.devexperts.dxlab.lincheck.LinChecker
@@ -8,7 +12,7 @@ import com.devexperts.dxlab.lincheck.strategy.stress.StressCTest
812
import org.junit.Test
913

1014
@StressCTest
11-
class SegmentQueueLinearizabilityTest {
15+
class SegmentQueueLCStressTest {
1216
private val q = SegmentBasedQueue<Int>()
1317

1418
@Operation
@@ -21,6 +25,6 @@ class SegmentQueueLinearizabilityTest {
2125

2226
@Test
2327
fun test() {
24-
LinChecker.check(SegmentQueueLinearizabilityTest::class.java)
28+
LinChecker.check(SegmentQueueLCStressTest::class.java)
2529
}
2630
}

kotlinx-coroutines-core/jvm/test/linearizability/ChannelIsClosedLinearizabilityTest.kt renamed to kotlinx-coroutines-core/jvm/test/linearizability/ChannelIsClosedLCStressTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
@file:Suppress("unused")
55

@@ -15,7 +15,7 @@ import org.junit.*
1515
import java.io.*
1616

1717
@Param(name = "value", gen = IntGen::class, conf = "1:3")
18-
class ChannelIsClosedLinearizabilityTest : TestBase() {
18+
class ChannelIsClosedLCStressTest : TestBase() {
1919

2020
private val lt = LinTesting()
2121
private val channel = Channel<Int>()
@@ -49,6 +49,6 @@ class ChannelIsClosedLinearizabilityTest : TestBase() {
4949
.threads(3)
5050
.verifier(LinVerifier::class.java)
5151

52-
LinChecker.check(ChannelIsClosedLinearizabilityTest::class.java, options)
52+
LinChecker.check(ChannelIsClosedLCStressTest::class.java, options)
5353
}
5454
}

kotlinx-coroutines-core/jvm/test/linearizability/ChannelLinearizabilityTest.kt renamed to kotlinx-coroutines-core/jvm/test/linearizability/ChannelLCStressTest.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
@file:Suppress("unused")
55

@@ -15,7 +15,7 @@ import org.junit.*
1515
import java.io.*
1616

1717
@Param(name = "value", gen = IntGen::class, conf = "1:3")
18-
class ChannelLinearizabilityTest : TestBase() {
18+
class ChannelLCStressTest : TestBase() {
1919

2020
private companion object {
2121
// Emulating ctor argument for lincheck
@@ -62,12 +62,12 @@ class ChannelLinearizabilityTest : TestBase() {
6262
fun testUnlimitedChannelLinearizability() = runTest(Channel.UNLIMITED)
6363

6464
private fun runTest(capacity: Int) {
65-
ChannelLinearizabilityTest.capacity = capacity
65+
ChannelLCStressTest.capacity = capacity
6666
val options = StressOptions()
6767
.iterations(50 * stressTestMultiplierSqrt)
6868
.invocationsPerIteration(500 * stressTestMultiplierSqrt)
6969
.threads(3)
7070
.verifier(LinVerifier::class.java)
71-
LinChecker.check(ChannelLinearizabilityTest::class.java, options)
71+
LinChecker.check(ChannelLCStressTest::class.java, options)
7272
}
7373
}

kotlinx-coroutines-core/jvm/test/linearizability/LockFreeListLinearizabilityTest.kt renamed to kotlinx-coroutines-core/jvm/test/linearizability/LockFreeListLCStressTest.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
@file:Suppress("unused")
55

@@ -14,7 +14,7 @@ import kotlinx.coroutines.internal.*
1414
import kotlin.test.*
1515

1616
@Param(name = "value", gen = IntGen::class, conf = "1:3")
17-
class LockFreeListLinearizabilityTest : TestBase() {
17+
class LockFreeListLCStressTest : TestBase() {
1818
class Node(val value: Int): LockFreeLinkedListNode()
1919

2020
private val q: LockFreeLinkedListHead = LockFreeLinkedListHead()
@@ -49,7 +49,7 @@ class LockFreeListLinearizabilityTest : TestBase() {
4949
.iterations(100 * stressTestMultiplierSqrt)
5050
.invocationsPerIteration(1000 * stressTestMultiplierSqrt)
5151
.threads(3)
52-
LinChecker.check(LockFreeListLinearizabilityTest::class.java, options)
52+
LinChecker.check(LockFreeListLCStressTest::class.java, options)
5353
}
5454

5555
private var _curElements: ArrayList<Int>? = null
@@ -62,7 +62,7 @@ class LockFreeListLinearizabilityTest : TestBase() {
6262
}
6363

6464
override fun equals(other: Any?): Boolean {
65-
other as LockFreeListLinearizabilityTest
65+
other as LockFreeListLCStressTest
6666
return curElements == other.curElements
6767
}
6868

kotlinx-coroutines-core/jvm/test/linearizability/LockFreeTaskQueueLinearizabilityTest.kt renamed to kotlinx-coroutines-core/jvm/test/linearizability/LockFreeTaskQueueLCStressTest.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
@file:Suppress("unused")
55

@@ -19,7 +19,7 @@ internal data class Snapshot(val elements: List<Int>, val isClosed: Boolean) {
1919

2020
@OpGroupConfig.OpGroupConfigs(OpGroupConfig(name = "consumer", nonParallel = true))
2121
@Param(name = "value", gen = IntGen::class, conf = "1:3")
22-
class LockFreeTaskQueueLinearizabilityTestSC : LockFreeTaskQueueLinearizabilityTestBase() {
22+
class SCLockFreeTaskQueueLCStressTest : LockFreeTaskQueueLCTestBase() {
2323
private val q: LockFreeTaskQueue<Int> = LockFreeTaskQueue(singleConsumer = true)
2424

2525
@Operation
@@ -42,7 +42,7 @@ class LockFreeTaskQueueLinearizabilityTestSC : LockFreeTaskQueueLinearizabilityT
4242
if (this === other) return true
4343
if (javaClass != other?.javaClass) return false
4444

45-
other as LockFreeTaskQueueLinearizabilityTestSC
45+
other as SCLockFreeTaskQueueLCStressTest
4646

4747
return Snapshot(q) == Snapshot(other.q)
4848
}
@@ -51,7 +51,7 @@ class LockFreeTaskQueueLinearizabilityTestSC : LockFreeTaskQueueLinearizabilityT
5151
}
5252

5353
@Param(name = "value", gen = IntGen::class, conf = "1:3")
54-
class LockFreeTaskQueueLinearizabilityTestMC : LockFreeTaskQueueLinearizabilityTestBase() {
54+
class MCLockFreeTaskQueueLCStressTest : LockFreeTaskQueueLCTestBase() {
5555
private val q: LockFreeTaskQueue<Int> = LockFreeTaskQueue(singleConsumer = false)
5656

5757
@Operation
@@ -74,15 +74,15 @@ class LockFreeTaskQueueLinearizabilityTestMC : LockFreeTaskQueueLinearizabilityT
7474
if (this === other) return true
7575
if (javaClass != other?.javaClass) return false
7676

77-
other as LockFreeTaskQueueLinearizabilityTestMC
77+
other as MCLockFreeTaskQueueLCStressTest
7878

7979
return Snapshot(q) == Snapshot(other.q)
8080
}
8181

8282
override fun hashCode(): Int = Snapshot(q).hashCode()
8383
}
8484

85-
open class LockFreeTaskQueueLinearizabilityTestBase : TestBase() {
85+
open class LockFreeTaskQueueLCTestBase : TestBase() {
8686
fun linTest() {
8787
val options = StressOptions()
8888
.iterations(100 * stressTestMultiplierSqrt)

0 commit comments

Comments
 (0)