From d78573ac08b77ac26cce7676cd8661d69b817bc0 Mon Sep 17 00:00:00 2001 From: Nikita Koval Date: Tue, 18 Apr 2023 20:15:07 +0200 Subject: [PATCH] Bump Lincheck version to 2.17 Signed-off-by: Nikita Koval --- gradle.properties | 2 +- kotlinx-coroutines-core/jvm/test/AbstractLincheckTest.kt | 4 +--- .../jvm/test/internal/OnDemandAllocatingPoolLincheckTest.kt | 2 -- .../jvm/test/lincheck/ChannelsLincheckTest.kt | 5 +---- .../jvm/test/lincheck/LockFreeTaskQueueLincheckTest.kt | 5 +---- .../jvm/test/lincheck/MutexLincheckTest.kt | 3 --- .../jvm/test/lincheck/ResizableAtomicArrayLincheckTest.kt | 5 +---- .../jvm/test/lincheck/SemaphoreLincheckTest.kt | 2 -- 8 files changed, 5 insertions(+), 23 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2dbb8ad5d0..67cd7b4602 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ junit5_version=5.7.0 atomicfu_version=0.20.2 knit_version=0.4.0 html_version=0.7.2 -lincheck_version=2.16 +lincheck_version=2.17 dokka_version=1.8.10 byte_buddy_version=1.10.9 reactor_version=3.4.1 diff --git a/kotlinx-coroutines-core/jvm/test/AbstractLincheckTest.kt b/kotlinx-coroutines-core/jvm/test/AbstractLincheckTest.kt index bdb615d83c..da73ca6220 100644 --- a/kotlinx-coroutines-core/jvm/test/AbstractLincheckTest.kt +++ b/kotlinx-coroutines-core/jvm/test/AbstractLincheckTest.kt @@ -9,7 +9,7 @@ import org.jetbrains.kotlinx.lincheck.strategy.stress.* import org.jetbrains.kotlinx.lincheck.verifier.* import org.junit.* -abstract class AbstractLincheckTest : VerifierState() { +abstract class AbstractLincheckTest { open fun > O.customize(isStressTest: Boolean): O = this open fun ModelCheckingOptions.customize(isStressTest: Boolean): ModelCheckingOptions = this open fun StressOptions.customize(isStressTest: Boolean): StressOptions = this @@ -41,6 +41,4 @@ abstract class AbstractLincheckTest : VerifierState() { .actorsPerThread(if (isStressTest) 3 else 2) .actorsAfter(if (isStressTest) 3 else 0) .customize(isStressTest) - - override fun extractState(): Any = error("Not implemented") } diff --git a/kotlinx-coroutines-core/jvm/test/internal/OnDemandAllocatingPoolLincheckTest.kt b/kotlinx-coroutines-core/jvm/test/internal/OnDemandAllocatingPoolLincheckTest.kt index de9ab8d5cd..9655890c4f 100644 --- a/kotlinx-coroutines-core/jvm/test/internal/OnDemandAllocatingPoolLincheckTest.kt +++ b/kotlinx-coroutines-core/jvm/test/internal/OnDemandAllocatingPoolLincheckTest.kt @@ -27,8 +27,6 @@ abstract class OnDemandAllocatingPoolLincheckTest(maxCapacity: Int) : AbstractLi @Operation fun close(): String = pool.close().sorted().toString() - - override fun extractState(): Any = pool.stateRepresentation() } abstract class OnDemandAllocatingSequentialPool(private val maxCapacity: Int) { diff --git a/kotlinx-coroutines-core/jvm/test/lincheck/ChannelsLincheckTest.kt b/kotlinx-coroutines-core/jvm/test/lincheck/ChannelsLincheckTest.kt index 87ed74b715..092ef6fc52 100644 --- a/kotlinx-coroutines-core/jvm/test/lincheck/ChannelsLincheckTest.kt +++ b/kotlinx-coroutines-core/jvm/test/lincheck/ChannelsLincheckTest.kt @@ -16,7 +16,6 @@ import org.jetbrains.kotlinx.lincheck.annotations.* import org.jetbrains.kotlinx.lincheck.annotations.Operation import org.jetbrains.kotlinx.lincheck.paramgen.* import org.jetbrains.kotlinx.lincheck.strategy.managed.modelchecking.* -import org.jetbrains.kotlinx.lincheck.verifier.* class RendezvousChannelLincheckTest : ChannelLincheckTestBaseWithOnSend( c = Channel(RENDEZVOUS), @@ -176,7 +175,7 @@ private class NumberedCancellationException(number: Int) : CancellationException } -abstract class SequentialIntChannelBase(private val capacity: Int) : VerifierState() { +abstract class SequentialIntChannelBase(private val capacity: Int) { private val senders = ArrayList, Int>>() private val receivers = ArrayList>() private val buffer = ArrayList() @@ -266,8 +265,6 @@ abstract class SequentialIntChannelBase(private val capacity: Int) : VerifierSta if (closedMessage !== null) return false return buffer.isEmpty() && senders.isEmpty() } - - override fun extractState() = buffer to closedMessage } private fun CancellableContinuation.resume(res: T): Boolean { diff --git a/kotlinx-coroutines-core/jvm/test/lincheck/LockFreeTaskQueueLincheckTest.kt b/kotlinx-coroutines-core/jvm/test/lincheck/LockFreeTaskQueueLincheckTest.kt index 2a9164e1d7..11f5535b5a 100644 --- a/kotlinx-coroutines-core/jvm/test/lincheck/LockFreeTaskQueueLincheckTest.kt +++ b/kotlinx-coroutines-core/jvm/test/lincheck/LockFreeTaskQueueLincheckTest.kt @@ -30,8 +30,6 @@ internal abstract class AbstractLockFreeTaskQueueWithoutRemoveLincheckTest( override fun > O.customize(isStressTest: Boolean): O = verifier(QuiescentConsistencyVerifier::class.java) - override fun extractState() = q.map { it } to q.isClosed() - override fun ModelCheckingOptions.customize(isStressTest: Boolean) = checkObstructionFreedom() } @@ -42,9 +40,8 @@ internal class MCLockFreeTaskQueueWithRemoveLincheckTest : AbstractLockFreeTaskQ fun removeFirstOrNull() = q.removeFirstOrNull() } -@OpGroupConfig(name = "consumer", nonParallel = true) internal class SCLockFreeTaskQueueWithRemoveLincheckTest : AbstractLockFreeTaskQueueWithoutRemoveLincheckTest(singleConsumer = true) { @QuiescentConsistent - @Operation(group = "consumer") + @Operation(nonParallelGroup = "consumer") fun removeFirstOrNull() = q.removeFirstOrNull() } \ No newline at end of file diff --git a/kotlinx-coroutines-core/jvm/test/lincheck/MutexLincheckTest.kt b/kotlinx-coroutines-core/jvm/test/lincheck/MutexLincheckTest.kt index 6fd28e424e..983a64acda 100644 --- a/kotlinx-coroutines-core/jvm/test/lincheck/MutexLincheckTest.kt +++ b/kotlinx-coroutines-core/jvm/test/lincheck/MutexLincheckTest.kt @@ -40,8 +40,5 @@ class MutexLincheckTest : AbstractLincheckTest() { override fun > O.customize(isStressTest: Boolean): O = actorsBefore(0) - // state[i] == true <=> mutex.holdsLock(i) with the only exception for 0 that specifies `null`. - override fun extractState() = (1..2).map { mutex.holdsLock(it) } + mutex.isLocked - private val Int.asOwnerOrNull get() = if (this == 0) null else this } diff --git a/kotlinx-coroutines-core/jvm/test/lincheck/ResizableAtomicArrayLincheckTest.kt b/kotlinx-coroutines-core/jvm/test/lincheck/ResizableAtomicArrayLincheckTest.kt index 1948a78ecc..e937b37e08 100644 --- a/kotlinx-coroutines-core/jvm/test/lincheck/ResizableAtomicArrayLincheckTest.kt +++ b/kotlinx-coroutines-core/jvm/test/lincheck/ResizableAtomicArrayLincheckTest.kt @@ -11,17 +11,14 @@ import org.jetbrains.kotlinx.lincheck.paramgen.* @Param(name = "index", gen = IntGen::class, conf = "0:4") @Param(name = "value", gen = IntGen::class, conf = "1:5") -@OpGroupConfig(name = "sync", nonParallel = true) class ResizableAtomicArrayLincheckTest : AbstractLincheckTest() { private val a = ResizableAtomicArray(2) @Operation fun get(@Param(name = "index") index: Int): Int? = a[index] - @Operation(group = "sync") + @Operation(nonParallelGroup = "writer") fun set(@Param(name = "index") index: Int, @Param(name = "value") value: Int) { a.setSynchronized(index, value) } - - override fun extractState() = (0..4).map { a[it] } } \ No newline at end of file diff --git a/kotlinx-coroutines-core/jvm/test/lincheck/SemaphoreLincheckTest.kt b/kotlinx-coroutines-core/jvm/test/lincheck/SemaphoreLincheckTest.kt index 09dee56c51..d093e8066a 100644 --- a/kotlinx-coroutines-core/jvm/test/lincheck/SemaphoreLincheckTest.kt +++ b/kotlinx-coroutines-core/jvm/test/lincheck/SemaphoreLincheckTest.kt @@ -25,8 +25,6 @@ abstract class SemaphoreLincheckTestBase(permits: Int) : AbstractLincheckTest() override fun > O.customize(isStressTest: Boolean): O = actorsBefore(0) - override fun extractState() = semaphore.availablePermits - override fun ModelCheckingOptions.customize(isStressTest: Boolean) = checkObstructionFreedom() }