on master help sign in
Fix -DCOVERAGE_BUILD
9522eb1Harendra Kumar
cabal.project.coverage+2
@@ -9,3 +9,5 @@ package streamly
9
9
10package streamly-tests
10package streamly-tests
11 ghc-options: -Werror
11 ghc-options: -Werror
12+ -- A few percent lesss coverage for some build speedup
13+ -- -DCOVERAGE_BUILD
test/Streamly/Test/Prelude/Concurrent.hs+11
@@ -352,8 +352,10 @@ main = hspec
352
352
353 -- For concurrent application test we need a buffer of at least size 2 to
353 -- For concurrent application test we need a buffer of at least size 2 to
354 -- allow two threads to run.
354 -- allow two threads to run.
355+#ifndef COVERAGE_BUILD
355 let makeConcurrentAppOps :: IsStream t
356 let makeConcurrentAppOps :: IsStream t
356 => (t m a -> c) -> [(String, t m a -> c)]
357 => (t m a -> c) -> [(String, t m a -> c)]
358+#endif
357 makeConcurrentAppOps t = makeCommonOps t ++
359 makeConcurrentAppOps t = makeCommonOps t ++
358 [
360 [
359#ifndef COVERAGE_BUILD
361#ifndef COVERAGE_BUILD
@@ -361,7 +363,11 @@ main = hspec
361#endif
363#endif
362 ]
364 ]
363
365
366+#ifndef COVERAGE_BUILD
364 let parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
367 let parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
368+#else
369+ let parallelCommonOps :: [(String, ParallelT m a -> t m a)]
370+#endif
365 parallelCommonOps = []
371 parallelCommonOps = []
366#ifndef COVERAGE_BUILD
372#ifndef COVERAGE_BUILD
367 <> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
373 <> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
@@ -375,7 +381,12 @@ main = hspec
375
381
376 -- These tests won't work with maxBuffer or maxThreads set to 1, so we
382 -- These tests won't work with maxBuffer or maxThreads set to 1, so we
377 -- exclude those cases from these.
383 -- exclude those cases from these.
384+#ifndef COVERAGE_BUILD
378 let mkOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
385 let mkOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
386+#else
387+ let mkOps :: t -> [(String, t)]
388+ -- let mkOps :: (t m a -> c) -> [(String, t m a -> c)]
389+#endif
379 mkOps t =
390 mkOps t =
380 [ ("default", t)
391 [ ("default", t)
381#ifndef COVERAGE_BUILD
392#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/Fold.hs+3
@@ -14,6 +14,9 @@ import Control.Concurrent (threadDelay)
14#endif
14#endif
15import Control.Exception (ErrorCall(..), catch)
15import Control.Exception (ErrorCall(..), catch)
16import Data.IORef ( newIORef, readIORef, writeIORef, IORef )
16import Data.IORef ( newIORef, readIORef, writeIORef, IORef )
17+#ifdef COVERAGE_BUILD
18+import Test.Hspec.QuickCheck (modifyMaxSuccess)
19+#endif
17import Test.Hspec as H
20import Test.Hspec as H
18#ifdef DEVBUILD
21#ifdef DEVBUILD
19import System.Mem (performMajorGC)
22import System.Mem (performMajorGC)
test/Streamly/Test/Prelude/Parallel.hs+4−1
@@ -28,7 +28,10 @@ main = hspec
28 $ modifyMaxSuccess (const 10)
28 $ modifyMaxSuccess (const 10)
29#endif
29#endif
30 $ do
30 $ do
31+ let
32+#ifndef COVERAGE_BUILD
31− let parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
33+ parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
34+#endif
32 parallelCommonOps = []
35 parallelCommonOps = []
33#ifndef COVERAGE_BUILD
36#ifndef COVERAGE_BUILD
34 <> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
37 <> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
test/Streamly/Test/Prelude/Serial.hs+4−2
@@ -38,8 +38,10 @@ import Test.QuickCheck
38import Test.QuickCheck.Monadic (assert, monadicIO, pick, run)
38import Test.QuickCheck.Monadic (assert, monadicIO, pick, run)
39import Test.Hspec as H
39import Test.Hspec as H
40
40
41−import Streamly.Prelude
42− ( SerialT, IsStream, avgRate, maxBuffer, serial, serially)
41+import Streamly.Prelude (SerialT, IsStream, serial, serially)
42+#ifndef COVERAGE_BUILD
43+import Streamly.Prelude (avgRate, maxBuffer)
44+#endif
43import qualified Streamly.Prelude as S
45import qualified Streamly.Prelude as S
44import qualified Streamly.Data.Fold as FL
46import qualified Streamly.Data.Fold as FL
45import qualified Streamly.Internal.Data.Unfold as UF
47import qualified Streamly.Internal.Data.Unfold as UF
test/lib/Streamly/Test/Prelude/Common.hs+12−3
@@ -127,9 +127,10 @@ import Test.Hspec
127import Test.QuickCheck (Property, choose, forAll, withMaxSuccess)
127import Test.QuickCheck (Property, choose, forAll, withMaxSuccess)
128import Test.QuickCheck.Monadic (assert, monadicIO, run)
128import Test.QuickCheck.Monadic (assert, monadicIO, run)
129
129
130−import Streamly.Prelude
130+import Streamly.Prelude (SerialT, IsStream, (.:), nil, (|&), serially)
131+#ifndef COVERAGE_BUILD
131− ( SerialT, IsStream, (.:), nil, (|&), serially, avgRate, rate, maxBuffer
132+import Streamly.Prelude (avgRate, rate, maxBuffer, maxThreads)
132− , maxThreads, maxBuffer)
133+#endif
133import qualified Streamly.Prelude as S
134import qualified Streamly.Prelude as S
134import qualified Streamly.Data.Fold as FL
135import qualified Streamly.Data.Fold as FL
135import qualified Streamly.Internal.Data.Fold as FL
136import qualified Streamly.Internal.Data.Fold as FL
@@ -1710,7 +1711,11 @@ folded =
1710 [x] -> return x -- singleton stream case
1711 [x] -> return x -- singleton stream case
1711 _ -> S.concatMapFoldableWith (<>) return xs)
1712 _ -> S.concatMapFoldableWith (<>) return xs)
1712
1713
1714+#ifndef COVERAGE_BUILD
1713makeCommonOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
1715makeCommonOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
1716+#else
1717+makeCommonOps :: b -> [(String, b)]
1718+#endif
1714makeCommonOps t =
1719makeCommonOps t =
1715 [ ("default", t)
1720 [ ("default", t)
1716#ifndef COVERAGE_BUILD
1721#ifndef COVERAGE_BUILD
@@ -1723,7 +1728,11 @@ makeCommonOps t =
1723#endif
1728#endif
1724 ]
1729 ]
1725
1730
1731+#ifndef COVERAGE_BUILD
1726makeOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
1732makeOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
1733+#else
1734+makeOps :: b -> [(String, b)]
1735+#endif
1727makeOps t = makeCommonOps t ++
1736makeOps t = makeCommonOps t ++
1728 [
1737 [
1729#ifndef COVERAGE_BUILD
1738#ifndef COVERAGE_BUILD