summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-02-14 13:15:30 +0000
committerSimon Marlow <marlowsd@gmail.com>2013-02-14 13:15:30 +0000
commitc02f121352d5adf6ea76f4c782381bff5d16a89f (patch)
tree1eed7ad84069e696b6331183d0fe3c895a976055
parent00a3d583c3567dfdd8cf4d2d194487175335c52d (diff)
downloadhaskell-c02f121352d5adf6ea76f4c782381bff5d16a89f.tar.gz
add a StableName test
-rw-r--r--testsuite/tests/rts/all.T4
-rw-r--r--testsuite/tests/rts/stablename001.hs13
-rw-r--r--testsuite/tests/rts/stablename001.stdout1
3 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index 3ccd142975..d96e5476d3 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/tests/rts/all.T
@@ -164,3 +164,7 @@ test('T7227', [ extra_run_opts('+RTS -tT7227.stat --machine-readable -RTS'),
, compile_and_run, [''] )
test('T7636', [ exit_code(1), extra_run_opts('100000') ], compile_and_run, [''] )
+
+test('stablename001', expect_fail_for(['hpc']), compile_and_run, [''])
+# hpc should fail this, because it tags every variable occurrence with
+# a different tick. It's probably a bug if it works, hence expect_fail.
diff --git a/testsuite/tests/rts/stablename001.hs b/testsuite/tests/rts/stablename001.hs
new file mode 100644
index 0000000000..f046f7c7fc
--- /dev/null
+++ b/testsuite/tests/rts/stablename001.hs
@@ -0,0 +1,13 @@
+import System.Mem.StableName
+import System.Mem
+
+-- Test that we get the same StableName even after a GC. This is easy
+-- to get wrong, by not following indirections properly.
+
+main = do
+ let x = [1..10]
+ seq x (return ())
+ n1 <- makeStableName x
+ performGC
+ n2 <- makeStableName x
+ print (n1 == n2)
diff --git a/testsuite/tests/rts/stablename001.stdout b/testsuite/tests/rts/stablename001.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/rts/stablename001.stdout
@@ -0,0 +1 @@
+True