summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-10-27 18:03:10 +0200
committerAndreas Klebinger <klebinger.andreas@gmx.at>2022-12-06 13:26:33 +0100
commit3940339e9f141aa27bf9f284e47004a41a18b62a (patch)
treed9fa0ec19c9cce5d2a339fd3ae9c9cdfce6ea4de /testsuite/tests
parent1a767fa359d22ca7637af41e29434e76487c3f21 (diff)
downloadhaskell-wip/andreask/pinned.tar.gz
Don't consider large byte arrays/compact regions pinned.wip/andreask/pinned
Workaround for #22255 which showed how treating large/compact regions as pinned could cause segfaults.
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/rts/T13894.hs6
-rw-r--r--testsuite/tests/rts/T14900.hs2
-rw-r--r--testsuite/tests/rts/T14900.stdout4
3 files changed, 7 insertions, 5 deletions
diff --git a/testsuite/tests/rts/T13894.hs b/testsuite/tests/rts/T13894.hs
index e09e90802c..226ba18aa7 100644
--- a/testsuite/tests/rts/T13894.hs
+++ b/testsuite/tests/rts/T13894.hs
@@ -1,5 +1,5 @@
--- Test that isByteArray# returns True for large but not explicitly pinned byte
--- arrays
+-- Test that isByteArray# returns False for large but not explicitly pinned byte
+-- arrays, see #22255
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
@@ -15,4 +15,4 @@ main = do
(# s1, arr# #) ->
case isMutableByteArrayPinned# arr# of
n# -> (# s1, isTrue# n# #)
- unless pinned $ putStrLn "BAD"
+ when pinned $ putStrLn "BAD"
diff --git a/testsuite/tests/rts/T14900.hs b/testsuite/tests/rts/T14900.hs
index 613f66d3a9..e1de9a6a89 100644
--- a/testsuite/tests/rts/T14900.hs
+++ b/testsuite/tests/rts/T14900.hs
@@ -13,6 +13,8 @@ newByteArray (I# sz) = IO $ \s -> case newByteArray# sz s of {
(# s', arr# #) -> case unsafeFreezeByteArray# arr# s of {
(# s'', barr# #) -> (# s', ByteArray barr# #) }}
+-- Currently we expect large/compact regions not to count as pinned.
+-- See #22255 for the reasoning.
main :: IO ()
main = do
ByteArray arr1# <- fmap getCompact $ newByteArray 65000 >>= compact
diff --git a/testsuite/tests/rts/T14900.stdout b/testsuite/tests/rts/T14900.stdout
index fdc259d094..a74cb09c28 100644
--- a/testsuite/tests/rts/T14900.stdout
+++ b/testsuite/tests/rts/T14900.stdout
@@ -1,3 +1,3 @@
-1
-1
+0
+0
Finished