-
Notifications
You must be signed in to change notification settings - Fork 34
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
API for the general-purpose model checker #411
base: develop
Are you sure you want to change the base?
Conversation
@dmitrii-artuhov thanks for the PR. |
), | ||
emptyList(), | ||
null | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use CustomScenarioDSL.kt
instead.
|
||
val result = strategy.runInvocation() | ||
val failure = strategy.verify(result, verifier) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why so many empty lines for just a few lines of code ?)
|
||
object Lincheck { | ||
@JvmStatic | ||
fun <R> verifyWithModelChecker( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a kdoc explaining the usage of this function. In particular, mention that this function looks for exceptions being thrown inside the user provided lambda block
.
} | ||
|
||
return null | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests for this function.
For start, add few tests in representation
sub-module and check that the trace is correctly collected.
withLincheckJavaAgent(testCfg.instrumentationMode) { | ||
val strategy = testCfg.createStrategy(Wrapper::class.java, scenario, null, null) | ||
val verifier = testCfg.createVerifier() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I think somewhere here you need to enforce the bytecode transformation of the block::class.java
(i.e. the class of the passed lambda). Otherwise the events inside the lambda would not be tracked.
I think once you'll add the tests you will see the problem.
private class ExecutionExceptionsVerifier(@Suppress("UNUSED_PARAMETER") sequentialSpecification: Class<*>) : Verifier { | ||
override fun verifyResults(scenario: ExecutionScenario?, results: ExecutionResult?): Boolean { | ||
if (results == null) return true | ||
// User `check(...)`'s will fail and put their exceptions as an execution result, we must track that and disallow such outcomes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this explanation to the kdoc of ExecutionExceptionsVerifier
.
No description provided.