-
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 ?)
} | ||
|
||
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.
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
.
9e0d1fa
to
426aa8a
Compare
* @param invocations number of different interleavings of code in the [block] | ||
* that should be explored. | ||
* @param block lambda which body will be a target for the interleavings exploration. | ||
*/ |
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.
/**
* This method will explore different interleavings of the [block] body and all the threads created within it, searching for the first raised exception.
*
* @param invocations number of different interleavings of code in the [block] that should be explored.
* @param block lambda which body will be a target for the interleavings exploration.
*/
@@ -48,6 +48,8 @@ abstract class CTestConfiguration( | |||
stateRepresentationMethod: Method? | |||
): Strategy | |||
|
|||
fun createVerifier() = verifierClass.getConstructor(Class::class.java).newInstance(sequentialSpecification) |
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 make this an extension function, as it was before.
@JvmStatic | ||
fun <R> verifyWithModelChecker( | ||
invocations: Int = ManagedCTestConfiguration.DEFAULT_INVOCATIONS, | ||
verifierClass: Class<out Verifier>? = 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.
Let's not expose the verifier in the API of this function.
import java.util.concurrent.atomic.AtomicReference | ||
import java.util.concurrent.atomic.AtomicReferenceArray | ||
|
||
class AtomicReferencesNamesRunWithLambdaTests : BaseRunWithLambdaRepresentationTest("atomic_references_names_trace_run_with_lambda.txt") { |
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 shorten the names of the .txt
files
* Implement me and place the logic to check its trace. | ||
*/ | ||
@Operation | ||
abstract fun operation() |
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.
Let's rename to block
. Also, you don't need @Operation
annotation for this new API.
} | ||
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.
Let's put all the new tests together into singe file RunWithLambdaRepresentationTests
.
No description provided.