Commit Graph

47 Commits

Author SHA1 Message Date
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
Michael Walker
8fd3e5900b Messy implementation of subconcurrency.
This makes `stepThread` messier, and doesn't actually prevent nesting
currently - although it does prevent usage when there are multiple
threads, which may be enough.
2017-02-02 12:26:40 +00:00
Michael Walker
75fbad38a1 Rename Deterministic to Conc.
Closes #45
2016-07-21 19:33:49 +01:00
Michael Walker
2f0f51ceb6 Split concurrency modules into a separate package.
The new 'concurrency' package is starting at version 1.0.0.0 because the
API is already very mature (copied from base).

This breaks the dejafu-0.2 compatibility of async-dejafu.

Closes #51.
2016-07-21 19:33:49 +01:00
Michael Walker
2aa2b8f447 Unify IO and ST instances
Closes #44
2016-07-21 19:33:49 +01:00
Michael Walker
c742da2bfd Drop _concKnows stuff and fix litmus tests.
Removing the stuff broke some of the litmus tests, which is bad. It
probably means that those actions were being put into sleep sets, and so
hiding actually interesting interleavings from the POR implementation. I
need to improve the lookahead behaviour to ignore these invisible
actions.

Closes #46.
2016-07-21 19:33:49 +01:00
Michael Walker
70bcad4615 Bump versions for 0.4.0.0 release 2016-07-21 19:33:46 +01:00
Michael Walker
8b35ec9ef7 Propagate read TVars in orElse.
Fixes #55.
2016-07-21 18:53:26 +01:00
Michael Walker
b978476c8b Add a test case for #40. 2016-06-05 23:40:03 +01:00
Michael Walker
232e7e5f40 Bump version numbers 2016-05-26 14:02:07 +01:00
Michael Walker
d4cb712b50 Make everything build with GHC 8 2016-05-26 13:54:13 +01:00
Michael Walker
cea4d59b3c Correctly count preemptions with commit threads.
Conceptually, commits are happening truly in parallel
nondeterministically, and the commit threads are introduced to unify
this source of nondeterminism with the scheduling decisions. Commit
threads are not real threads, and switching to one is not a real context
switch, it therefore doesn't count as a preemption.

For example, this execution clearly has no preemptions in:

    S1---C-S1---

It would be absurd to say it has 1 preemption. But what about this?

    S1---C-S2---

This clearly DOES have a preemption. S1 was preempted by C (but we don't
count that), and then S2 started to execute! Control should have been
returned to S1.

Prior to now, this case was not considered specially. So every commit
effectively gives rise to a free preemption! This is bad for two
reasons:

- More schedules get executed, so testing takes longer.
- This is actually, in a sense, unsound! Results are potentially being
  reported which could NEVER arise under ANY real-world execution
  subject to those bounds!

It is because of this latter point that some of the expected results in
test litmusWP27 have been removed. They require more than the standard
two preemptions to observe.

Closes #39.
2016-05-02 23:35:08 +01:00
Michael Walker
6fef2be497 Bump version numbers for hackage release.
async-dejafu, hunit-dejafu, and tasty-dejafu only get a minor bump
because the API didn't change, only the dependencies. I'm not entirely
sure how to fit that properly into the PVP.
2016-04-03 14:40:51 +01:00
Michael Walker
4afca62119 Drop the lock and unlock MVar functions 2016-04-03 06:45:11 +01:00
Michael Walker
29150d03a3 Drop dependency (3) and compute state in dporSched
This massively reduces the number of schedules tried for the litmus
tests, as expected, which is great! Interestingly, it does result in
more unique results being discovered for intelWP27 and intelWP28. This
is surprising DPOR is supposed to be complete. Perhaps this indicates
some unsoundness in the way I have integrated schedule bounding with
relaxed memory.
2016-04-03 05:31:06 +01:00
Michael Walker
f89b4d81e8 Move the rest of the generic SCT stuff to DPOR 2016-04-03 05:07:34 +01:00
Michael Walker
f3457b23a0 Generalise and move grow to DPOR module.
For some reason, this causes significantly more schedules to be explored
in some of the litmus tests, in particular intelWP27 and intelWP28. I've
not dug too deeply, but it's probably something which should be
addresed.
2016-04-03 05:02:44 +01:00
Michael Walker
6c29594675 Add a function to compare the different memory models 2016-03-31 18:43:10 +01:00
Michael Walker
a1122405fe Less restrictive module exports in tests 2016-03-31 18:16:09 +01:00
Michael Walker
b98a03e22c Add more litmus tests 2016-03-31 18:14:11 +01:00
Michael Walker
3ee0b3dc75 Add the Search Party failing test example 2016-03-31 15:08:37 +01:00
Michael Walker
18cb1c86c9 Organise tests a little 2016-03-31 14:45:55 +01:00
Michael Walker
9e68038e2b Add AutoUpdate example to tests 2016-03-31 14:37:02 +01:00
Michael Walker
5b4911032e Rename modifyCRef to atomicModifyCRef 2016-03-26 06:37:27 +00:00
Michael Walker
a4c2a1c235 Rename CVar -> MVar 2016-03-23 03:36:07 +00:00
Michael Walker
a1a78c7005 Rename CTVar -> TVar 2016-03-23 03:27:51 +00:00
Michael Walker
8b999595e3 Move modules to Control.Concurrent(.STM).Classy 2016-03-23 03:13:56 +00:00
Michael Walker
c1d4259178 Don't introduce a dependency for blocked actions
This is safe because there's no point pre-empting a block to cause a
context switch, as the context switch will happen immediately after
the block anyway.

This speeds up the Applicative composition test from over 30 minutes
to around 1.
2015-12-03 22:09:09 +00:00
Michael Walker
ef9a89ee9c Simplify "ap (side effects)" test case 2015-12-03 21:36:07 +00:00
Michael Walker
cae5704ac9 Enable building tests with GHC <7.10 2015-12-01 05:13:47 +00:00
Michael Walker
37a5886c83 Make a separate package for the test suite. Closes #31. 2015-12-01 05:07:56 +00:00