on master help sign in
Hide failing parallel tests behind a DEVBUILD.
commit425adca3e43b4060a8bb0268776b12bddded1956 authorPranay Sashank <pranaysashank@composewell.com> dateSun 6 Dec 2020, 12:01 (6 years ago) parentb6fe733
1 file changed+18−4
test/Streamly/Test/Prelude/Common.hs+18−4
test/Streamly/Test/Prelude/Common.hs+18−4
@@ -88,9 +88,13 @@ module Streamly.Test.Prelude.Common
8888import Control.Applicative (ZipList(..), liftA2)
8989import Control.Exception (Exception, try)
9090import Control.Concurrent (threadDelay)
91−import Control.Monad (replicateM, when)
91+import Control.Monad (replicateM)
92+#ifdef DEVBUILD
93+import Control.Monad (when)
94+#endif
9295import Control.Monad.Catch (throwM, MonadThrow)
93−import Data.IORef (IORef, modifyIORef', newIORef, readIORef, writeIORef)
96+import Data.IORef ( IORef, atomicModifyIORef', modifyIORef', newIORef
97+ , readIORef, writeIORef)
9498import Data.List
9599 ( delete
96100 , deleteBy
@@ -1398,7 +1402,8 @@ beforeProp t vec =
13981402 run
13991403 $ S.drain . t
14001404 $ S.before (writeIORef ioRef [0])
1401− $ S.mapM (\a -> modifyIORef' ioRef (++ [a]) >> return a)
1405+ $ S.mapM (\a -> do atomicModifyIORef' ioRef (\xs -> (xs ++ [a], ()))
1406+ return a)
14021407 $ S.fromList vec
14031408 refValue <- run $ readIORef ioRef
14041409 listEquals (==) (head refValue : sort (tail refValue)) (0:sort vec)
@@ -1411,7 +1416,8 @@ afterProp t vec =
14111416 run
14121417 $ S.drain . t
14131418 $ S.after (modifyIORef' ioRef (0:))
1414− $ S.mapM (\a -> modifyIORef' ioRef (a:) >> return a)
1419+ $ S.mapM (\a -> do atomicModifyIORef' ioRef (\xs -> (a:xs, ()))
1420+ return a)
14151421 $ S.fromList vec
14161422 refValue <- run $ readIORef ioRef
14171423 listEquals (==) (head refValue : sort (tail refValue)) (0:sort vec)
@@ -1433,6 +1439,7 @@ bracketProp t vec =
14331439 refValue <- run $ readIORef ioRef
14341440 assert $ refValue == 1
14351441
1442+#ifdef DEVBUILD
14361443bracketPartialStreamProp ::
14371444 (IsStream t) => (t IO Int -> SerialT IO Int) -> [Int] -> Property
14381445bracketPartialStreamProp t vec =
@@ -1456,6 +1463,7 @@ bracketPartialStreamProp t vec =
14561463 refValue <- run $ readIORef ioRef
14571464 when (refValue /= 0 && refValue /= 3) $
14581465 error $ "refValue == " ++ show refValue
1466+#endif
14591467
14601468bracketExceptionProp ::
14611469 (IsStream t, MonadThrow (t IO)
@@ -1493,6 +1501,7 @@ finallyProp t vec =
14931501 refValue <- run $ readIORef ioRef
14941502 assert $ refValue == 1
14951503
1504+#ifdef DEVBUILD
14961505finallyPartialStreamProp ::
14971506 (IsStream t) => (t IO Int -> SerialT IO Int) -> [Int] -> Property
14981507finallyPartialStreamProp t vec =
@@ -1514,6 +1523,7 @@ finallyPartialStreamProp t vec =
15141523 refValue <- run $ readIORef ioRef
15151524 when (refValue /= 0 && refValue /= 2) $
15161525 error $ "refValue == " ++ show refValue
1526+#endif
15171527
15181528finallyExceptionProp ::
15191529 (IsStream t, MonadThrow (t IO)
@@ -1588,11 +1598,15 @@ exceptionOps desc t = do
15881598 prop (desc <> " before") $ beforeProp t
15891599 prop (desc <> " after") $ afterProp t
15901600 prop (desc <> " bracket end of stream") $ bracketProp t
1601+#ifdef DEVBUILD
15911602 prop (desc <> " bracket partial stream") $ bracketPartialStreamProp t
1603+#endif
15921604 prop (desc <> " bracket exception in stream") $ bracketExceptionProp t
15931605 prop (desc <> " onException") $ onExceptionProp t
15941606 prop (desc <> " finally end of stream") $ finallyProp t
1607+#ifdef DEVBUILD
15951608 prop (desc <> " finally partial stream") $ finallyPartialStreamProp t
1609+#endif
15961610 prop (desc <> " finally exception in stream") $ finallyExceptionProp t
15971611 prop (desc <> " handle") $ handleProp t
15981612