-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the model checking mode in Lincheck tests (#2326)
* Add the model checking mode to Lincheck tests and use a newer and faster version of it Co-authored-by: Roman Elizarov <elizarov@gmail.com>
- Loading branch information
Showing
16 changed files
with
197 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
package kotlinx.coroutines | ||
|
||
import org.jetbrains.kotlinx.lincheck.* | ||
import org.jetbrains.kotlinx.lincheck.strategy.managed.modelchecking.* | ||
import org.jetbrains.kotlinx.lincheck.strategy.stress.* | ||
import org.jetbrains.kotlinx.lincheck.verifier.* | ||
import org.junit.* | ||
|
||
abstract class AbstractLincheckTest : VerifierState() { | ||
open fun <O: Options<O, *>> O.customize(isStressTest: Boolean): O = this | ||
open fun ModelCheckingOptions.customize(isStressTest: Boolean): ModelCheckingOptions = this | ||
open fun StressOptions.customize(isStressTest: Boolean): StressOptions = this | ||
|
||
@Test | ||
fun modelCheckingTest() = ModelCheckingOptions() | ||
.iterations(if (isStressTest) 100 else 20) | ||
.invocationsPerIteration(if (isStressTest) 10_000 else 1_000) | ||
.commonConfiguration() | ||
.customize(isStressTest) | ||
.check(this::class) | ||
|
||
@Test | ||
fun stressTest() = StressOptions() | ||
.iterations(if (isStressTest) 100 else 20) | ||
.invocationsPerIteration(if (isStressTest) 10_000 else 1_000) | ||
.commonConfiguration() | ||
.customize(isStressTest) | ||
.check(this::class) | ||
|
||
private fun <O : Options<O, *>> O.commonConfiguration(): O = this | ||
.actorsBefore(if (isStressTest) 3 else 1) | ||
.threads(3) | ||
.actorsPerThread(if (isStressTest) 4 else 2) | ||
.actorsAfter(if (isStressTest) 3 else 0) | ||
.customize(isStressTest) | ||
|
||
override fun extractState(): Any = error("Not implemented") | ||
} |
20 changes: 0 additions & 20 deletions
20
kotlinx-coroutines-core/jvm/test/LCStressOptionsDefault.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.