dejafu-1.3.2.0: A library for unit-testing concurrent programs.

Copyright(c) 2015--2018 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Test.DejaFu.SCT

Contents

Description

Systematic testing for concurrent computations.

Synopsis

Running Concurrent Programs

runSCT Source #

Arguments

:: (MonadConc n, MonadRef r n) 
=> Way

How to run the concurrent program.

-> MemType

The memory model to use for non-synchronised CRef operations.

-> ConcT r n a

The computation to run many times.

-> n [(Either Failure a, Trace)] 

Explore possible executions of a concurrent program according to the given Way.

The exact executions tried, and the order in which results are found, is unspecified and may change between releases.

Since: 1.0.0.0

runSCT' :: (MonadConc n, MonadRef r n, NFData a) => Way -> MemType -> ConcT r n a -> n [(Either Failure a, Trace)] Source #

A strict variant of runSCT.

Demanding the result of this will force it to normal form, which may be more efficient in some situations.

The exact executions tried, and the order in which results are found, is unspecified and may change between releases.

Since: 1.0.0.0

resultsSet Source #

Arguments

:: (MonadConc n, MonadRef r n, Ord a) 
=> Way

How to run the concurrent program.

-> MemType

The memory model to use for non-synchronised CRef operations.

-> ConcT r n a

The computation to run many times.

-> n (Set (Either Failure a)) 

Return the set of results of a concurrent program.

Since: 1.0.0.0

resultsSet' :: (MonadConc n, MonadRef r n, Ord a, NFData a) => Way -> MemType -> ConcT r n a -> n (Set (Either Failure a)) Source #

A strict variant of resultsSet.

Demanding the result of this will force it to normal form, which may be more efficient in some situations.

Since: 1.0.0.0

Configuration

runSCTWithSettings Source #

Arguments

:: (MonadConc n, MonadRef r n) 
=> Settings n a

The SCT settings.

-> ConcT r n a

The computation to run many times.

-> n [(Either Failure a, Trace)] 

A variant of runSCT which takes a Settings record.

The exact executions tried, and the order in which results are found, is unspecified and may change between releases.

Since: 1.2.0.0

runSCTWithSettings' :: (MonadConc n, MonadRef r n, NFData a) => Settings n a -> ConcT r n a -> n [(Either Failure a, Trace)] Source #

A strict variant of runSCTWithSettings.

Demanding the result of this will force it to normal form, which may be more efficient in some situations.

The exact executions tried, and the order in which results are found, is unspecified and may change between releases.

Since: 1.2.0.0

resultsSetWithSettings Source #

Arguments

:: (MonadConc n, MonadRef r n, Ord a) 
=> Settings n a

The SCT settings.

-> ConcT r n a

The computation to run many times.

-> n (Set (Either Failure a)) 

A variant of resultsSet which takes a Settings record.

Since: 1.2.0.0

resultsSetWithSettings' :: (MonadConc n, MonadRef r n, Ord a, NFData a) => Settings n a -> ConcT r n a -> n (Set (Either Failure a)) Source #

A strict variant of resultsSetWithSettings.

Demanding the result of this will force it to normal form, which may be more efficient in some situations.

Since: 1.2.0.0

Deprecated

runSCTDiscard Source #

Arguments

:: (MonadConc n, MonadRef r n) 
=> (Either Failure a -> Maybe Discard)

Selectively discard results.

-> Way

How to run the concurrent program.

-> MemType

The memory model to use for non-synchronised CRef operations.

-> ConcT r n a

The computation to run many times.

-> n [(Either Failure a, Trace)] 

Deprecated: Use runSCTWithSettings instead

A variant of runSCT which can selectively discard results.

The exact executions tried, and the order in which results are found, is unspecified and may change between releases.

Since: 1.0.0.0

runSCTDiscard' :: (MonadConc n, MonadRef r n, NFData a) => (Either Failure a -> Maybe Discard) -> Way -> MemType -> ConcT r n a -> n [(Either Failure a, Trace)] Source #

Deprecated: Use runSCTWithSettings' instead

A strict variant of runSCTDiscard.

Demanding the result of this will force it to normal form, which may be more efficient in some situations.

The exact executions tried, and the order in which results are found, is unspecified and may change between releases.

Since: 1.0.0.0

resultsSetDiscard Source #

Arguments

:: (MonadConc n, MonadRef r n, Ord a) 
=> (Either Failure a -> Maybe Discard)

Selectively discard results. Traces are always discarded.

-> Way

How to run the concurrent program.

-> MemType

