[project @ 2000-09-04 15:23:55 by simonmar]
authorsimonmar <unknown>
Mon, 4 Sep 2000 15:23:55 +0000 (15:23 +0000)
committersimonmar <unknown>
Mon, 4 Sep 2000 15:23:55 +0000 (15:23 +0000)
Test for freeing StablePtrs.

ghc/tests/lib/should_run/Makefile
ghc/tests/lib/should_run/stableptr004.hs [new file with mode: 0644]
ghc/tests/lib/should_run/stableptr004.stdout [new file with mode: 0644]

index 521f66d..2a14739 100644 (file)
@@ -1,5 +1,5 @@
 #-----------------------------------------------------------------------------
-# $Id: Makefile,v 1.23 2000/06/29 21:08:02 panne Exp $
+# $Id: Makefile,v 1.24 2000/09/04 15:23:55 simonmar Exp $
 
 TOP = ../..
 include $(TOP)/mk/boilerplate.mk
@@ -12,6 +12,7 @@ exceptions001_HC_OPTS   = -fglasgow-exts -fno-warn-missing-methods
 stableptr001_HC_OPTS    = -fglasgow-exts
 stableptr002_HC_OPTS    = -fglasgow-exts
 stableptr003_HC_OPTS    = -fglasgow-exts
+stableptr004_HC_OPTS    = -fglasgow-exts
 list001_HC_OPTS         = -fglasgow-exts
 uri001_HC_OPTS         = -package lang -package net
 time001_HC_OPTS                = -package lang
@@ -21,6 +22,7 @@ enum02_HC_OPTS                = -cpp -fglasgow-exts -H12m
 enum03_HC_OPTS         = -cpp -fglasgow-exts -H12m
 
 stableptr001_RUNTEST_OPTS = +RTS -K4m
+stableptr004_RUNTEST_OPTS = +RTS -K4m
 dynamic001_HC_OPTS = -package lang
 dynamic002_HC_OPTS = -package lang
 
diff --git a/ghc/tests/lib/should_run/stableptr004.hs b/ghc/tests/lib/should_run/stableptr004.hs
new file mode 100644 (file)
index 0000000..523bdb2
--- /dev/null
@@ -0,0 +1,12 @@
+import StablePtr
+
+-- compile without optimisation.
+-- run with +RTS -D256 to see the stable pointer being garbage collected.
+
+main = do
+  let xs = [ 1 .. 50000 ]
+  let ys = [ 1 .. 60000 ]
+  s1 <- makeStablePtr xs
+  print (sum xs)
+  freeStablePtr s1
+  print (sum ys)
diff --git a/ghc/tests/lib/should_run/stableptr004.stdout b/ghc/tests/lib/should_run/stableptr004.stdout
new file mode 100644 (file)
index 0000000..30e717b
--- /dev/null
@@ -0,0 +1,2 @@
+1250025000
+1800030000