Commit Graph

714 Commits

Author SHA1 Message Date
Michael Walker
07dc91c8fb Remove a bit of boolean blindness 2017-08-12 11:15:50 +01:00
Michael Walker
f53e69dc46 Update Test.DejaFu.Conc.Internal.Memory module comment 2017-08-12 11:10:58 +01:00
Michael Walker
ea2ad13984 Replace some uses of Data.Map.alter with Data.Map.adjust 2017-08-12 11:09:18 +01:00
Michael Walker
746f4c8711 Add a README section about performance 2017-08-11 17:45:52 +01:00
Michael Walker
4d05ef6798 Release 2017-08-10 21:51:11 +01:00
Michael Walker
50712c54cd Merge branch 'discard' 2017-08-10 21:42:30 +01:00
Michael Walker
4e6e9c30fc Fix 'concurrency' version in README 2017-08-10 21:41:20 +01:00
Michael Walker
305cf27c0b Add a test for discarding 2017-08-10 20:22:03 +01:00
Michael Walker
b99caea84c Expose discard functions from Test.Tasty.DejaFu 2017-08-10 16:55:06 +01:00
Michael Walker
3ab42c4936 Expose discard functions from Test.HUnit.DejaFu 2017-08-10 16:45:29 +01:00
Michael Walker
bc0a5e579a Expose the discard logic through Test.DejaFu
New functions: dejafuDiscard and dejafuDiscardIO

No dejafusDiscard and dejafusDiscardIO, because I think the
combination of discarding + sharing traces would be very confusing.
Also, the dejafus* functions are for when you want to trade space for
time, whereas the *Discard* functions are for the opposite.  So it
doesn't make much sense.
2017-08-10 16:45:29 +01:00
Michael Walker
51bad3b5d1 Add a CHANGELOG entry 2017-08-10 16:45:29 +01:00
Michael Walker
100c2d3ab9 Push fmap inside checkDiscard
This seems to improve matters significantly.  Laziness!
2017-08-10 16:45:29 +01:00
Michael Walker
552a0f3816 Add discarding variants of SCT functions
See #90
2017-08-10 16:45:29 +01:00
Michael Walker
2becd6300d Drop use of partial functions in runThreads 2017-08-09 00:00:45 +01:00
Michael Walker
fe9e40747b [travis] Allow nightly build to fail 2017-08-07 22:07:53 +01:00
Michael Walker
a652628fb8 [travis] Only build with latest LTS for each supported GHC version 2017-08-07 22:07:39 +01:00
Michael Walker
325b7e01a3 Factor out continuation running to DejaFu.Common 2017-06-22 09:18:28 +01:00
Michael Walker
b8a039befc Note that semigroups dep of dejafu can be removed with GHC 8.4 2017-06-12 13:49:46 +01:00
Michael Walker
63a3ff73af dejafu-0.7.0.2 release 2017-06-12 03:48:28 +01:00
Michael Walker
0da649dc08 Remove unneeded monad-loops dep 2017-06-12 03:47:04 +01:00
Michael Walker
81ff175f6d Remove some redundant constraints 2017-06-11 23:59:47 +01:00
Michael Walker
9e7e460ab0 Remove a redundant import 2017-06-11 23:57:41 +01:00
Michael Walker
e32f777c32 0.7.0.1 release 2017-06-09 15:15:05 +01:00
Michael Walker
2cc812ddc3 Make checkWithSeeds faster when the result can be inferred early
Often checking every seed is unnecessary to compute the result of
checkWithSeeds.  The first failure always suffices for weak refinement
and equivalence, and sometimes suffices for strict refinement.
2017-06-09 15:14:42 +01:00
Michael Walker
d46319c577 Make checkFor faster when there is only a single counterexample
As mapM in IO is strict, composing listToMaybe with counterExamples
necessitates finding ALL counterexamples first, even though only the
first is returned.  So an improvement is gained by manually making it
"lazy".
2017-06-09 15:14:26 +01:00
Michael Walker
a0a5a493d5 Bump versions for release 2017-06-07 17:09:01 +01:00
Michael Walker
8f27ff0c11 Merge branch 'next-major' 2017-06-07 16:59:40 +01:00
Michael Walker
6bc2fd044f Remove unused imports 2017-06-07 16:59:24 +01:00
Michael Walker
f590f233a8 Implement all nonsense checks directly in the sct* functions 2017-06-07 16:50:56 +01:00
Michael Walker
040580d4f2 Remove bound-specific SCT functions 2017-06-07 16:50:56 +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
a0698bf575 Merge branch 'propcheck'
Closes #82
2017-06-07 14:32:19 +01:00
Michael Walker
748a55d813 Re-export Test.DejaFu.Refinement from Test.DejaFu 2017-06-07 14:25:55 +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
e785e51ddc Expose refinement properties in hunit-dejafu and tasty-dejafu 2017-06-07 14:20:04 +01:00
Michael Walker
a62350dd5c Switch to new refinement operators used in CoCo
Also include some explanation of this apparently backwards notation.
2017-06-07 14:20:00 +01:00
Michael Walker
3af7d4206d Implement refinement property testing
This lets dejafu test CoCo-style properties, and introduces a
dependency on [leancheck][].

For example, consider this statement about MVars: "using readMVar is
better than a takeMVar followed by a putMVar because the former is
atomic but the latter is not."

This module can test properties like that:

```
sig e = Sig
  { initialise = maybe newEmptyMVar newMVar
  , observe    = \v _ -> tryReadMVar v
  , interfere  = \v s -> tryTakeMVar v >>
                         maybe (pure ()) (void . tryPutMVar v) s
  , expr = e
  }

> check $ sig (void . readMVar) `equivalentTo`
          sig (\v -> takeMVar v >>= putMVar v)
*** Failure: (seed Just ())
    left:  [(Nothing,Just ())]
    right: [(Nothing,Just ()),(Just Deadlock,Just ())]
```

The two expressions are not equivalent, and we get given the
counterexample!

In addition to "equivalentTo", there is also "refines" and
"strictlyRefines" (and negated variants)

[leancheck]: https://hackage.haskell.org/package/leancheck
2017-06-07 14:18:50 +01:00
Michael Walker
4ffd7587ad Define default text execution parameters in Test.DejaFu.Defaults 2017-05-31 15:26:27 +01:00
Michael Walker
44c31f879c Update test-framework-hunit git location 2017-05-31 15:08:06 +01:00
Michael Walker
b6713505c5 Prevent re-use of MVar, CRef, and TVar IDs inside subconcurrency.
Fixes #81.
2017-05-03 23:12:26 +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
2d97030abe tasty-dejafu-0.5.0.0 2017-04-08 21:18:20 +01:00
Michael Walker
9af76cc4f2 hunit-dejafu-0.5.0.0 2017-04-08 21:15:32 +01:00
Michael Walker
dd5748e3e6 dejafu-0.6.0.0 2017-04-08 21:08:03 +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