Commit Graph

334 Commits

Author SHA1 Message Date
Michael Walker
62711d9025 Add some exception tests 2015-02-14 23:45:14 +00:00
Michael Walker
7409bc67cd Re-export MaskingState from Deterministic 2015-02-14 21:24:41 +00:00
Michael Walker
99dd56adfe Implement forkWithUnmask 2015-02-14 21:16:44 +00:00
Michael Walker
abc31aa165 Have throwTo get blocked on mask state 2015-02-14 21:01:33 +00:00
Michael Walker
8af7b814c2 Consider masking changes interesting for SCT 2015-02-14 18:59:11 +00:00
Michael Walker
f75db99713 Implement AMasking and AResetMask (but don't yet consider masking in throwTo!) 2015-02-14 18:54:43 +00:00
Michael Walker
5dc8476cac Threads inherit the masking state of their parent 2015-02-14 16:05:16 +00:00
Michael Walker
3a4c58b4ee Turn threads into records 2015-02-14 16:02:07 +00:00
Michael Walker
8f4007ed59 Add a AResetMasking action 2015-02-14 15:47:48 +00:00
Michael Walker
825b135dc1 Add AMasking primitive 2015-02-13 18:30:21 +00:00
Michael Walker
f18209f2e0 Make MonadMask a requirement for MonadConc 2015-02-13 17:47:04 +00:00
Michael Walker
8faee29b27 Implement throwTo and killThread 2015-02-13 17:13:00 +00:00
Michael Walker
2a79b78901 Pop exception handlers off the stack when leaving their scope 2015-02-13 14:06:52 +00:00
Michael Walker
ad216bd3a9 hlint fixes 2015-02-13 00:56:45 +00:00
Michael Walker
cf1c6ebece Available ThreadIds. Closes #3 2015-02-13 00:55:05 +00:00
Michael Walker
97611ff5b5 Implement catching exceptions 2015-02-13 00:50:58 +00:00
Michael Walker
9bd781c697 Primitive for throwing exceptions 2015-02-13 00:46:48 +00:00
Michael Walker
5ce63d0d50 Use MonadThrow/MonadCatch for MonadConc exceptions 2015-02-13 00:46:14 +00:00
Michael Walker
ef580d66e8 Use MonadThrow/MonadCatch for MonadSTM exceptions 2015-02-13 00:46:13 +00:00
Michael Walker
9b0cd6ffd3 doTransaction already calls undo on retry/exception 2015-02-13 00:46:12 +00:00
Michael Walker
a305354b65 Add STM exceptions 2015-02-13 00:46:11 +00:00
Michael Walker
8b31dc45c6 Make travis build non-master branches 2015-02-13 00:45:34 +00:00
Michael Walker
7b7c765494 Add a central manager for unique ID types 2015-02-10 18:26:22 +00:00
Michael Walker
d5e4f94a08 Include the CTVarIds of created CTVars in STM Success output 2015-02-10 11:16:36 +00:00
Michael Walker
f7b7539445 Remove logic duplication in Deterministic.Internal 2015-02-10 02:09:51 +00:00
Michael Walker
a54925df4b Move CVar IDs out of the Ref in Deterministic 2015-02-10 01:20:04 +00:00
Michael Walker
78ee2b2f75 Add MonadSTM constraint to MonadConc 2015-02-10 01:19:45 +00:00
Michael Walker
1cc5ade782 Reimplement CVar blocking in the same way as CTVar blocking 2015-02-09 23:43:18 +00:00
Michael Walker
7f26aa9654 Implement STM in Deterministic 2015-02-09 23:22:06 +00:00
Michael Walker
36e83e72f8 Add MonadSTM instances for Conc and ConcIO 2015-02-09 22:31:05 +00:00
Michael Walker
9b5e010d90 Implement a STM runner. 2015-02-09 22:04:28 +00:00
Michael Walker
f79f7fd245 Add a MonadSTM
- Each MonadConc has an associated MonadSTM, transactions of which
   it can run atomically.
 - The MonadSTM for IO is STM.
 - Conc and ConcIO do not yet have a MonadSTM.
2015-02-09 15:30:54 +00:00
Michael Walker
7aceb6a6f9 Implement an atomic-for-testing-purposes function.
This adds a new `MonadConc` primitive, `_concNoTest`, which is (for
all non-test implementations) the identity function. For test
implementations, it is understood as "this action is completely safe
under all schedules, so just execute it all at once and don't consider
any internal interleavings." It is not required to be deterministic,
merely to never fail.

Actions annotated with `_concNoTest` will show up as one step in the
trace, and new `Failure` and `ThreadAction` values have been added.
2015-02-06 16:18:25 +00:00
Michael Walker
c20db31561 Include reason for failure in Deterministic result 2015-02-06 16:04:59 +00:00
Michael Walker
9a0cefd85c Tidy up Deterministic step functions 2015-02-06 11:26:04 +00:00
Michael Walker
a15a109b60 Give CVars IDs 2015-02-06 11:08:52 +00:00
Michael Walker
e8a9e25fdb Remove logic duplication in Deterministic.Internal 2015-02-05 15:50:05 +00:00
Michael Walker
4c0f131942 Better dupe elimination 2015-02-04 16:51:50 +00:00
Michael Walker
bc31ddc5e1 Remove shrinking.
- Tweak order in which schedules are explored to look at simple,
   but not too simple, cases first.

 - Port simplicity logic from shrinking to dupe elimination.
2015-02-04 11:45:08 +00:00
Michael Walker
0b26358851 Shrink shrinking code 2015-02-02 20:49:33 +00:00
Michael Walker
4f6eade3bb Make resEq more flexible 2015-02-02 16:11:37 +00:00
Michael Walker
242b661185 Filter out duplicate failures in runTest 2015-02-01 21:55:25 +00:00
Michael Walker
970df85ede Drop redundant $ 2015-02-01 21:55:09 +00:00
Michael Walker
00ad122b65 Refactor code and update docs to make more not-me friendly 2015-02-01 01:21:42 +00:00
Michael Walker
fbc262c361 Rename and remodularise 2015-01-31 15:50:54 +00:00
Michael Walker
304df27a35 Add a simple autocheck function, to look for deadlocks and multiple results 2015-01-30 16:09:32 +00:00
Michael Walker
8b28633f20 Implement shrinking, and shrink test output.
Shrinking attempts to find a "maximally simple" trace which
exhibits the same bug as the original. Typically, this means that
the results are equal. Shrinking is implemented in terms of
recursively trying to find the simplest variant of the original
trace, where simplest in particular means:

1. A trace with fewer pre-emptions is simpler.
2. A trace with fewer non-pre-emptive context switches is simpler.
3. A trace lexicographically smaller is simpler.

These three criteria are applied in that order in order to determine
which the simplest trace out of a collection is.

For test output, there is a final set of simplification done at the end.
Shrinking attempts to reduce individual traces to their simplest variant,
which can result in multiple test failures having the same shrunk trace.
Thus, the test runner then filters out duplicate failures by only keeping
the simplest trace for a given result.
2015-01-30 15:31:40 +00:00
Michael Walker
765f8d0bd5 Move CVars into Control.Concurrent 2015-01-28 17:59:17 +00:00
Michael Walker
531b9fd05b Add a module for strict CVars 2015-01-28 17:46:04 +00:00
Michael Walker
21a248bfa2 Drop MultiParamTypeClasses and FunDeps for TypeFamilies 2015-01-28 17:25:15 +00:00