You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the features of Lincheck framework is the concurrent code model checker.
Currently the model checker functionality in Lincheck is toughly coupled with the Lincheck's data structures testing API.
This approach has its benefits: it provides a convenient end-to-end testing experience for users who want to test their concurrent data structures. However, for some use cases it is less convenient: sometimes users just want to run a piece of concurrent code in a model checking mode, exploring different possible interleavings.
Some examples of code that cannot be easily tested currently with Lincheck are thread pool implementations, parallel executors, coroutine schedulers, etc.
We aim to provide a simpler API to run model checker on an arbitrary code snippet (subject to a few constraints).
Overview of the API
Here is how the current data structures model checking API looks like:
classCounter {
@Volatile
privatevar value =0funinc(): Int=++value
funget() = value
}
classBasicCounterTest {
// Initial stateprivateval c =Counter()
// Operations on the Counter
@Operation
funinc() = c.inc()
@Operation
funget() = c.get()
// Test set-up
@Test
funmodelCheckingTest() =ModelCheckingOptions()().check(this::class)
}
Here is how a concrete test for the counter with the general-purpose model checking API would look like:
classBasicCounterTest {
@Test
funmodelCheckingTest() = runWithModelChecker(invocations =100) {
val c =Counter()
val t1 = thread {
c.inc()
}
val t2 = thread {
c.inc()
}
t1.join()
t2.join()
check(c.get() ==2)
}
}
The concrete API is under discussion, but the general idea should stay the same.
The text was updated successfully, but these errors were encountered:
There is a soft dependency on #387 : until we implement it, it would be possible to test only single threaded code (useless). But we still can start prototyping and developing this feature independently, and then merge with the custom threads support.
One of the features of Lincheck framework is the concurrent code model checker.
Currently the model checker functionality in Lincheck is toughly coupled with the Lincheck's data structures testing API.
This approach has its benefits: it provides a convenient end-to-end testing experience for users who want to test their concurrent data structures. However, for some use cases it is less convenient: sometimes users just want to run a piece of concurrent code in a model checking mode, exploring different possible interleavings.
Some examples of code that cannot be easily tested currently with Lincheck are thread pool implementations, parallel executors, coroutine schedulers, etc.
We aim to provide a simpler API to run model checker on an arbitrary code snippet (subject to a few constraints).
Overview of the API
Here is how the current data structures model checking API looks like:
Here is how a concrete test for the counter with the general-purpose model checking API would look like:
The concrete API is under discussion, but the general idea should stay the same.
The text was updated successfully, but these errors were encountered: