Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Moiseenko <[email protected]>
  • Loading branch information
eupp committed Jan 24, 2025
1 parent d2ec545 commit 5ef8842
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/jvm/main/org/jetbrains/kotlinx/lincheck/Lincheck.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
package org.jetbrains.kotlinx.lincheck

import org.jetbrains.kotlinx.lincheck.execution.*
import org.jetbrains.kotlinx.lincheck.strategy.runIteration
import org.jetbrains.kotlinx.lincheck.strategy.managed.modelchecking.ModelCheckingOptions
import org.jetbrains.kotlinx.lincheck.transformation.LincheckJavaAgent.ensureObjectIsTransformed
import org.jetbrains.kotlinx.lincheck.transformation.withLincheckJavaAgent
import org.jetbrains.kotlinx.lincheck.verifier.Verifier
import org.jetbrains.kotlinx.lincheck.strategy.verify


@RequiresOptIn(message = "The model checking API is experimental and could change in the future.")
Expand Down Expand Up @@ -48,21 +48,13 @@ fun <R> runConcurrentTest(
.verifier(NoExceptionVerifier::class.java)

val testCfg = options.createTestConfigurations(GeneralPurposeModelCheckingWrapper::class.java)

withLincheckJavaAgent(testCfg.instrumentationMode) {
ensureObjectIsTransformed(block)
val strategy = testCfg.createStrategy(GeneralPurposeModelCheckingWrapper::class.java, scenario, null, null)
val verifier = testCfg.createVerifier()

for (i in 1..invocations) {
if (!strategy.nextInvocation()) {
break
}
val result = strategy.runInvocation()
val failure = strategy.verify(result, verifier)
if (failure != null) {
throw LincheckAssertionError(failure)
}
val failure = strategy.runIteration(invocations, verifier)
if (failure != null) {
throw LincheckAssertionError(failure)
}
}
}
Expand Down

0 comments on commit 5ef8842

Please sign in to comment.