dejafu-1.9.1.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 
=> Way

How to run the concurrent program.

-> MemType

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

-> ConcT 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, NFData a) => Way -> MemType -> ConcT 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, Ord a) 
=> Way

How to run the concurrent program.

-> MemType

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

-> ConcT 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, Ord a, NFData a) => Way -> MemType -> ConcT 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 
=> Settings n a

The SCT settings.

-> ConcT 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, NFData a) => Settings n a -> ConcT 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, Ord a) 
=> Settings n a

The SCT settings.

-> ConcT 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, Ord a, NFData a) => Settings n a -> ConcT 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 
=> (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 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, NFData a) => (Either Failure a -> Maybe Discard) -> Way -> MemType -> ConcT 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, 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 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, Ord a, NFData a) => (Either Failure a -> Maybe Discard) -> Way -> MemType -> ConcT 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 
=> MemType

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

-> Bounds

The combined bounds.

-> ConcT 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 
=> (Either Failure a -> Maybe Discard)

Selectively discard results.

-> MemType

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

-> Bounds

The combined bounds.

-> ConcT 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, 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 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, 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 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, 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 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.7.0.0

sctWeightedRandomDiscard Source #

Arguments

:: (MonadConc 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 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.7.0.0