Commit Graph

110 Commits

Author SHA1 Message Date
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
Michael Walker
19f3404d1d Correctly handle re-ordering forks and newCRefs in simplifier
Re-ordering forks will change thread IDs, and re-ordering newCRefs
will change CRef IDs (which will then change commit thread IDs when
executing under PSO).  So before we can execute a simplified trace, we
have to consistently renumber everything again.
2018-03-11 23:15:44 +00:00
Michael Walker
dd384f01de Implement basic semantics-preserving shrinking 2018-03-11 23:15:44 +00:00
Michael Walker
2c407b768a DepState does not track CRef buffers under SQ 2018-03-11 23:15:44 +00:00
Michael Walker
d54ce2f9c7 Add setNumCapabilities/setNumCapabilities dep
Closes #243
2018-03-11 16:41:03 +00:00
Michael Walker
053ce34682 Add tests for early-exit 2018-03-05 12:37:21 +00:00
Michael Walker
dccc2c7992 Use Settings throughout dejafu-tests 2018-03-04 15:00:16 +00:00
Kirill Zaborsky
bc198a5e13 Add tests for named threads, vars, and refs 2018-03-02 22:43:02 +03:00
Kirill Zaborsky
79a736bc1c Add tests for resultsSetXXX 2018-02-24 00:25:25 +03:00
Michael Walker
45a0ae02e1 Document how snapshotting interacts with IO 2018-02-22 19:00:44 +00:00
Michael Walker
0ce6d541e9 Automatically snapshot (when possible) in SCT 2018-02-22 19:00:44 +00:00
Michael Walker
dc48c0e058 Add tests for dontCheck 2018-02-22 19:00:44 +00:00
Kirill Zaborsky
7f5680bcd1 Add test for DiscardTrace 2018-02-21 01:07:23 +03:00
Michael Walker
1b5fca4b68 Introduce a helper function for property tests 2018-02-16 20:04:54 +00:00
Michael Walker
2fd9e9aae7 Replace QuickCheck tests with Hedgehog ones 2018-02-16 20:04:54 +00:00
Michael Walker
5cdbc7acad Replace LeanCheck tests with Hedgehog tests 2018-02-16 20:04:54 +00:00
Michael Walker
a5b478b74c Allow for each test type to specify its own Tasty options 2018-02-16 20:04:54 +00:00
Michael Walker
827317d970 Warn, lint, & style tests 2018-02-16 20:04:54 +00:00
Michael Walker
7b527a8793 Rearrange test hierarchy 2018-02-16 20:04:54 +00:00
Michael Walker
92cc44b548 Add tests for liftIO
Closes #93
2018-02-16 20:04:54 +00:00
Michael Walker
8bff75a167 Add dependency function property tests
The idea is that, if the dependency function is correct, then any
permutation of independent actions should give the same result.

In practice it's a little more complex, as the dependency function has
some special cases which are only valid because of how it is used.  So
an "independence" function which we can use to shuffle any trace
after-the-fact has to work around those cases.
2018-02-16 20:04:52 +00:00
Michael Walker
4202ebbec1 Consolidate test-running logic 2018-02-16 20:04:39 +00:00
Michael Walker
64d24dbe24 Migrate tests from test-framework to tasty 2018-02-16 20:04:20 +00:00
Michael Walker
bc7f69c2c7 Add a multithreaded capabilities test
Closes #96
2018-02-16 19:14:46 +00:00
Michael Walker
a5e6d754f6 Add Par Monad example
Closes #184
2018-02-16 19:14:46 +00:00
Michael Walker
d6642b23d1 Split dejafu-tests into lib + binary 2018-02-16 19:14:46 +00:00
Michael Walker
878a008ddb Build dejafu-tests with -rtsopts 2017-12-23 12:54:35 +00:00
Michael Walker
60215578b7 Track full MVars in the dependency state
Before:

   105,910,870,840 bytes allocated in the heap
    24,834,921,776 bytes copied during GC
        17,775,024 bytes maximum residency (7973 sample(s))
           674,464 bytes maximum slop
                50 MB total memory in use (0 MB lost due to fragmentation)

                                       Tot time (elapsed)  Avg pause  Max pause
    Gen  0     196263 colls,     0 par   43.085s  43.734s     0.0002s    0.0225s
    Gen  1      7973 colls,     0 par   21.953s  22.359s     0.0028s    0.0778s

    TASKS: 204933 (204929 bound, 4 peak workers (4 total), using -N1)

    SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

    INIT    time    0.001s  (  0.001s elapsed)
    MUT     time  127.384s  (138.737s elapsed)
    GC      time   65.038s  ( 66.093s elapsed)
    EXIT    time    0.000s  (  0.000s elapsed)
    Total   time  192.517s  (204.831s elapsed)

After:

    89,073,483,552 bytes allocated in the heap
    20,134,704,256 bytes copied during GC
        13,426,968 bytes maximum residency (6623 sample(s))
           265,720 bytes maximum slop
                38 MB total memory in use (0 MB lost due to fragmentation)

                                       Tot time (elapsed)  Avg pause  Max pause
    Gen  0     165191 colls,     0 par   34.872s  35.319s     0.0002s    0.0111s
    Gen  1      6623 colls,     0 par   17.515s  17.831s     0.0027s    0.0509s

    TASKS: 173871 (173867 bound, 4 peak workers (4 total), using -N1)

    SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

    INIT    time    0.001s  (  0.001s elapsed)
    MUT     time  104.495s  (113.498s elapsed)
    GC      time   52.387s  ( 53.150s elapsed)
    EXIT    time    0.001s  (  0.001s elapsed)
    Total   time  156.991s  (166.650s elapsed)

Closes #168
2017-12-21 08:13:17 +00:00
Michael Walker
d3419845d3 Split Test.DejaFu.SCT.Internal up 2017-12-13 07:24:18 +00:00
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