commit ghc-tasty-dejafu for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-tasty-dejafu for openSUSE:Factory checked in at 2017-08-31 21:00:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-tasty-dejafu (Old) and /work/SRC/openSUSE:Factory/.ghc-tasty-dejafu.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-tasty-dejafu" Thu Aug 31 21:00:14 2017 rev:3 rq:513509 version:0.6.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-tasty-dejafu/ghc-tasty-dejafu.changes 2017-04-18 13:51:00.393305099 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-tasty-dejafu.new/ghc-tasty-dejafu.changes 2017-08-31 21:00:15.543419287 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:07:02 UTC 2017 - psimons@suse.com + +- Update to version 0.6.0.0. + +------------------------------------------------------------------- Old: ---- tasty-dejafu-0.3.0.2.tar.gz New: ---- tasty-dejafu-0.6.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-tasty-dejafu.spec ++++++ --- /var/tmp/diff_new_pack.ImStsy/_old 2017-08-31 21:00:16.487286671 +0200 +++ /var/tmp/diff_new_pack.ImStsy/_new 2017-08-31 21:00:16.487286671 +0200 @@ -18,7 +18,7 @@ %global pkg_name tasty-dejafu Name: ghc-%{pkg_name} -Version: 0.3.0.2 +Version: 0.6.0.0 Release: 0 Summary: Deja Fu support for the Tasty test framework License: MIT @@ -27,6 +27,7 @@ Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel BuildRequires: ghc-dejafu-devel +BuildRequires: ghc-random-devel BuildRequires: ghc-rpm-macros BuildRequires: ghc-tagged-devel BuildRequires: ghc-tasty-devel @@ -38,8 +39,6 @@ tasty>. This lets you easily incorporate concurrency testing into your existing test suites. -See the <https://github.com/barrucadu/dejafu README> for more details. - %package devel Summary: Haskell %{pkg_name} library development files Group: Development/Libraries/Other @@ -72,5 +71,6 @@ %files devel -f %{name}-devel.files %defattr(-,root,root,-) +%doc CHANGELOG.markdown README.markdown %changelog ++++++ tasty-dejafu-0.3.0.2.tar.gz -> tasty-dejafu-0.6.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tasty-dejafu-0.3.0.2/CHANGELOG.markdown new/tasty-dejafu-0.6.0.0/CHANGELOG.markdown --- old/tasty-dejafu-0.3.0.2/CHANGELOG.markdown 1970-01-01 01:00:00.000000000 +0100 +++ new/tasty-dejafu-0.6.0.0/CHANGELOG.markdown 2017-06-07 18:08:42.000000000 +0200 @@ -0,0 +1,163 @@ +Release Notes +============= + +All notable changes to this project will be documented in this file. + +This project is versioned according to the [Package Versioning Policy](https://pvp.haskell.org), the +*de facto* standard Haskell versioning scheme. + + +0.6.0.0 [2017-04-08] (git tag: [tasty-dejafu-0.6.0.0][]) +------- + +https://hackage.haskell.org/package/tasty-dejafu-0.6.0.0 + +### Test.Tasty.DejaFu + +- The refinement property testing functionality of dejafu is exposed in the new `testProperty` + function, and re-exported values. +- Due to changes in dejafu, the `Way` type is now abstract and exposes smart constructor functions: + - `systematically`, corresponding to the old `Systematically`. + - `randomly`, corresponding to the old `Randomly`. + - `uniformly`, a new uniform random (as opposed to weighted random) scheduler. + - `swarmy`, corresponding to the old `Randomly` and specifying how many executions to use the + same weights for. +- The `defaultWay`, `defaultMemType`, and `defaultBounds` values are all now re-exported. + +### Miscellaneous + +- Only dejafu 0.7 is supported. + +[tasty-dejafu-0.6.0.0]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.6.0.0 + + +--------------------------------------------------------------------------------------------------- + + +0.5.0.0 [2017-04-08] (git tag: [tasty-dejafu-0.5.0.0][]) +------- + +https://hackage.haskell.org/package/tasty-dejafu-0.5.0.0 + +### Test.Tasty.DejaFu + +- Due to changes in dejafu, the `Way` type no longer takes a parameter; it is now a GADT. + +### Miscellaneous + +- There is now a changelog. +- Every definition and instance now has a Haddock "@since" annotation. +- Only dejafu 0.6 is supported. + +[tasty-dejafu-0.5.0.0]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.5.0.0 + + +--------------------------------------------------------------------------------------------------- + + +0.4.0.0 [2017-02-21] (git tag: [tasty-dejafu-0.4.0.0][]) +------- + +https://hackage.haskell.org/package/tasty-dejafu-0.4.0.0 + +### Test.Tasty.DejaFu + +- All the functions which did take a `Bounds` now take a `Way` instead and support random scheduling + as well. +- The `Way` type from dejafu is now re-exported. +- The `IsOption` instance (and so corresponding command-line argument) for `Bounds` is gone. +- A new `IsOption` instance for `Way` (and so corresponding command-line argument): + - "systematically": systematic testing with the default bounds. + - "randomly": 100 executions with a fixed random seed. + +### Miscellaneous + +- The minimum supported version of dejafu has been increased to 0.5 (from 0.2) + +[tasty-dejafu-0.4.0.0]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.4.0.0 + + +--------------------------------------------------------------------------------------------------- + + +0.3.0.2 [2016-09-10] (git tag: [tasty-dejafu-0.3.0.2][]) +------- + +https://hackage.haskell.org/package/tasty-dejafu-0.3.0.2 + +### Miscellaneous + +- Now supports concurrency 1.0.0.0 and dejafu 0.4.0.0 + +[tasty-dejafu-0.3.0.2]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.3.0.2 + + +--------------------------------------------------------------------------------------------------- + + +0.3.0.1 [2016-05-26] (git tag: [tasty-dejafu-0.3.0.1][]) +------- + +https://hackage.haskell.org/package/tasty-dejafu-0.3.0.1 + +### Miscellaneous + +- Now supports GHC 8. + +[tasty-dejafu-0.3.0.1]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.3.0.1 + + +--------------------------------------------------------------------------------------------------- + + +0.3.0.0 [2016-04-28] (git tag: [tasty-dejafu-0.3.0.0][]) +------- + +https://hackage.haskell.org/package/tasty-dejafu-0.3.0.0 + +### Test.Tasty.DejaFu + +- New `IsTest` instances for `ConcST t (Maybe String)` and `ConcIO (Maybe String)`, with a `Just + String` result being a test failure with an error message. +- The `Bounds` type from dejafu is now re-exported. +- New `IsOption` instances for `Bounds` and `MemType`. +- New command-line parameter to set the `MemType` parameter: + - "sc": sequential consistency. + - "tso": total store order. + - "pso": partial store order. + +### Miscellaneous + +- Now supports dejafu 0.2 (again). + +[tasty-dejafu-0.3.0.0]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.3.0.0 + + +--------------------------------------------------------------------------------------------------- + + +0.1.1.0 [2016-04-03] (git tag: [tasty-dejafu-0.1.1.0][]) +------- + +**This version was never pushed to hackage, whoops!** + +**This version was misnumbered! It should have been 0.2.1.0!** + +### Miscellaneous + +- Now supports dejafu 0.3, but drops support for dejafu 0.2. + +[tasty-dejafu-0.1.1.0]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.1.1.0 + + +--------------------------------------------------------------------------------------------------- + + +0.2.0.0 [2015-12-01] (git tag: [0.2.0.0][]) +------- + +https://hackage.haskell.org/package/tasty-dejafu-0.2.0.0 + +Initial release. Go read the API docs. + +[0.2.0.0]: https://github.com/barrucadu/dejafu/releases/tag/0.2.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tasty-dejafu-0.3.0.2/README.markdown new/tasty-dejafu-0.6.0.0/README.markdown --- old/tasty-dejafu-0.3.0.2/README.markdown 1970-01-01 01:00:00.000000000 +0100 +++ new/tasty-dejafu-0.6.0.0/README.markdown 2016-05-26 17:52:10.000000000 +0200 @@ -0,0 +1,21 @@ +tasty-dejafu +============ + +Integration between the [dejafu][] library for concurrency testing and +[tasty][]. This lets you easily incorporate concurrency testing into +your existing test suites. + +The documentation of the latest developmental version is +[available online][docs]. + +Contributing +------------ + +Bug reports, pull requests, and comments are very welcome! + +Feel free to contact me on GitHub, through IRC (#haskell on freenode), +or email (mike@barrucadu.co.uk). + +[docs]: https://docs.barrucadu.co.uk/tasty-dejafu +[dejafu]: https://hackage.haskell.org/package/dejafu +[tasty]: https://hackage.haskell.org/package/tasty diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tasty-dejafu-0.3.0.2/Setup.hs new/tasty-dejafu-0.6.0.0/Setup.hs --- old/tasty-dejafu-0.3.0.2/Setup.hs 2016-04-13 01:32:08.000000000 +0200 +++ new/tasty-dejafu-0.6.0.0/Setup.hs 2017-04-08 06:43:07.000000000 +0200 @@ -1,2 +1,2 @@ -import Distribution.Simple +import Distribution.Simple main = defaultMain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tasty-dejafu-0.3.0.2/Test/Tasty/DejaFu.hs new/tasty-dejafu-0.6.0.0/Test/Tasty/DejaFu.hs --- old/tasty-dejafu-0.3.0.2/Test/Tasty/DejaFu.hs 2016-08-28 15:57:25.000000000 +0200 +++ new/tasty-dejafu-0.6.0.0/Test/Tasty/DejaFu.hs 2017-06-07 18:08:50.000000000 +0200 @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} @@ -16,7 +17,7 @@ -- License : MIT -- Maintainer : Michael Walker <mike@barrucadu.co.uk> -- Stability : stable --- Portability : CPP, FlexibleInstances, GADTs, ImpredicativeTypes, RankNTypes, TypeSynonymInstances +-- Portability : CPP, FlexibleContexts, FlexibleInstances, GADTs, ImpredicativeTypes, RankNTypes, TypeSynonymInstances -- -- This module allows using Deja Fu predicates with Tasty to test the -- behaviour of concurrent systems. @@ -37,90 +38,102 @@ , testDejafu , testDejafus - , testAuto' - , testDejafu' - , testDejafus' + , testAutoWay + , testDejafuWay + , testDejafusWay -- ** @IO@ , testAutoIO , testDejafuIO , testDejafusIO - , testAutoIO' - , testDejafuIO' - , testDejafusIO' - - -- * Re-exports + , testAutoWayIO + , testDejafuWayIO + , testDejafusWayIO + + -- ** Re-exports + , Way + , defaultWay + , systematically + , randomly + , uniformly + , swarmy , Bounds(..) + , defaultBounds , MemType(..) + , defaultMemType + + -- * Refinement property testing + , testProperty + + -- ** Re-exports + , R.Sig(..) + , R.RefinementProperty + , R.Testable(..) + , R.Listable(..) + , R.expectFailure + , R.refines, (R.=>=) + , R.strictlyRefines, (R.->-) + , R.equivalentTo, (R.===) ) where -import Control.Monad.ST (runST) -import Data.Char (toUpper) -import Data.List (intercalate, intersperse) -import Data.Proxy (Proxy(..)) -import Data.Tagged (Tagged(..)) -import Data.Typeable (Typeable) -import Test.DejaFu -import qualified Test.DejaFu.SCT as SCT -import Test.Tasty (TestName, TestTree, testGroup) -import Test.Tasty.Options (OptionDescription(..), IsOption(..), lookupOption) -import Test.Tasty.Providers (IsTest(..), singleTest, testPassed, testFailed) - -#if MIN_VERSION_dejafu(0,4,0) -import qualified Test.DejaFu.Conc as Conc -#else -import qualified Test.DejaFu.Deterministic as Conc -#endif +import Control.Monad.ST (runST) +import Data.Char (toUpper) +import qualified Data.Foldable as F +import Data.List (intercalate, intersperse) +import Data.Proxy (Proxy(..)) +import Data.Tagged (Tagged(..)) +import Data.Typeable (Typeable) +import System.Random (mkStdGen) +import Test.DejaFu hiding (Testable(..)) +import qualified Test.DejaFu.Conc as Conc +import qualified Test.DejaFu.Refinement as R +import qualified Test.DejaFu.SCT as SCT +import Test.Tasty (TestName, TestTree, testGroup) +import Test.Tasty.Options (IsOption(..), OptionDescription(..), + lookupOption) +import Test.Tasty.Providers (IsTest(..), singleTest, testFailed, + testPassed) -- Can't put the necessary forall in the @IsTest ConcST t@ -- instance :( -import Unsafe.Coerce (unsafeCoerce) +import Unsafe.Coerce (unsafeCoerce) -#if MIN_VERSION_dejafu(0,3,0) -type Trc = Conc.Trace Conc.ThreadId Conc.ThreadAction Conc.Lookahead -#else -type Trc = Conc.Trace -#endif +runSCTst :: Way -> MemType -> (forall t. Conc.ConcST t a) -> [(Either Failure a, Conc.Trace)] +runSCTst way memtype conc = runST (SCT.runSCT way memtype conc) -sctBoundST :: MemType -> Bounds -> (forall t. Conc.ConcST t a) -> [(Either Failure a, Trc)] -sctBoundIO :: MemType -> Bounds -> Conc.ConcIO a -> IO [(Either Failure a, Trc)] - -#if MIN_VERSION_dejafu(0,4,0) -sctBoundST memtype cb conc = runST (SCT.sctBound memtype cb conc) -sctBoundIO = SCT.sctBound -#else -sctBoundST = SCT.sctBound -sctBoundIO = SCT.sctBoundIO -#endif +runSCTio :: Way -> MemType -> Conc.ConcIO a -> IO [(Either Failure a, Conc.Trace)] +runSCTio = SCT.runSCT -------------------------------------------------------------------------------- --- Unit testing +-- Tasty-style unit testing +-- | @since 0.3.0.0 instance Typeable t => IsTest (Conc.ConcST t (Maybe String)) where testOptions = Tagged concOptions run options conc callback = do let memtype = lookupOption options :: MemType - let bounds = lookupOption options :: Bounds - let sctBound' :: Conc.ConcST t (Maybe String) -> [(Either Failure (Maybe String), Trc)] - sctBound' = unsafeCoerce $ sctBoundST memtype bounds - let traces = sctBound' conc + let way = lookupOption options :: Way + let runSCTst' :: Conc.ConcST t (Maybe String) -> [(Either Failure (Maybe String), Conc.Trace)] + runSCTst' = unsafeCoerce $ runSCTst way memtype + let traces = runSCTst' conc run options (ConcTest traces assertableP) callback +-- | @since 0.3.0.0 instance IsTest (Conc.ConcIO (Maybe String)) where testOptions = Tagged concOptions run options conc callback = do let memtype = lookupOption options - let bounds = lookupOption options - let traces = sctBoundIO memtype bounds conc + let way = lookupOption options + let traces = runSCTio way memtype conc run options (ConcIOTest traces assertableP) callback concOptions :: [OptionDescription] concOptions = - [ Option (Proxy :: Proxy Bounds) - , Option (Proxy :: Proxy MemType) + [ Option (Proxy :: Proxy MemType) + , Option (Proxy :: Proxy Way) ] assertableP :: Predicate (Maybe String) @@ -128,54 +141,72 @@ Right (Just _) -> False _ -> True -instance IsOption Bounds where - defaultValue = defaultBounds - parseValue = const Nothing - optionName = Tagged "schedule-bounds" - optionHelp = Tagged "The schedule bounds to use. This cannot be set on the command line." - +-- | @since 0.3.0.0 instance IsOption MemType where defaultValue = defaultMemType - parseValue str = shortName (map toUpper str) where + parseValue = shortName . map toUpper where shortName "SC" = Just SequentialConsistency shortName "TSO" = Just TotalStoreOrder shortName "PSO" = Just PartialStoreOrder shortName _ = Nothing optionName = Tagged "memory-model" - optionHelp = Tagged "The memory model to use. This should be one of \"SC\", \"TSO\", or \"PSO\"." + optionHelp = Tagged "The memory model to use. This should be one of \"sc\", \"tso\", or \"pso\"." + +-- | @since 0.5.0.0 +instance IsOption Way where + defaultValue = defaultWay + parseValue = shortName . map toUpper where + shortName "SYSTEMATICALLY" = Just (systematically defaultBounds) + shortName "RANDOMLY" = Just (randomly (mkStdGen 42) 100) + shortName _ = Nothing + optionName = Tagged "way" + optionHelp = Tagged "The execution method to use. This should be one of \"systematically\" or \"randomly\"." + -------------------------------------------------------------------------------- --- Property testing +-- DejaFu-style unit testing -- | Automatically test a computation. In particular, look for -- deadlocks, uncaught exceptions, and multiple return values. --- +-- -- This uses the 'Conc' monad for testing, which is an instance of -- 'MonadConc'. If you need to test something which also uses -- 'MonadIO', use 'testAutoIO'. +-- +-- @since 0.2.0.0 testAuto :: (Eq a, Show a) => (forall t. Conc.ConcST t a) -- ^ The computation to test -> TestTree -testAuto = testAuto' defaultMemType +testAuto = testAutoWay defaultWay defaultMemType -- | Variant of 'testAuto' which tests a computation under a given --- memory model. -testAuto' :: (Eq a, Show a) - => MemType +-- execution way and memory model. +-- +-- @since 0.5.0.0 +testAutoWay :: (Eq a, Show a) + => Way + -- ^ How to execute the concurrent program. + -> MemType -- ^ The memory model to use for non-synchronised @CRef@ operations. -> (forall t. Conc.ConcST t a) -- ^ The computation to test -> TestTree -testAuto' memtype conc = testDejafus' memtype defaultBounds conc autocheckCases +testAutoWay way memtype conc = testDejafusWay way memtype conc autocheckCases -- | Variant of 'testAuto' for computations which do 'IO'. +-- +-- @since 0.2.0.0 testAutoIO :: (Eq a, Show a) => Conc.ConcIO a -> TestTree -testAutoIO = testAutoIO' defaultMemType +testAutoIO = testAutoWayIO defaultWay defaultMemType --- | Variant of 'testAuto'' for computations which do 'IO'. -testAutoIO' :: (Eq a, Show a) => MemType -> Conc.ConcIO a -> TestTree -testAutoIO' memtype concio = testDejafusIO' memtype defaultBounds concio autocheckCases +-- | Variant of 'testAutoWay' for computations which do 'IO'. +-- +-- @since 0.5.0.0 +testAutoWayIO :: (Eq a, Show a) + => Way -> MemType -> Conc.ConcIO a -> TestTree +testAutoWayIO way memtype concio = + testDejafusWayIO way memtype concio autocheckCases -- | Predicates for the various autocheck functions. autocheckCases :: Eq a => [(TestName, Predicate a)] @@ -186,6 +217,8 @@ ] -- | Check that a predicate holds. +-- +-- @since 0.2.0.0 testDejafu :: Show a => (forall t. Conc.ConcST t a) -- ^ The computation to test @@ -194,15 +227,17 @@ -> Predicate a -- ^ The predicate to check -> TestTree -testDejafu = testDejafu' defaultMemType defaultBounds +testDejafu = testDejafuWay defaultWay defaultMemType --- | Variant of 'testDejafu' which takes a memory model and --- pre-emption bound. -testDejafu' :: Show a - => MemType +-- | Variant of 'testDejafu' which takes a way to execute the program +-- and a memory model. +-- +-- @since 0.5.0.0 +testDejafuWay :: Show a + => Way + -- ^ How to execute the concurrent program. + -> MemType -- ^ The memory model to use for non-synchronised @CRef@ operations. - -> Bounds - -- ^ The schedule bounds. -> (forall t. Conc.ConcST t a) -- ^ The computation to test -> TestName @@ -210,89 +245,143 @@ -> Predicate a -- ^ The predicate to check -> TestTree -testDejafu' memtype cb conc name p = testDejafus' memtype cb conc [(name, p)] +testDejafuWay way memtype conc name p = + testDejafusWay way memtype conc [(name, p)] -- | Variant of 'testDejafu' which takes a collection of predicates to -- test. This will share work between the predicates, rather than -- running the concurrent computation many times for each predicate. +-- +-- @since 0.2.0.0 testDejafus :: Show a => (forall t. Conc.ConcST t a) -- ^ The computation to test -> [(TestName, Predicate a)] -- ^ The list of predicates (with names) to check -> TestTree -testDejafus = testDejafus' defaultMemType defaultBounds +testDejafus = testDejafusWay defaultWay defaultMemType --- | Variant of 'testDejafus' which takes a memory model and pre-emption --- bound. -testDejafus' :: Show a - => MemType +-- | Variant of 'testDejafus' which takes a way to execute the program +-- and a memory model. +-- +-- @since 0.5.0.0 +testDejafusWay :: Show a + => Way + -- ^ How to execute the concurrent program. + -> MemType -- ^ The memory model to use for non-synchronised @CRef@ operations. - -> Bounds - -- ^ The schedule bounds. -> (forall t. Conc.ConcST t a) -- ^ The computation to test -> [(TestName, Predicate a)] -- ^ The list of predicates (with names) to check -> TestTree -testDejafus' = testst +testDejafusWay = testst -- | Variant of 'testDejafu' for computations which do 'IO'. +-- +-- @since 0.2.0.0 testDejafuIO :: Show a => Conc.ConcIO a -> TestName -> Predicate a -> TestTree -testDejafuIO = testDejafuIO' defaultMemType defaultBounds +testDejafuIO = testDejafuWayIO defaultWay defaultMemType --- | Variant of 'testDejafu'' for computations which do 'IO'. -testDejafuIO' :: Show a => MemType -> Bounds -> Conc.ConcIO a -> TestName -> Predicate a -> TestTree -testDejafuIO' memtype cb concio name p = testDejafusIO' memtype cb concio [(name, p)] +-- | Variant of 'testDejafuWay' for computations which do 'IO'. +-- +-- @since 0.5.0.0 +testDejafuWayIO :: Show a + => Way -> MemType -> Conc.ConcIO a -> TestName -> Predicate a -> TestTree +testDejafuWayIO way memtype concio name p = + testDejafusWayIO way memtype concio [(name, p)] -- | Variant of 'testDejafus' for computations which do 'IO'. +-- +-- @since 0.2.0.0 testDejafusIO :: Show a => Conc.ConcIO a -> [(TestName, Predicate a)] -> TestTree -testDejafusIO = testDejafusIO' defaultMemType defaultBounds +testDejafusIO = testDejafusWayIO defaultWay defaultMemType + +-- | Variant of 'dejafusWay' for computations which do 'IO'. +-- +-- @since 0.5.0.0 +testDejafusWayIO :: Show a + => Way -> MemType -> Conc.ConcIO a -> [(TestName, Predicate a)] -> TestTree +testDejafusWayIO = testio + + +------------------------------------------------------------------------------- +-- Refinement property testing + +-- | Check a refinement property with a variety of seed values and +-- variable assignments. +-- +-- @since 0.6.0.0 +testProperty :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p)) + => TestName + -- ^ The name of the test. + -> p + -- ^ The property to check. + -> TestTree +testProperty = testprop --- | Variant of 'dejafus'' for computations which do 'IO'. -testDejafusIO' :: Show a => MemType -> Bounds -> Conc.ConcIO a -> [(TestName, Predicate a)] -> TestTree -testDejafusIO' = testio -------------------------------------------------------------------------------- -- Tasty integration data ConcTest where - ConcTest :: Show a => [(Either Failure a, Trc)] -> Predicate a -> ConcTest + ConcTest :: Show a => [(Either Failure a, Conc.Trace)] -> Predicate a -> ConcTest deriving Typeable data ConcIOTest where - ConcIOTest :: Show a => IO [(Either Failure a, Trc)] -> Predicate a -> ConcIOTest + ConcIOTest :: Show a => IO [(Either Failure a, Conc.Trace)] -> Predicate a -> ConcIOTest + deriving Typeable + +data PropTest where + PropTest :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p)) => p -> PropTest deriving Typeable instance IsTest ConcTest where - testOptions = return [] + testOptions = pure [] run _ (ConcTest traces p) _ = let err = showErr $ p traces - in return $ if null err then testPassed "" else testFailed err + in pure (if null err then testPassed "" else testFailed err) instance IsTest ConcIOTest where - testOptions = return [] + testOptions = pure [] run _ (ConcIOTest iotraces p) _ = do traces <- iotraces let err = showErr $ p traces - return $ if null err then testPassed "" else testFailed err + pure (if null err then testPassed "" else testFailed err) + +instance IsTest PropTest where + testOptions = pure [] + + run _ (PropTest p) _ = do + ce <- R.check' p + pure $ case ce of + Just c -> testFailed . init $ unlines + [ "*** Failure: " ++ + (if null (R.failingArgs c) then "" else unwords (R.failingArgs c) ++ " ") ++ + "(seed " ++ show (R.failingSeed c) ++ ")" + , " left: " ++ show (F.toList $ R.leftResults c) + , " right: " ++ show (F.toList $ R.rightResults c) + ] + Nothing -> testPassed "" -- | Produce a Tasty 'TestTree' from a Deja Fu test. -testst :: Show a => MemType -> Bounds -> (forall t. Conc.ConcST t a) -> [(TestName, Predicate a)] -> TestTree -testst memtype cb conc tests = case map toTest tests of +testst :: Show a + => Way -> MemType -> (forall t. Conc.ConcST t a) -> [(TestName, Predicate a)] -> TestTree +testst way memtype conc tests = case map toTest tests of [t] -> t ts -> testGroup "Deja Fu Tests" ts where toTest (name, p) = singleTest name $ ConcTest traces p - traces = sctBoundST memtype cb conc + traces = runSCTst way memtype conc -- | Produce a Tasty 'Test' from an IO-using Deja Fu test. -testio :: Show a => MemType -> Bounds -> Conc.ConcIO a -> [(TestName, Predicate a)] -> TestTree -testio memtype cb concio tests = case map toTest tests of +testio :: Show a + => Way -> MemType -> Conc.ConcIO a -> [(TestName, Predicate a)] -> TestTree +testio way memtype concio tests = case map toTest tests of [t] -> t ts -> testGroup "Deja Fu Tests" ts @@ -301,7 +390,12 @@ -- As with HUnit, constructing a test is side-effect free, so -- sharing of traces can't happen here. - traces = sctBoundIO memtype cb concio + traces = runSCTio way memtype concio + +-- | Produce a Tasty 'TestTree' from a Deja Fu refinement property test. +testprop :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p)) + => TestName -> p -> TestTree +testprop name = singleTest name . PropTest -- | Convert a test result into an error message on failure (empty -- string on success). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tasty-dejafu-0.3.0.2/tasty-dejafu.cabal new/tasty-dejafu-0.6.0.0/tasty-dejafu.cabal --- old/tasty-dejafu-0.3.0.2/tasty-dejafu.cabal 2016-08-28 15:57:25.000000000 +0200 +++ new/tasty-dejafu-0.6.0.0/tasty-dejafu.cabal 2017-06-07 18:08:05.000000000 +0200 @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: tasty-dejafu -version: 0.3.0.2 +version: 0.6.0.0 synopsis: Deja Fu support for the Tasty test framework. description: @@ -11,9 +11,6 @@ <https://hackage.haskell.org/package/tasty tasty>. This lets you easily incorporate concurrency testing into your existing test suites. - . - See the <https://github.com/barrucadu/dejafu README> for more - details. homepage: https://github.com/barrucadu/dejafu license: MIT @@ -23,7 +20,7 @@ -- copyright: category: Testing build-type: Simple --- extra-source-files: +extra-source-files: README.markdown CHANGELOG.markdown cabal-version: >=1.10 source-repository head @@ -33,14 +30,15 @@ source-repository this type: git location: https://github.com/barrucadu/dejafu.git - tag: tasty-dejafu-0.3.0.1 + tag: tasty-dejafu-0.6.0.0 library exposed-modules: Test.Tasty.DejaFu -- other-modules: -- other-extensions: build-depends: base >=4.8 && <5 - , dejafu >=0.2 && <0.5 + , dejafu >=0.7 && <0.8 + , random >=1.0 && <1.2 , tagged >=0.8 && <0.9 , tasty >=0.10 && <0.12 -- hs-source-dirs:
participants (1)
-
root@hilbert.suse.de