From: simonm Date: Tue, 4 Aug 1998 15:21:17 +0000 (+0000) Subject: [project @ 1998-08-04 15:21:15 by simonm] X-Git-Tag: Approx_2487_patches~493 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=ae785972fef6fdbe960a2dbac46c02ff1e362e27;p=ghc-hetmet.git [project @ 1998-08-04 15:21:15 by simonm] add a quick stable ptr stress test. --- diff --git a/ghc/tests/lib/should_run/Makefile b/ghc/tests/lib/should_run/Makefile index 0f59dc7..dfd259d 100644 --- a/ghc/tests/lib/should_run/Makefile +++ b/ghc/tests/lib/should_run/Makefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# $Id: Makefile,v 1.2 1998/07/08 10:36:54 simonm Exp $ +# $Id: Makefile,v 1.3 1998/08/04 15:21:15 simonm Exp $ TOP = ../.. include $(TOP)/mk/boilerplate.mk @@ -8,6 +8,7 @@ include $(TOP)/mk/should_run.mk SRC_HC_OPTS += -dcore-lint packedstring001_HC_OPTS = -syslib misc +stableptr001_RUNTEST_OPTS = +RTS -K4m SRC_MKDEPENDHS_OPTS += -syslib misc diff --git a/ghc/tests/lib/should_run/stableptr001.hs b/ghc/tests/lib/should_run/stableptr001.hs new file mode 100644 index 0000000..42ee1fe --- /dev/null +++ b/ghc/tests/lib/should_run/stableptr001.hs @@ -0,0 +1,20 @@ +{-# OPTIONS -fglasgow-exts #-} + +module Main where + +import Foreign + +-- simple test for building/dereferencing stable ptrs + +main + = do l <- mapM makeStablePtr [1..100000] + sum <- stable_sum l + print sum + +stable_sum :: [StablePtr Integer] -> IO Integer +stable_sum [] = return 0 +stable_sum (x:xs) + = do x' <- deRefStablePtr x + freeStablePtr x + xs' <- stable_sum xs + return (x' + xs') diff --git a/ghc/tests/lib/should_run/stableptr001.stdout b/ghc/tests/lib/should_run/stableptr001.stdout new file mode 100644 index 0000000..90ee71a --- /dev/null +++ b/ghc/tests/lib/should_run/stableptr001.stdout @@ -0,0 +1 @@ +5000050000