[commit: testsuite] master: add a test for #4018 (5fe8eb5)

Simon Marlow marlowsd at gmail.com
Tue Dec 13 16:03:32 CET 2011


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/5fe8eb53dc44e6ef56b94d174f052153b9e6cda8

>---------------------------------------------------------------

commit 5fe8eb53dc44e6ef56b94d174f052153b9e6cda8
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Tue Dec 13 09:10:23 2011 +0000

    add a test for #4018

>---------------------------------------------------------------

 tests/perf/space_leaks/T4018.hs |   27 +++++++++++++++++++++++++++
 tests/perf/space_leaks/all.T    |    4 ++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/tests/perf/space_leaks/T4018.hs b/tests/perf/space_leaks/T4018.hs
new file mode 100644
index 0000000..b377878
--- /dev/null
+++ b/tests/perf/space_leaks/T4018.hs
@@ -0,0 +1,27 @@
+module Main (main) where
+
+ import Foreign
+ import Control.Concurrent
+
+ -- always space-leaks with 6.12.x and -fno-state-hack, see #4018
+ {-
+ always :: Monad m => m a -> m b
+ always a = a >> always a
+ -}
+ always :: Monad m => m a -> m b
+ always a = do
+     _ <- a
+     always a
+
+ spawner :: IO ()
+ spawner = always $ do
+     forkIO $ always $ allocaBytes 4 $ \p -> return ()
+     -- putStrLn "Delaying"
+     threadDelay 1000000
+
+ main :: IO ()
+ main = do
+     -- putStrLn "Spawning"
+     forkIO spawner
+     -- putStrLn "Delaying main"
+     threadDelay 3000000
diff --git a/tests/perf/space_leaks/all.T b/tests/perf/space_leaks/all.T
index 809ec01..2d69864 100644
--- a/tests/perf/space_leaks/all.T
+++ b/tests/perf/space_leaks/all.T
@@ -37,3 +37,7 @@ test('T2762',
       only_ways(['normal']),
       extra_clean(['T2762A.hi', 'T2762A.o'])],
      compile_and_run, ['-O'])
+
+test('T4018',
+     [ only_ways(['optasm']), extra_run_opts('+RTS -M10m -RTS') ],
+     compile_and_run, ['-fno-state-hack'])





More information about the Cvs-ghc mailing list