on master help sign in
Fix -DCOVERAGE_BUILD
commit9522eb15df2eb914fed6b62213d09e6e5e92dde7 authorHarendra Kumar <harendra@composewell.com> dateFri 1 Jan 2021, 02:06 (6 years ago) parentc006520
6 files changed+36−6
cabal.project.coverage+2 test/Streamly/Test/Prelude/Concurrent.hs+11 test/Streamly/Test/Prelude/Fold.hs+3 test/Streamly/Test/Prelude/Parallel.hs+4−1 test/Streamly/Test/Prelude/Serial.hs+4−2 test/lib/Streamly/Test/Prelude/Common.hs+12−3
cabal.project.coverage+2
@@ -9,3 +9,5 @@ package streamly
99
1010package streamly-tests
1111 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
352352
353353 -- For concurrent application test we need a buffer of at least size 2 to
354354 -- allow two threads to run.
355+#ifndef COVERAGE_BUILD
355356 let makeConcurrentAppOps :: IsStream t
356357 => (t m a -> c) -> [(String, t m a -> c)]
358+#endif
357359 makeConcurrentAppOps t = makeCommonOps t ++
358360 [
359361#ifndef COVERAGE_BUILD
@@ -361,7 +363,11 @@ main = hspec
361363#endif
362364 ]
363365
366+#ifndef COVERAGE_BUILD
364367 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
365371 parallelCommonOps = []
366372#ifndef COVERAGE_BUILD
367373 <> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
@@ -375,7 +381,12 @@ main = hspec
375381
376382 -- These tests won't work with maxBuffer or maxThreads set to 1, so we
377383 -- exclude those cases from these.
384+#ifndef COVERAGE_BUILD
378385 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
379390 mkOps t =
380391 [ ("default", t)
381392#ifndef COVERAGE_BUILD
test/Streamly/Test/Prelude/Fold.hs+3
@@ -14,6 +14,9 @@ import Control.Concurrent (threadDelay)
1414#endif
1515import Control.Exception (ErrorCall(..), catch)
1616import Data.IORef ( newIORef, readIORef, writeIORef, IORef )
17+#ifdef COVERAGE_BUILD
18+import Test.Hspec.QuickCheck (modifyMaxSuccess)
19+#endif
1720import Test.Hspec as H
1821#ifdef DEVBUILD
1922import System.Mem (performMajorGC)
test/Streamly/Test/Prelude/Parallel.hs+4−1
@@ -28,7 +28,10 @@ main = hspec
2828 $ modifyMaxSuccess (const 10)
2929#endif
3030 $ do
31− let parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
31+ let
32+#ifndef COVERAGE_BUILD
33+ parallelCommonOps :: IsStream t => [(String, ParallelT m a -> t m a)]
34+#endif
3235 parallelCommonOps = []
3336#ifndef COVERAGE_BUILD
3437 <> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
test/Streamly/Test/Prelude/Serial.hs+4−2
@@ -38,8 +38,10 @@ import Test.QuickCheck
3838import Test.QuickCheck.Monadic (assert, monadicIO, pick, run)
3939import Test.Hspec as H
4040
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
4345import qualified Streamly.Prelude as S
4446import qualified Streamly.Data.Fold as FL
4547import qualified Streamly.Internal.Data.Unfold as UF
test/lib/Streamly/Test/Prelude/Common.hs+12−3
@@ -127,9 +127,10 @@ import Test.Hspec
127127import Test.QuickCheck (Property, choose, forAll, withMaxSuccess)
128128import Test.QuickCheck.Monadic (assert, monadicIO, run)
129129
130−import Streamly.Prelude
131− ( SerialT, IsStream, (.:), nil, (|&), serially, avgRate, rate, maxBuffer
132− , maxThreads, maxBuffer)
130+import Streamly.Prelude (SerialT, IsStream, (.:), nil, (|&), serially)
131+#ifndef COVERAGE_BUILD
132+import Streamly.Prelude (avgRate, rate, maxBuffer, maxThreads)
133+#endif
133134import qualified Streamly.Prelude as S
134135import qualified Streamly.Data.Fold as FL
135136import qualified Streamly.Internal.Data.Fold as FL
@@ -1710,7 +1711,11 @@ folded =
17101711 [x] -> return x -- singleton stream case
17111712 _ -> S.concatMapFoldableWith (<>) return xs)
17121713
1714+#ifndef COVERAGE_BUILD
17131715makeCommonOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
1716+#else
1717+makeCommonOps :: b -> [(String, b)]
1718+#endif
17141719makeCommonOps t =
17151720 [ ("default", t)
17161721#ifndef COVERAGE_BUILD
@@ -1723,7 +1728,11 @@ makeCommonOps t =
17231728#endif
17241729 ]
17251730
1731+#ifndef COVERAGE_BUILD
17261732makeOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
1733+#else
1734+makeOps :: b -> [(String, b)]
1735+#endif
17271736makeOps t = makeCommonOps t ++
17281737 [
17291738#ifndef COVERAGE_BUILD