diff --git a/caffeine/build.gradle.kts b/caffeine/build.gradle.kts index 05053dc8db..de5bf107a6 100644 --- a/caffeine/build.gradle.kts +++ b/caffeine/build.gradle.kts @@ -149,11 +149,6 @@ tasks.register("lincheckTest") { description = "Tests that assert linearizability" enabled = (System.getenv("JDK_EA") != "true") useTestNG { - jvmArgs( - "--add-opens", "java.base/jdk.internal.vm=ALL-UNNAMED", - "--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED", - "--add-opens", "java.base/jdk.internal.access=ALL-UNNAMED", - "--add-exports", "java.base/jdk.internal.util=ALL-UNNAMED") testLogging.events("started") includeGroups("lincheck") maxHeapSize = "3g" diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/MpscGrowableArrayQueueLincheckTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/MpscGrowableArrayQueueLincheckTest.java index aeceaf90c1..51c1dae533 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/MpscGrowableArrayQueueLincheckTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/MpscGrowableArrayQueueLincheckTest.java @@ -53,19 +53,13 @@ public Integer poll() { * stress testing, this approach can also provide a trace of an incorrect execution. However, it * uses sequential consistency model, so it can not find any low-level bugs (e.g., missing * 'volatile'), and thus, it is recommended to have both test modes. - *

- * This test requires the following JVM arguments, - *

*/ @Test(groups = "lincheck") public void modelCheckingTest() { var options = new ModelCheckingOptions() .iterations(100) // the number of different scenarios .invocationsPerIteration(10_000); // how deeply each scenario is tested - new LinChecker(getClass(), options).check(); + LinChecker.check(getClass(), options); } /** This test checks that the concurrent queue is linearizable with stress testing. */ @@ -74,6 +68,6 @@ public void stressTest() { var options = new StressOptions() .iterations(100) // the number of different scenarios .invocationsPerIteration(10_000); // how deeply each scenario is tested - new LinChecker(getClass(), options).check(); + LinChecker.check(getClass(), options); } } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/lincheck/AbstractLincheckCacheTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/lincheck/AbstractLincheckCacheTest.java index ce643b398c..46a266ce12 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/lincheck/AbstractLincheckCacheTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/lincheck/AbstractLincheckCacheTest.java @@ -15,6 +15,8 @@ */ package com.github.benmanes.caffeine.lincheck; +import static org.jetbrains.kotlinx.lincheck.strategy.managed.ManagedCTestConfiguration.DEFAULT_HANGING_DETECTION_THRESHOLD; + import java.util.Map; import org.jetbrains.kotlinx.lincheck.LinChecker; @@ -51,21 +53,14 @@ public AbstractLincheckCacheTest(Caffeine builder) { * approach can also provide a trace of an incorrect execution. However, it uses sequential * consistency model, so it can not find any low-level bugs (e.g., missing 'volatile'), and thus, * it is recommended to have both test modes. - *

- * This test requires the following JVM arguments, - *

*/ @Test(groups = "lincheck") public void modelCheckingTest() { var options = new ModelCheckingOptions() - .iterations(100) // the number of different scenarios - .invocationsPerIteration(1_000); // how deeply each scenario is tested - new LinChecker(getClass(), options).check(); + .iterations(100) // the number of different scenarios + .invocationsPerIteration(1_000) // how deeply each scenario is tested + .hangingDetectionThreshold(5 * DEFAULT_HANGING_DETECTION_THRESHOLD); + LinChecker.check(getClass(), options); } /** This test checks linearizability with stress testing. */ @@ -74,7 +69,7 @@ public void stressTest() { var options = new StressOptions() .iterations(100) // the number of different scenarios .invocationsPerIteration(10_000); // how deeply each scenario is tested - new LinChecker(getClass(), options).check(); + LinChecker.check(getClass(), options); } /* --------------- Cache --------------- */ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 37a73c9b97..5d16490a3c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -65,7 +65,7 @@ junit4 = "4.13.2" junit5 = "5.11.0-M2" jvm-dependency-conflict-resolution = "2.0" kotlin = "1.9.24" -lincheck = "2.29" +lincheck = "2.32" mockito = "5.12.0" nexus-publish = "2.0.0" nullaway-core = "0.10.26"