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

View File

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

View File

@ -28,7 +28,10 @@ main = hspec
$ modifyMaxSuccess (const 10) $ modifyMaxSuccess (const 10)
#endif #endif
$ do $ 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 = [] parallelCommonOps = []
#ifndef COVERAGE_BUILD #ifndef COVERAGE_BUILD
<> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)] <> [("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.QuickCheck.Monadic (assert, monadicIO, pick, run)
import Test.Hspec as H import Test.Hspec as H
import Streamly.Prelude import Streamly.Prelude (SerialT, IsStream, serial, serially)
( SerialT, IsStream, avgRate, maxBuffer, serial, serially) #ifndef COVERAGE_BUILD
import Streamly.Prelude (avgRate, maxBuffer)
#endif
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import qualified Streamly.Data.Fold as FL import qualified Streamly.Data.Fold as FL
import qualified Streamly.Internal.Data.Unfold as UF 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 (Property, choose, forAll, withMaxSuccess)
import Test.QuickCheck.Monadic (assert, monadicIO, run) import Test.QuickCheck.Monadic (assert, monadicIO, run)
import Streamly.Prelude import Streamly.Prelude (SerialT, IsStream, (.:), nil, (|&), serially)
( SerialT, IsStream, (.:), nil, (|&), serially, avgRate, rate, maxBuffer #ifndef COVERAGE_BUILD
, maxThreads, maxBuffer) import Streamly.Prelude (avgRate, rate, maxBuffer, maxThreads)
#endif
import qualified Streamly.Prelude as S import qualified Streamly.Prelude as S
import qualified Streamly.Data.Fold as FL import qualified Streamly.Data.Fold as FL
import qualified Streamly.Internal.Data.Fold as FL import qualified Streamly.Internal.Data.Fold as FL
@ -1710,7 +1711,11 @@ folded =
[x] -> return x -- singleton stream case [x] -> return x -- singleton stream case
_ -> S.concatMapFoldableWith (<>) return xs) _ -> S.concatMapFoldableWith (<>) return xs)
#ifndef COVERAGE_BUILD
makeCommonOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)] makeCommonOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
#else
makeCommonOps :: b -> [(String, b)]
#endif
makeCommonOps t = makeCommonOps t =
[ ("default", t) [ ("default", t)
#ifndef COVERAGE_BUILD #ifndef COVERAGE_BUILD
@ -1723,7 +1728,11 @@ makeCommonOps t =
#endif #endif
] ]
#ifndef COVERAGE_BUILD
makeOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)] makeOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
#else
makeOps :: b -> [(String, b)]
#endif
makeOps t = makeCommonOps t ++ makeOps t = makeCommonOps t ++
[ [
#ifndef COVERAGE_BUILD #ifndef COVERAGE_BUILD