advancedtelematic / quickcheck-state-machine

Test monadic programs using state machine based models
Other
203 stars 25 forks source link

Don't catch async exceptions #320

Closed kderme closed 5 years ago

kderme commented 5 years ago

When q-s-m runs the semantics it catches all exceptions and tries to handle them. However it can also catch async exceptions caused by interrupts (^C) and consider them as test failures and try to shrink them. This is magnified when running sequential properties on the main thread or through ghci: In these cases the exception caught is AsyncException UserInterrupt and ignoring this exception means the program entirely ignores ^C. In other cases, for exampe when running test suites with defaultMain (like in Spec) or when running parallel properties the problem is less apparent because semantics run in some async-action: In these cases the main thread receives AsyncException UserInterrupt and sends AsyncCancelled to the async threads. The semantics will fail and try to shrink the failing example, but in the meantime the main thread will probably die and execution will stop fast, making the probem less apparent.

With this pr we rethrow all kind of async exceptions thrown while running semantics. In the future we may try to test some cases of async exceptions and then we may need to be more selective, but I think the default behaviour should be to propagate everything (this is also what QuickCheck does).