-
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. |
9e0d1fa
to
426aa8a
Compare
src/jvm/main/org/jetbrains/kotlinx/lincheck/CTestConfiguration.kt
Outdated
Show resolved
Hide resolved
...rg/jetbrains/kotlinx/lincheck_test/representation/AtomicReferencesNamesRunWithLambdaTests.kt
Outdated
Show resolved
Hide resolved
...11/org/jetbrains/kotlinx/lincheck_test/representation/BaseRunWithLambdaRepresentationTest.kt
Outdated
Show resolved
Hide resolved
...11/org/jetbrains/kotlinx/lincheck_test/representation/BaseRunWithLambdaRepresentationTest.kt
Outdated
Show resolved
Hide resolved
* @param block lambda which body will be a target for the interleavings exploration. | ||
*/ | ||
@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.
As discussed with @ndkoval .
For now, lets rename this function into runConcurrentTest
, and make it top-level function (no Lincheck
object needed). This is not a final name, we will discuss API of this function (including its name) in more detail before public release of this feature.
} | ||
failure.checkLincheckOutput(outputFileName) | ||
} | ||
} |
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.
There are also tests in CustomThreadsRepresentationTest.kt
file that I have added when I was working on supporting custom threads. Could you please move them in this file, rewrite them to use verifyWithModelChecker
function and check that they would still work?
…yWithModelChecking' call
91168ea
to
0c0e25c
Compare
@eupp I added the |
Let's please revert this change. The API should be as simple as it could be, that is the point why we adding it. It should only take the lambda to run and that's it.
To make the test work with only the lambda, please remove any state of the test class by either:
Use one method or another, depending on which makes more sense for a particular test. This way we will eliminate any "external" state outside lambda (except static state, but it will be handled by the snapshot tracker). In general, there is indeed a problem here --- the problem is that the lambda that we pass to the model checker should not capture any state, in order to be deterministically reproducible. One of possible solutions is similar to what you propose --- to force the user to explicitly mention all captured objects as method parameters. But we need to discuss this solution and how to express it in the API in more detail before implementing it. |
Description:
PR adds function for running lincheck model checker algorithm on arbitrary code via lambda body.
Usage example:
Additional improvements to the PR:
runConcurrentTest
when it is used from java #445runConcurrentTest
throwAssertionError
instead of returning it