dejafu 0.5.0.0 → 0.5.0.2
raw patch · 6 files changed
+23/−7 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Test.DejaFu.Common: StopSubconcurrency :: ThreadAction
+ Test.DejaFu.Common: WillStopSubconcurrency :: Lookahead
+ Test.DejaFu.Conc: StopSubconcurrency :: ThreadAction
+ Test.DejaFu.Conc: WillStopSubconcurrency :: Lookahead
+ Test.DejaFu.Conc.Internal.Common: AStopSub :: (Action n r) -> Action n r
- Test.DejaFu.Conc.Internal: runConcurrency :: MonadRef r n => Scheduler g -> MemType -> g -> M n r a -> n (Either Failure a, g, SeqTrace)
+ Test.DejaFu.Conc.Internal: runConcurrency :: MonadRef r n => Scheduler g -> MemType -> g -> Int -> M n r a -> n (Either Failure a, g, SeqTrace)
Files
- Test/DejaFu/Common.hs +6/−0
- Test/DejaFu/Conc.hs +1/−1
- Test/DejaFu/Conc/Internal.hs +11/−4
- Test/DejaFu/Conc/Internal/Common.hs +2/−0
- Test/DejaFu/SCT.hs +1/−0
- dejafu.cabal +2/−2
Test/DejaFu/Common.hs view
@@ -260,6 +260,8 @@ -- ^ Cease execution and terminate. | Subconcurrency -- ^ Start executing an action with @subconcurrency@.+ | StopSubconcurrency+ -- ^ Stop executing an action with @subconcurrency@. deriving (Eq, Show) -- | Check if a @ThreadAction@ immediately blocks.@@ -361,6 +363,8 @@ -- ^ Will cease execution and terminate. | WillSubconcurrency -- ^ Will execute an action with @subconcurrency@.+ | WillStopSubconcurrency+ -- ^ Will stop executing an extion with @subconcurrency@. deriving (Eq, Show) -- | Convert a 'ThreadAction' into a 'Lookahead': \"rewind\" what has@@ -403,6 +407,7 @@ rewind Return = Just WillReturn rewind Stop = Just WillStop rewind Subconcurrency = Just WillSubconcurrency+rewind StopSubconcurrency = Just WillStopSubconcurrency -- | Check if an operation could enable another thread. willRelease :: Lookahead -> Bool@@ -410,6 +415,7 @@ willRelease WillYield = True willRelease (WillPutMVar _) = True willRelease (WillTryPutMVar _) = True+willRelease (WillReadMVar _) = True willRelease (WillTakeMVar _) = True willRelease (WillTryTakeMVar _) = True willRelease WillSTM = True
Test/DejaFu/Conc.hs view
@@ -177,7 +177,7 @@ -> Conc n r a -> n (Either Failure a, s, Trace) runConcurrent sched memtype s ma = do- (res, s', trace) <- runConcurrency sched memtype s (unC ma)+ (res, s', trace) <- runConcurrency sched memtype s 2 (unC ma) pure (res, s', F.toList trace) -- | Run a concurrent computation and return its result.
Test/DejaFu/Conc/Internal.hs view
@@ -51,14 +51,15 @@ => Scheduler g -> MemType -> g+ -> Int -> M n r a -> n (Either Failure a, g, SeqTrace)-runConcurrency sched memtype g ma = do+runConcurrency sched memtype g caps ma = do ref <- newRef Nothing let c = runCont ma (AStop . writeRef ref . Just . Right) let threads = launch' Unmasked initialThread (const c) M.empty- let ctx = Context { cSchedState = g, cIdSource = initialIdSource, cThreads = threads, cWriteBuf = emptyBuffer, cCaps = 2 }+ let ctx = Context { cSchedState = g, cIdSource = initialIdSource, cThreads = threads, cWriteBuf = emptyBuffer, cCaps = caps } (finalCtx, trace) <- runThreads sched memtype ref ctx out <- readRef ref@@ -360,8 +361,14 @@ ASub ma c | M.size (cThreads ctx) > 1 -> pure (Left IllegalSubconcurrency) | otherwise -> do- (res, g', trace) <- runConcurrency sched memtype (cSchedState ctx) ma- pure $ Right (ctx { cThreads = goto (c res) tid (cThreads ctx), cSchedState = g' }, Left (Subconcurrency, trace))+ (res, g', trace) <- runConcurrency sched memtype (cSchedState ctx) (cCaps ctx) ma+ pure $ Right (ctx { cThreads = goto (AStopSub (c res)) tid (cThreads ctx), cSchedState = g' }, Left (Subconcurrency, trace))++ -- after the end of a subconcurrent computation. does nothing,+ -- only exists so that: there is an entry in the trace for+ -- returning to normal computation; and every item in the trace+ -- corresponds to a scheduling point.+ AStopSub c -> simple (goto c tid (cThreads ctx)) StopSubconcurrency where -- this is not inline in the long @case@ above as it's needed by
Test/DejaFu/Conc/Internal/Common.hs view
@@ -134,6 +134,7 @@ | AStop (n ()) | forall a. ASub (M n r a) (Either Failure a -> Action n r)+ | AStopSub (Action n r) -------------------------------------------------------------------------------- -- * Scheduling & Traces@@ -172,3 +173,4 @@ lookahead' (AReturn k) = WillReturn : lookahead' k lookahead' (AStop _) = [WillStop] lookahead' (ASub _ _) = [WillSubconcurrency]+ lookahead' (AStopSub k) = WillStopSubconcurrency : lookahead' k
Test/DejaFu/SCT.hs view
@@ -471,6 +471,7 @@ _ -> False where+ same :: Eq a => (ActionType -> Maybe a) -> Bool same f = isJust (f a1) && f a1 == f a2 -------------------------------------------------------------------------------
dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dejafu-version: 0.5.0.0+version: 0.5.0.2 synopsis: Systematic testing for Haskell concurrency. description:@@ -74,7 +74,7 @@ source-repository this type: git location: https://github.com/barrucadu/dejafu.git- tag: dejafu-0.5.0.0+ tag: dejafu-0.5.0.2 library exposed-modules: Test.DejaFu