Closed kderme closed 5 years ago
Most of the times, it successfully shrinks
+++ OK, failed as expected. Falsifiable (after 16 tests and 12 shrinks):
ParallelCommands
{ prefix =
Commands
{ unCommands =
[ Command Create (Created (Reference (Symbolic (Var 0)))) [ Var 0 ]
]
}
, suffixes =
[ [ Commands
{ unCommands =
[ Command (Increment (Reference (Symbolic (Var 0)))) Incremented []
, Command (Read (Reference (Symbolic (Var 0)))) (ReadValue 1) []
]
}
, Commands
{ unCommands =
[ Command (Write (Reference (Symbolic (Var 0))) 2) Written [] ]
}
]
]
}
review mostly addressed and added new examples. At the new examples the bug never appears, only on MemoryReference.
At the new examples the bug never appears, only on MemoryReference
The bug is probably related to references. Neither the echo nor ticket dispenser examples use references. The error encountered example does use them, but it also shortcuts generation quite early due to the ErrorEncountered
state, which perhaps makes the bug manifest itself less often.
@stevana I found some time to fix this bug. The issue was that it's possible to shrink to less threads than initially specified, so you could end up with a suffix which is an empty list. In my generalisation, I use mconcat to combine the resulting environments of each thread, but when the list is empty, mconcat gives an empty environment, which later resulted in EnvironmentValueNotFound
when the next suffix was executed,
Regarding optimisation: there's a section called "Parallelism in test cases" in the paper Finding Race Conditions in Erlang with QuickCheck and PULSE that contains some useful analysis.
Their setting is slightly different than ours though, as we execute batches of commands in parallel, then synchronise...
Regarding visualisation: perhaps it's easier to use/read graphviz (dot) instead of ASCII?
Examples:
Regarding visualisation: perhaps it's easier to use/read graphviz (dot) instead of ASCII?
Examples:
Agree ASCII gets messed up sometimes.
First commit is the one from here https://github.com/advancedtelematic/quickcheck-state-machine/pull/315 (Ci fails, but I think this is because some test takes too long..). Also shrinking properties are now added.
I agree that visualising counterexamples for N-parallel programs can be a separate PR.
Closed in favor of https://github.com/advancedtelematic/quickcheck-state-machine/pull/324
This pr is WIP. Related issue https://github.com/advancedtelematic/quickcheck-state-machine/issues/15 So far Parallel Commands were executed by 2 threads. In this Pr I generalize this: each suffix, instead of a Pair of
Commands
is now a list ofCommands
and each thread executes one of them.Things TODO/future improvements:
toBoxDrawings
). Edit: We decided to use dot. Maybe on some different pr? Issue created: https://github.com/advancedtelematic/quickcheck-state-machine/issues/316About the BUG (Edit: Fixed):
The bug is on shrinking, probably at
shrinkAndValidateGeneralParallel
, somewhere in the combination of environments (I have left a comment in code). The bug some times appears, when I run prop_general_parallel of MemoryReference, with 2,3 or 4 threads and a Race Bug:The test seems to succeed (or maybe fail as expected), but it fails for the wrong reason. I am not quite sure why the example above throws the
EnvironmentValueNotFound
, I need to dig a bit deeper.(By the way these kind of false positives makes me think
expectFailure
should fail in such cases, something you mention there https://github.com/nick8325/quickcheck/issues/230)