Commit Graph

80 Commits

Author SHA1 Message Date
Michael Walker
c1046268e8 Reduce code duplication in *Id types
Closes #137
2017-12-13 07:24:18 +00:00
Michael Walker
81bcb5a351 Split up Test.DejaFu.Common 2017-12-12 14:07:22 +00:00
Michael Walker
988032c9a2 Replace "alwaysTrue2" with "alwaysSameOn" and "alwaysSameBy" 2017-12-12 14:07:22 +00:00
Michael Walker
020e3967f7 Change order of arguments to test functions
1. Discard function (if present)
2. Way              (if present)
3. Memory type      (if present)
4. Name of test
5. Predicate
6. Action

For multi-predicate functions, 4 and 5 are replaced with a list.
2017-12-12 14:07:22 +00:00
Michael Walker
6eaae0a589 Wrap predicate functions in a newtype & separate ty params
Also adds a Functor and Profunctor instance for predicates.  The old
predicate type is kept as an alias for the (common) case where both
tyvars are the same.
2017-12-12 14:07:22 +00:00
Michael Walker
45256193c0 Implement bound threads
This also adds forkOS(N) and isCurrentThreadBound to MonadConc, a
breaking change.

Note: forkOSWithUnmask(N) is NOT added to MonadConc, as it isn't
supported in base-4.8 (GHC 7.10).  See #132 for the action on this.

A bound thread under test gets a dedicated worker thread, which is
forked bound using the underlying MonadConc.  This worker is used for
all lifted actions, with execution as normal otherwise.
2017-12-12 14:06:59 +00:00
Michael Walker
31d29c11ea Require a 'MonadConc n' instance to run 'ConcT r n' expressions
This is preparation for adding bound threads.  The instance isn't used
in this commit, but the diff is large enough that I feel this should
be a separate commit for ease of review.

Fallout:

- The MonadBaseControl IO instance is gone, as I'm not sure how to do
  it generally.
- The pure/IO split is gone, everything is now monadic.
- The execution, SCT, and dejafu functions are of the form (MonadConc
  n, MonadRef r n) => ...
2017-12-12 14:06:59 +00:00
Michael Walker
4791333dc0 Reduce default number of quickcheck tests in dejafu-tests 2017-12-08 14:21:51 +00:00
Michael Walker
455a0f4ba7 Fix depstate being one step out of sync in backtracking
Fixes #161
2017-12-08 14:21:51 +00:00
Michael Walker
7aa407df47 Remove accidentally committed file 2017-11-20 19:25:48 +00:00
Michael Walker
7d5df170e7 Do not pass memory model to dependency functions
This is sane because buffered writes can only happen if the MemType
isn't sequential consistency anyway.
2017-11-02 22:15:11 +00:00
Michael Walker
e780c69f80 Impose a dependency between commits and memory barriers
The previous behaviour was unsound.

Fixes #138
2017-11-02 21:37:11 +00:00
Michael Walker
eb73600b39 Add property tests for memory ops 2017-10-31 17:17:27 +00:00
Michael Walker
29b1f28546 Add some property tests
Goes some way to solving #142, but it would be nice to have some for
the memory stuff.
2017-10-30 20:32:00 +00:00
Michael Walker
e099b29597 Remove GHC <7.10 checks from dejafu-tests 2017-10-28 17:26:52 +01:00
Michael Walker
a963822d6c Do not pop exception handlers twice
Fix #139 and #141
2017-10-28 12:21:41 +01:00
Michael Walker
5838a921b7 Add a test case exhibiting #139 2017-10-25 18:47:02 +01:00
Michael Walker
52e6f628c3 Test threadDelay in async tests 2017-10-11 10:25:03 +01:00
Michael Walker
a571368125 Include the exception in UncaughtException
Closes #133
2017-10-11 10:10:48 +01:00
Michael Walker
dddc4b62d6 Reset masking state when entering an exception handler
Fixes #118
2017-09-25 16:17:28 +01:00
Michael Walker
95dceb9670 Add a failing test case for #118 2017-09-25 16:03:49 +01:00
Michael Walker
c769662fa5 Move regression tests to a new module 2017-09-20 20:45:47 +01:00
Michael Walker
6bab3e883d Add some new async tests 2017-09-20 20:06:44 +01:00
Michael Walker
8636fe9708 Remove top-level definitions of individual tests 2017-09-20 20:06:44 +01:00
Michael Walker
fb13d62218 Give test cases more descriptive names 2017-09-20 20:06:44 +01:00
Michael Walker
58ab0e2c2f Use a typeclass to simplify test group definitions 2017-09-19 23:17:02 +01:00
Michael Walker
89728f0040 Whoops, refer to the correct test 2017-09-07 23:37:13 +01:00
Michael Walker
a84368953f Add tests for the ticket casCRef returns 2017-09-06 16:03:28 +01:00
Michael Walker
5087ff8a29 Add more tests for single-threaded MVar operations
Closes #94
2017-09-06 15:44:20 +01:00
Michael Walker
1da31432a8 Add a test case for #111 2017-09-01 13:53:16 +01:00
Michael Walker
26bdb96b25 Add tests for MonadFail exceptions 2017-08-21 18:53:08 +01:00
Michael Walker
b39200ab7e Test case doesn't actually need three preemptions 2017-08-19 15:43:21 +01:00
Michael Walker
305cf27c0b Add a test for discarding 2017-08-10 20:22:03 +01:00
Michael Walker
6bc2fd044f Remove unused imports 2017-06-07 16:59:24 +01:00
Michael Walker
6b1fd17024 Implement uniform random scheduling
Adds a new `uniformly` smart constructor and `sctUniformRandom`
function.

