Skip to content
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

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

dmitrii-artuhov
Copy link
Collaborator

No description provided.

@dmitrii-artuhov dmitrii-artuhov requested a review from eupp October 7, 2024 14:04
@dmitrii-artuhov dmitrii-artuhov self-assigned this Oct 7, 2024
@dmitrii-artuhov dmitrii-artuhov marked this pull request as draft October 7, 2024 14:04
@eupp
Copy link
Collaborator

eupp commented Oct 7, 2024

@dmitrii-artuhov thanks for the PR.
Could you please repair the CI before we start reviewing this.

@dmitrii-artuhov dmitrii-artuhov changed the title [Draft] Lincheck new API function Lincheck new API function Oct 17, 2024
@ndkoval ndkoval changed the title Lincheck new API function API for the general-purpose model checker Nov 25, 2024
),
emptyList(),
null
)
Copy link
Collaborator

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)

Copy link
Collaborator

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(
Copy link
Collaborator

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
}
Copy link
Collaborator

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()

Copy link
Collaborator

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.
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants