Commit Graph

158 Commits

Author SHA1 Message Date
Michael Walker
414554d1ef Add unsafeUnmask to dejafu 2020-05-14 13:50:12 +01:00
Michael Walker
be312a0f46 Add getMaskingState to dejafu 2020-05-10 23:05:07 +01:00
Michael Walker
f21d4ead86 Fix lints 2020-05-10 21:22:30 +01:00
Michael Walker
03f0e63b8b Fix new lints
There is a change to 'concurrency' here, but I don't think it's worth
making even a patch release.
2020-02-20 22:54:12 +00:00
Michael Walker
cef95c83c8 Get dejafu-tests building with hedgehog-1.0.2
tasty-hedgehog is now in stackage, so it would be great to use that;
but it's not in *older* stackages, hmm...
2020-02-20 22:13:48 +00:00
Michael Walker
0046a2b6e0 Fix hedgehog-1.0.0 test compilation failures 2019-10-04 18:21:50 +01:00
Michael Walker
ab5daf1509 Fix GHC 8.8 test compilation failures 2019-10-04 18:21:50 +01:00
Michael Walker
7b72e28544 Add some tests for MonadDejaFu IO & ST 2019-03-24 02:29:43 +00:00
Michael Walker
626ce585d3 Add failing test for #267 2019-03-14 11:20:37 +00:00
Michael Walker
cb118e4f41 Use the post-withSetup DepState
It's wrong to use initialDepState when there is a setup action, as the
action could end with a DepState which is not the same as the initial
one.  Here's an example of it going wrong:

    > :{
    resultsSet defaultWay defaultMemType $ do
      v <- newMVar ()
      fork (takeMVar v)
      readMVar v
    :}
    fromList [Left Deadlock,Right ()]

    > :{
    resultsSet defaultWay defaultMemType $
      withSetup (newMVar ()) $ \v -> do
        fork (takeMVar v)
        readMVar v
    :}
    fromList [Right ()]

This PR pushes responsibility for the DepState into the Context, and
the DepState is passed to all schedulers.  That means it's been
promoted from an internal type to a user-facing one, so I gave it the
more generic name "ConcurrencyState".  Furthermore, the snapshotted
DepState is passed to all the DPOR functions, and the trace
simplification functions.

initialDepState is now only used:

- in Conc.Internal to initialise a new context
- in SCT.Internal when there is no snapshot
2019-02-12 22:20:34 +00:00
Michael Walker
0a1543ef6b Uncomment AutoUpdate deadlock test 2019-02-12 18:13:42 +00:00
Michael Walker
129c21912e Implement effect-free concurrency invariants 2019-02-02 18:33:17 +00:00
Michael Walker
da474b5dcf Turn 'Program' typeclass into a GADT
With careful application of typeclass instances to this GADT, and by
redefining 'ConcT' in terms of it, this solves the type inference
problem and removes the need for the 'basic' function.  This approach
also has less newtype wrapping/unwrapping, and so is probably a step
in the right direction even without the type inference advantages.

The diff is quite big because things have needed to migrate between
modules to avoid the import graph getting even worse.
2019-02-02 01:38:39 +00:00
Michael Walker
1b048d4453 Remove Deadlock / STMDeadlock distinction 2019-02-02 01:38:39 +00:00
Michael Walker
68ed444589 Make length bounding work for random scheduling too
This works by pulling the LengthBound out of the Bounds.  A logical
extension of this would be to do away with Bounds entirely, and make
PreemptionBound and FairBound settings in their own right, but as they
only apply to DPOR, keeping them coupled to it feels less misleading.
2019-02-02 01:38:39 +00:00
Michael Walker
d375387784 Replace dontCheck/subconcurrency with new Program class
The 'Program' is the new formulation of dejafu unit tests.  A
'Program' is one of three types:

- A 'ConcT', which is as before.

- A 'WithSetup', which corresponds to 'dontCheck'.

- A 'WithSetupAndTeardown', which corresponds to 'subconcurrency'.

This more new formulation makes it impossible to nest 'withSetup' (the
replacement for 'dontCheck') or 'withSetupAndTeardown' (the
half-replacement for 'subconcurrency'), by as these functions take a
'ConcT' as their argument and produce a 'Program WithSetup' or
'Program WithSetupAndTeardown'.

The testing functions have all been generalised to work with this
'Program' type.
2019-02-02 01:38:39 +00:00
Michael Walker
ac35055beb Remove unnecessary CPP 2019-02-01 23:14:31 +00:00
Michael Walker
c17f66303a Remove deprecated functions & types 2019-01-20 14:24:46 +00:00
Michael Walker
798acc0894 Add 'lshowAborts', to make SCT functions show (now hidden) aborts 2019-01-20 00:07:17 +00:00
Michael Walker
02467da2ac Rename Failure to Condition 2019-01-20 00:07:17 +00:00
Michael Walker
07cb9f43e7 Turn internal errors into exceptions 2019-01-18 21:56:33 +00:00
Pepe Iborra
3f1f775bd7 Fix warnings 2018-12-01 10:14:11 +00:00
Pepe Iborra
44c9dfbe1c Fix incomplete pattern matches to avoid a MonadFail constraint 2018-11-26 22:00:40 +00:00
Michael Walker
65ac6ab18b Track how many buffered writes an IORef has 2018-07-15 11:32:28 +01:00
Michael Walker
039295ef41 Rename CRef to IORef 2018-07-01 12:45:43 +01:00
Michael Walker
38ee90cee8 Turn all tests into benchmarks 2018-06-24 11:34:31 +01:00
Michael Walker
ccb4b9aa24 Split up dejafu-tests main 2018-06-24 11:29:02 +01:00
Michael Walker
ec11aa7baf Enable systemtic par monad test 2018-06-17 13:28:50 +01:00
Michael Walker
92c8d941e7 Do not consider safe IO dependent 2018-06-17 12:49:15 +01:00
Michael Walker
118d7780a6 Fix hlint errors 2018-06-17 11:21:43 +01:00
Michael Walker
f263166a45 Invert the predicate in notAlwaysSame
I think having `alwaysSameBy f` and `notAlwaysSameBy f` be inverse of
each other is better than `notAlwaysSameBy (\a b -> not (f a b))`.
2018-06-10 22:30:02 +01:00
Michael Walker
54d64a16b4 Add predicate unit tests 2018-06-10 22:30:02 +01:00
Michael Walker
d0f23f5818 Reject failures in alwaysSame/On/By 2018-06-10 14:28:49 +01:00
Michael Walker
73ff73b544 Add a couple of tests for inherited masking states
Closes #207
2018-06-10 03:29:50 +01:00
Michael Walker
a54813926e Remove very slow parmonad test
It's unfortunate, but this one test is causing travis to frequently
time out.
2018-06-10 01:42:35 +01:00
Michael Walker
6e727af8c7 Add tests for unmasking
Closes #212
2018-06-10 01:34:02 +01:00
Michael Walker
e8a056aa3b Add flag to Throw/ThrowTo showing if the thread was killed
Closes #190
2018-06-10 01:34:02 +01:00
Michael Walker
bcadf59378 Disable length bounding by default
Closes #258
2018-06-03 11:29:25 +01:00
Michael Walker
dd7a537a89 Remove swarmy
Closes #237
2018-06-03 02:46:00 +01:00
Michael Walker
92e5b4881a Add some tests around nested orElse/catchSTM
Closes #208
2018-05-02 22:09:54 +01:00
Michael Walker
feb8358861 Add tests for discard function monoids 2018-04-29 01:13:49 +01:00
Michael Walker
3c18259923 Turn on -Werror in test CI builds 2018-03-26 12:05:32 +01:00
Michael Walker
35c2069b89 Drop GHC 7.10 support 2018-03-25 10:28:20 +01:00
Michael Walker
4f4aa08fcb Inline tasty-hedgehog dep into dejafu-tests 2018-03-24 23:14:04 +00:00
Michael Walker
2d8127774f Fix HLint errors 2018-03-24 23:14:04 +00:00
Michael Walker
b74661559b Fix some dejafu-tests warnings 2018-03-17 18:43:16 +00:00
Michael Walker
d51d1501e1 Remove 'Killed'
Closes #198
2018-03-17 18:12:44 +00:00
Michael Walker
6be0ce9d2a Drop use of MonadRef
Closes #201
2018-03-17 17:11:40 +00:00
Michael Walker
501447a2cf Rename model types to Model* 2018-03-15 12:44:52 +00:00
Michael Walker
f8ce6ef85a Add a setting to make some recoverable errors fatal 2018-03-12 18:43:48 +00:00