Skip to content

Pass whether Lincheck is in the trace debugger mode to the plugin #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/jvm/main/org/jetbrains/kotlinx/lincheck/IdeaPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fun testFailed(
version: String?,
minimalPluginVersion: String,
exceptions: Array<String>,
isGeneralPurposeModelChecking: Boolean,
executionMode: String
) {}


Expand Down Expand Up @@ -159,7 +159,7 @@ internal fun ManagedStrategy.runReplayIfPluginEnabled(failure: LincheckFailure)
version = lincheckVersion,
minimalPluginVersion = MINIMAL_PLUGIN_VERSION,
exceptions = exceptionsRepresentation,
isGeneralPurposeModelChecking = isGeneralPurposeModelChecking,
executionMode = executionMode.toString()
)
// Replay execution while it's needed.
do {
Expand Down Expand Up @@ -348,7 +348,7 @@ private data class ExceptionProcessingResult(
* Used to collect the data about the test instance, object numbers, threads, and continuations.
*/
private fun visualize(strategy: ManagedStrategy) = runCatching {
if (strategy.isGeneralPurposeModelChecking) return@runCatching
if (strategy.executionMode == ExecutionMode.GENERAL_PURPOSE_MODEL_CHECKER) return@runCatching

val runner = strategy.runner as ParallelThreadsRunner
val allThreads = strategy.getRegisteredThreads()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ abstract class ManagedStrategy(
private val testCfg: ManagedCTestConfiguration,
) : Strategy(scenario), EventTracker {

val isGeneralPurposeModelChecking = testClass == GeneralPurposeModelCheckingWrapper::class.java
val executionMode: ExecutionMode =
when {
testClass == GeneralPurposeModelCheckingWrapper::class.java -> ExecutionMode.GENERAL_PURPOSE_MODEL_CHECKER
isInTraceDebuggerMode -> ExecutionMode.TRACE_DEBUGGER
else -> ExecutionMode.REGULAR
}

// The flag to enable IntelliJ IDEA plugin mode
var inIdeaPluginReplayMode: Boolean = false
Expand Down Expand Up @@ -2082,6 +2087,12 @@ private val BlockingReason.obstructionFreedomViolationMessage: String get() = wh
is BlockingReason.Suspended -> OBSTRUCTION_FREEDOM_SUSPEND_VIOLATION_MESSAGE
}

enum class ExecutionMode {
REGULAR,
GENERAL_PURPOSE_MODEL_CHECKER,
TRACE_DEBUGGER
}

private const val OBSTRUCTION_FREEDOM_SPINLOCK_VIOLATION_MESSAGE =
"The algorithm should be non-blocking, but an active lock is detected"

Expand Down