summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/should_run/allocLimit2.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/concurrent/should_run/allocLimit2.hs')
-rw-r--r--testsuite/tests/concurrent/should_run/allocLimit2.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/concurrent/should_run/allocLimit2.hs b/testsuite/tests/concurrent/should_run/allocLimit2.hs
new file mode 100644
index 0000000000..4fd117b615
--- /dev/null
+++ b/testsuite/tests/concurrent/should_run/allocLimit2.hs
@@ -0,0 +1,17 @@
+module Main (main) where
+
+import GHC.Conc
+import Control.Concurrent
+import Control.Exception
+import System.Exit
+
+main = do
+ m <- newEmptyMVar
+ let action = do setAllocationCounter (10*1024)
+ enableAllocationLimit
+ print (length [1..])
+ forkFinally action (putMVar m)
+ r <- takeMVar m
+ case r of
+ Left e | Just AllocationLimitExceeded <- fromException e -> return ()
+ _ -> print r >> exitFailure