Skip to content

Commit 0a76a08

Browse files
committed
Change the LincheckTest mask to include the new test
1 parent 483aeb1 commit 0a76a08

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

kotlinx-coroutines-core/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ jvmTest {
185185
}
186186
// 'stress' is required to be able to run all subpackage tests like ":jvmTests --tests "*channels*" -Pstress=true"
187187
if (!Idea.active && rootProject.properties['stress'] == null) {
188-
exclude '**/*LincheckTest.*'
188+
exclude '**/*LincheckTest*'
189189
exclude '**/*StressTest.*'
190190
}
191191
if (Idea.active) {
@@ -229,7 +229,7 @@ task jvmStressTest(type: Test, dependsOn: compileTestKotlinJvm) {
229229
task jvmLincheckTest(type: Test, dependsOn: compileTestKotlinJvm) {
230230
classpath = files { jvmTest.classpath }
231231
testClassesDirs = files { jvmTest.testClassesDirs }
232-
include '**/*LincheckTest.*'
232+
include '**/*LincheckTest*'
233233
enableAssertions = true
234234
testLogging.showStandardStreams = true
235235
configureJvmForLincheck(jvmLincheckTest)

kotlinx-coroutines-core/common/src/internal/OnDemandAllocatingPool.kt

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ internal class OnDemandAllocatingPool<T>(
4141
* Returns `false` if the pool is closed.
4242
*
4343
* Note that it will still return `true` even if an element was not created due to reaching [maxCapacity].
44+
*
45+
* Rethrows the exceptions thrown from [create]. In this case, this operation has no effect.
4446
*/
4547
fun allocate(): Boolean {
4648
controlState.loop { ctl ->
@@ -67,7 +69,7 @@ internal class OnDemandAllocatingPool<T>(
6769
*/
6870
fun close(): List<T> {
6971
val elementsExisting = tryForbidNewElements()
70-
val result = (0 until elementsExisting).map { i ->
72+
return (0 until elementsExisting).map { i ->
7173
// we wait for the element to be created, because we know that eventually it is going to be there
7274
loop {
7375
val element = elements[i].getAndSet(null)
@@ -76,14 +78,13 @@ internal class OnDemandAllocatingPool<T>(
7678
}
7779
}
7880
}
79-
return result
8081
}
8182

8283
// for tests
8384
internal fun stateRepresentation(): String {
8485
val ctl = controlState.value
8586
val elementsStr = (0 until (ctl and IS_CLOSED_MASK.inv())).map { elements[it].value }.toString()
86-
val closedStr = if (ctl and IS_CLOSED_MASK != 0) "[closed]" else ""
87+
val closedStr = if (ctl.isClosed()) "[closed]" else ""
8788
return elementsStr + closedStr
8889
}
8990

kotlinx-coroutines-core/jvm/test/internal/OnDemandAllocatingPoolLincheckTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ abstract class OnDemandAllocatingSequentialPool(private val maxCapacity: Int) {
5252
}.sorted().toString()
5353
}
5454

55-
class OnDemandAllocatingPoolLincheckTest3 : OnDemandAllocatingPoolLincheckTest(3) {
55+
class OnDemandAllocatingPool3LincheckTest : OnDemandAllocatingPoolLincheckTest(3) {
5656
override fun <O : Options<O, *>> O.customize(isStressTest: Boolean): O =
5757
this.sequentialSpecification(OnDemandAllocatingSequentialPool3::class.java)
5858
}

0 commit comments

Comments
 (0)