Fix -DCOVERAGE_BUILD

This commit is contained in:
Harendra Kumar 2021-01-01 02:06:15 +05:30
parent c0065208f2
commit 9522eb15df
6 changed files with 36 additions and 6 deletions

View File

@ -9,3 +9,5 @@ package streamly
package streamly-tests
ghc-options: -Werror
-- A few percent lesss coverage for some build speedup
-- -DCOVERAGE_BUILD

View File

@ -352,8 +352,10 @@ main = hspec
-- For concurrent application test we need a buffer of at least size 2 to
-- allow two threads to run.
#ifndef COVERAGE_BUILD
let makeConcurrentAppOps :: IsStream t
=> (t m a -> c) -> [(String, t m a -> c)]
#endif
makeConcurrentAppOps t = makeCommonOps t ++
[
#ifndef COVERAGE_BUILD
@ -361,7 +363,11 @@ main = hspec
#endif
]
#ifndef COVERAGE_BUILD
let parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
#else
let parallelCommonOps :: [(String, ParallelT m a -> t m a)]
#endif
parallelCommonOps = []
#ifndef COVERAGE_BUILD
<> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
@ -375,7 +381,12 @@ main = hspec
-- These tests won't work with maxBuffer or maxThreads set to 1, so we
-- exclude those cases from these.
#ifndef COVERAGE_BUILD
let mkOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
#else
let mkOps :: t -> [(String, t)]
-- let mkOps :: (t m a -> c) -> [(String, t m a -> c)]
#endif
mkOps t =
[ ("default", t)
#ifndef COVERAGE_BUILD

View File

@ -14,6 +14,9 @@ import Control.Concurrent (threadDelay)
#endif
import Control.Exception (ErrorCall(..), catch)
import Data.IORef ( newIORef, readIORef, writeIORef, IORef )
#ifdef COVERAGE_BUILD
import Test.Hspec.QuickCheck (modifyMaxSuccess)
#endif
import Test.Hspec as H
#ifdef DEVBUILD
import System.Mem (performMajorGC)

View File

@ -28,7 +28,10 @@ main = hspec
$ modifyMaxSuccess (const 10)
#endif
$ do
let parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
let
#ifndef COVERAGE_BUILD
parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
#endif
parallelCommonOps = []
#ifndef COVERAGE_BUILD
<> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]

View File

@ -38,8 +38,10 @@ import Test.QuickCheck
import Test.QuickCheck.Monadic (assert, monadicIO, pick, run)
import Test.Hspec as H
import Streamly.Prelude
( SerialT, IsStream, avgRate, maxBuffer, serial, serially)
import Streamly.Prelude (SerialT, IsStream, serial, serially)
#ifndef COVERAGE_BUILD
import Streamly.Prelude (avgRate, maxBuffer)
#endif
import qualified Streamly.Prelude as S
import qualified Streamly.Data.Fold as FL
import qualified Streamly.Internal.Data.Unfold as UF

View File

@ -127,9 +127,10 @@ import Test.Hspec
import Test.QuickCheck (Property, choose, forAll, withMaxSuccess)
import Test.QuickCheck.Monadic (assert, monadicIO, run)
import Streamly.Prelude
( SerialT, IsStream, (.:), nil, (|&), serially, avgRate, rate, maxBuffer
, maxThreads, maxBuffer)
import Streamly.Prelude (SerialT, IsStream, (.:), nil, (|&), serially)
#ifndef COVERAGE_BUILD
import Streamly.Prelude (avgRate, rate, maxBuffer, maxThreads)
#endif
import qualified Streamly.Prelude as S
import qualified Streamly.Data.Fold as FL
import qualified Streamly.Internal.Data.Fold as FL
@ -1710,7 +1711,11 @@ folded =
[x] -> return x -- singleton stream case
_ -> S.concatMapFoldableWith (<>) return xs)
#ifndef COVERAGE_BUILD
makeCommonOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
#else
makeCommonOps :: b -> [(String, b)]
#endif
makeCommonOps t =
[ ("default", t)
#ifndef COVERAGE_BUILD
@ -1723,7 +1728,11 @@ makeCommonOps t =
#endif
]
#ifndef COVERAGE_BUILD
makeOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
#else
makeOps :: b -> [(String, b)]
#endif
makeOps t = makeCommonOps t ++
[
#ifndef COVERAGE_BUILD