Skip to content

Commit

Permalink
upgrade linearization analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed May 18, 2024
1 parent 06a7392 commit 2db5b69
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 26 deletions.
5 changes: 0 additions & 5 deletions caffeine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ tasks.register<Test>("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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* This test requires the following JVM arguments,
* <ul>
* <li>--add-opens java.base/jdk.internal.misc=ALL-UNNAMED
* <li>--add-exports java.base/jdk.internal.util=ALL-UNNAMED
* </ul>
*/
@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. */
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -51,21 +53,14 @@ public AbstractLincheckCacheTest(Caffeine<Object, Object> 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.
* <p>
* This test requires the following JVM arguments,
* <ul>
* <li>--add-opens java.base/jdk.internal.vm=ALL-UNNAMED
* <li>--add-opens java.base/jdk.internal.misc=ALL-UNNAMED
* <li>--add-opens java.base/jdk.internal.access=ALL-UNNAMED
* <li>--add-exports java.base/jdk.internal.util=ALL-UNNAMED
* </ul>
*/
@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. */
Expand All @@ -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 --------------- */
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 2db5b69

Please sign in to comment.