on master help sign in
disable some intermittently failing tests
83dc30aHarendra Kumar
test/Main.hs+16−13
@@ -40,8 +40,24 @@ main :: IO ()
40main = hspec $ do
40main = hspec $ do
41 parallelTests
41 parallelTests
42
42
43+ describe "restricts concurrency and cleans up extra tasks" $ do
44+ it "take 1 asyncly" $ checkCleanup 2 asyncly (S.take 1)
45+ it "take 1 wAsyncly" $ checkCleanup 2 wAsyncly (S.take 1)
46+ it "take 1 aheadly" $ checkCleanup 2 aheadly (S.take 1)
47+
48+ it "takeWhile (< 0) asyncly" $ checkCleanup 2 asyncly (S.takeWhile (< 0))
49+ it "takeWhile (< 0) wAsyncly" $ checkCleanup 2 wAsyncly (S.takeWhile (< 0))
50+ it "takeWhile (< 0) aheadly" $ checkCleanup 2 aheadly (S.takeWhile (< 0))
51+
52+#ifdef DEVBUILD
53+ let timed :: (IsStream t, Monad (t IO)) => Int -> t IO Int
54+ timed x = S.yieldM (threadDelay (x * 100000)) >> return x
55+
43 -- These are not run parallely because the timing gets affected
56 -- These are not run parallely because the timing gets affected
44 -- unpredictably when other tests are running on the same machine.
57 -- unpredictably when other tests are running on the same machine.
58+ --
59+ -- Also, they fail intermittently due to scheduling delays, so not run on
60+ -- CI machines.
45 describe "Nested parallel and serial compositions" $ do
61 describe "Nested parallel and serial compositions" $ do
46 let t = timed
62 let t = timed
47 p = wAsyncly
63 p = wAsyncly
@@ -83,16 +99,6 @@ main = hspec $ do
83 <> ((t 4 <> t 8) <> (t 0 <> t 2)))
99 <> ((t 4 <> t 8) <> (t 0 <> t 2)))
84 `shouldReturn` ([0,0,2,2,4,4,8,8])
100 `shouldReturn` ([0,0,2,2,4,4,8,8])
85
101
86− describe "restricts concurrency and cleans up extra tasks" $ do
87− it "take 1 asyncly" $ checkCleanup 2 asyncly (S.take 1)
88− it "take 1 wAsyncly" $ checkCleanup 2 wAsyncly (S.take 1)
89− it "take 1 aheadly" $ checkCleanup 2 aheadly (S.take 1)
90−
91− it "takeWhile (< 0) asyncly" $ checkCleanup 2 asyncly (S.takeWhile (< 0))
92− it "takeWhile (< 0) wAsyncly" $ checkCleanup 2 wAsyncly (S.takeWhile (< 0))
93− it "takeWhile (< 0) aheadly" $ checkCleanup 2 aheadly (S.takeWhile (< 0))
94−
95−#ifdef DEVBUILD
96 -- parallely fails on CI machines, may need more difference in times of
102 -- parallely fails on CI machines, may need more difference in times of
97 -- the events, but that would make tests even slower.
103 -- the events, but that would make tests even slower.
98 it "take 1 parallely" $ checkCleanup 3 parallely (S.take 1)
104 it "take 1 parallely" $ checkCleanup 3 parallely (S.take 1)
@@ -789,9 +795,6 @@ nestTwoParallelApp =
789 in ((S.toList . parallely) ((+) <$> s1 <*> s2) >>= return . sort)
795 in ((S.toList . parallely) ((+) <$> s1 <*> s2) >>= return . sort)
790 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
796 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
791
797
792−timed :: (IsStream t, Monad (t IO)) => Int -> t IO Int
793−timed x = S.yieldM (threadDelay (x * 100000)) >> return x
794−
795interleaveCheck :: IsStream t
798interleaveCheck :: IsStream t
796 => (t IO Int -> SerialT IO Int)
799 => (t IO Int -> SerialT IO Int)
797 -> (t IO Int -> t IO Int -> t IO Int)
800 -> (t IO Int -> t IO Int -> t IO Int)