Also renames `sctRandom` to `sctWeightedRandom`.
2017-06-07 16:50:56 +01:00
Michael Walker
1146ce9b38 Add a smart constructor for constructing swarmy executions
The `randomly` constructor now corresponds exactly to the old
`Randomly`.

Also refactor tests a bit.
2017-06-07 16:50:56 +01:00
Michael Walker
fba26e6c73 Make Way abstract and expose smart constructors 2017-06-07 16:50:56 +01:00
Michael Walker
d65b8359a9 Allow re-using the weights for multiple executions in sctRandom 2017-06-07 16:45:43 +01:00
Michael Walker
94e22a765e Add tests for refinement checking
New coverage report, as there have been a bunch of new tests since the
one in the CONTRIBUTING file was generated:

 54% expressions used (4311/7948)
 51% boolean coverage (67/131)
      47% guards (50/106), 31 always True, 6 always False, 19 unevaluated
      57% 'if' conditions (11/19), 2 always True, 1 always False, 5 unevaluated
     100% qualifiers (6/6)
 61% alternatives used (413/671)
 83% local declarations used (212/254)
 28% top-level declarations used (313/1099)
2017-06-07 14:25:55 +01:00
Michael Walker
c11f1d92db Test case for #81.
This is a large diff because it pulls in a variant of QSemN.
2017-05-03 23:09:56 +01:00
Michael Walker
efaf353920 Rename Conc to ConcT and turn into a MonadTrans.
Closes #70.
2017-04-08 20:59:05 +01:00
Michael Walker
d3062234fa Make Way a GADT.
Closes #65.
2017-04-08 20:57:25 +01:00
Michael Walker
0e59d9aa40 Add a basic test for uninterruptible masks.
Closes #76.
2017-03-04 05:36:32 +00:00
Michael Walker
c2f8ffe473 Add some CAS tests.
Closes #75.
2017-03-04 05:28:29 +00:00
Michael Walker
32f6887a1b Add tests for throwing exceptions to the main thread.
Closes #74.
2017-03-04 05:28:29 +00:00
Michael Walker
463efd3f8d Merge "async-dejafu" into "concurrency" + bump versions.
Closes #73.
2017-03-03 22:06:09 +00:00
Michael Walker
95eed7524c Add a test case to replicate issue 71. 2017-02-25 06:01:59 +00:00
Michael Walker
12335e0090 Add tryReadMVar to MonadConc and dejafu.
Also pins the version of "concurrency" that dejafu depends on down to
the third digit, as additions to `MonadConc` will break dejafu.

Closes #62.
2017-02-20 23:42:08 +00:00
Michael Walker
f2c6dc69f3 Add tests for random sctRandom. 2017-02-20 04:41:36 +00:00
Michael Walker
f5bf9da038 Update dejafu-tests for new hunit-dejafu interface. 2017-02-20 03:23:46 +00:00