The memory model to use for non-synchronised CRef operations.

-> ConcT r n a

The computation to run many times.

-> n (Set (Either Failure a)) 

Deprecated: Use resultsSetWithSettings instead

A variant of resultsSet which can selectively discard results.

Since: 1.0.0.0

resultsSetDiscard' :: (MonadConc n, MonadRef r n, Ord a, NFData a) => (Either Failure a -> Maybe Discard) -> Way -> MemType -> ConcT r n a -> n (Set (Either Failure a)) Source #

Deprecated: Use resultsSetWithSettings' instead

A strict variant of resultsSetDiscard.

Demanding the result of this will force it to normal form, which may be more efficient in some situations.

Since: 1.0.0.0

sctBound Source #

Arguments

:: (MonadConc n, MonadRef r n) 
=> MemType

The memory model to use for non-synchronised CRef operations.

-> Bounds

The combined bounds.

-> ConcT r n a

The computation to run many times

-> n [(Either Failure a, Trace)] 

Deprecated: Use runSCT instead

SCT via BPOR.

Schedules are generated by running the computation with a deterministic scheduler with some initial list of decisions. At each step of execution, possible-conflicting actions are looked for, if any are found, "backtracking points" are added, to cause the events to happen in a different order in a future execution.

Note that unlike with non-bounded partial-order reduction, this may do some redundant work as the introduction of a bound can make previously non-interfering events interfere with each other.

The exact executions tried, and the order in which results are found, is unspecified and may change between releases.

Since: 1.0.0.0

sctBoundDiscard Source #

Arguments

:: (MonadConc n, MonadRef r n) 
=> (Either Failure a -> Maybe Discard)

Selectively discard results.

-> MemType

The memory model to use for non-synchronised CRef operations.

-> Bounds

The combined bounds.

-> ConcT r n a

The computation to run many times

-> n [(Either Failure a, Trace)] 

Deprecated: Use runSCTWithSettings instead

A variant of sctBound which can selectively discard results.

The exact executions tried, and the order in which results are found, is unspecified and may change between releases.

Since: 1.0.0.0

sctUniformRandom Source #

Arguments

:: (MonadConc n, MonadRef r n, RandomGen g) 
=> MemType

The memory model to use for non-synchronised CRef operations.

-> g

The random number generator.

-> Int

The number of executions to perform.

-> ConcT r n a

The computation to run many times.

-> n [(Either Failure a, Trace)] 

Deprecated: Use runSCT instead

SCT via uniform random scheduling.

Schedules are generated by assigning to each new thread a random weight. Threads are then scheduled by a weighted random selection.

This is not guaranteed to find all distinct results.

Since: 1.0.0.0

sctUniformRandomDiscard Source #

Arguments

:: (MonadConc n, MonadRef r n, RandomGen g) 
=> (Either Failure a -> Maybe Discard)

Selectively discard results.

-> MemType

The memory model to use for non-synchronised CRef operations.

-> g

The random number generator.

-> Int

The number of executions to perform.

-> ConcT r n a

The computation to run many times.

-> n [(Either Failure a, Trace)] 

Deprecated: Use runSCTWithSettings instead

A variant of sctUniformRandom which can selectively discard results.

This is not guaranteed to find all distinct results.

Since: 1.0.0.0

sctWeightedRandom Source #

Arguments

:: (MonadConc n, MonadRef r n, RandomGen g) 
=> MemType

The memory model to use for non-synchronised CRef operations.

-> g

The random number generator.

-> Int

The number of executions to perform.

-> Int

The number of executions to use the same set of weights for.

-> ConcT r n a

The computation to run many times.

-> n [(Either Failure a, Trace)] 

Deprecated: Use runSCT instead

SCT via weighted random scheduling.

Schedules are generated by assigning to each new thread a random weight. Threads are then scheduled by a weighted random selection.

This is not guaranteed to find all distinct results.

Since: 1.0.0.0

sctWeightedRandomDiscard Source #

Arguments

:: (MonadConc n, MonadRef r n, RandomGen g) 
=> (Either Failure a -> Maybe Discard)

Selectively discard results.

-> MemType

The memory model to use for non-synchronised CRef operations.

-> g

The random number generator.

-> Int

The number of executions to perform.

-> Int

The number of executions to use the same set of weights for.

-> ConcT r n a

The computation to run many times.

-> n [(Either Failure a, Trace)] 

Deprecated: Use runSCTWithSettings instead

A variant of sctWeightedRandom which can selectively discard results.

This is not guaranteed to find all distinct results.

Since: 1.0.0.0