diff options
author | Ben Gamari <ben@smart-cactus.org> | 2018-06-15 12:58:59 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-15 13:02:05 -0400 |
commit | b7deeed00d93c306e55572c9c1c09ced4be61eef (patch) | |
tree | abb1bb4de2c7c2794ba613664a1277e1c9adc9a8 /testsuite/tests/primops | |
parent | 69954a125d12a1ffffcc9ce2d66bc211e3607a9a (diff) | |
download | haskell-b7deeed00d93c306e55572c9c1c09ced4be61eef.tar.gz |
testsuite: Make T4442 compile on i386 and mark as broken
There are some rather suspicious failures in the 64-bit case. See #15184 for
details.
Diffstat (limited to 'testsuite/tests/primops')
-rw-r--r-- | testsuite/tests/primops/should_run/T4442.hs | 33 | ||||
-rw-r--r-- | testsuite/tests/primops/should_run/all.T | 4 |
2 files changed, 32 insertions, 5 deletions
diff --git a/testsuite/tests/primops/should_run/T4442.hs b/testsuite/tests/primops/should_run/T4442.hs index 40d7879cac..d9e65006bc 100644 --- a/testsuite/tests/primops/should_run/T4442.hs +++ b/testsuite/tests/primops/should_run/T4442.hs @@ -10,6 +10,7 @@ import GHC.Exts import Data.Char(ord) #if WORD_SIZE_IN_BITS < 64 import GHC.Int (Int64(..)) +import GHC.Word (Word64(..)) #endif assertEqual :: (Show a, Eq a) => a -> a -> IO () @@ -124,20 +125,21 @@ testInt64Array :: -> (# State# RealWorld, Int64# #)) -> (MutableByteArray# RealWorld -> Int# -> Int64# -> State# RealWorld -> State# RealWorld) - -> Int + -> Int64 -> Int -> IO () testInt64Array name0 index read write val0 len = do doOne (name0 ++ " positive") val0 doOne (name0 ++ " negative") (negate val0) where + doOne :: String -> Int64 -> IO () doOne name val = test name (\arr i -> I64# (index arr i)) - (\arr i s -> case read arr i s of (# s', a #) -> (# s', I# a #)) + (\arr i s -> case read arr i s of (# s', a #) -> (# s', I64# a #)) (\arr i (I64# a) s -> write arr i a s) val - (intToBytes val len) + (intToBytes (fromIntegral val) len) len #endif @@ -160,6 +162,29 @@ testWordArray name index read write val len = test (intToBytes (fromIntegral val) len) len +#if WORD_SIZE_IN_BITS == 64 +testWord64Array = testWordArray +#else +testWord64Array :: + String + -> (ByteArray# -> Int# -> Word64#) + -> (MutableByteArray# RealWorld -> Int# -> State# RealWorld + -> (# State# RealWorld, Word64# #)) + -> (MutableByteArray# RealWorld -> Int# -> Word64# -> State# RealWorld + -> State# RealWorld) + -> Word64 + -> Int + -> IO () +testWord64Array name index read write val len = test + name + (\arr i -> W64# (index arr i)) + (\arr i s -> case read arr i s of (# s', a #) -> (# s', W64# a #)) + (\arr i (W64# a) s -> write arr i a s) + val + (intToBytes (fromIntegral val) len) + len +#endif + wordSizeInBytes :: Int wordSizeInBytes = WORD_SIZE_IN_BITS `div` 8 @@ -218,7 +243,7 @@ main = do testWordArray "Word32#" indexWord8ArrayAsWord32# readWord8ArrayAsWord32# writeWord8ArrayAsWord32# 12345678 4 - testWordArray "Word64#" + testWord64Array "Word64#" indexWord8ArrayAsWord64# readWord8ArrayAsWord64# writeWord8ArrayAsWord64# 1234567890123 8 testWordArray "Word#" diff --git a/testsuite/tests/primops/should_run/all.T b/testsuite/tests/primops/should_run/all.T index 53d875bf8f..742206d93d 100644 --- a/testsuite/tests/primops/should_run/all.T +++ b/testsuite/tests/primops/should_run/all.T @@ -2,7 +2,9 @@ test('T6135', normal, compile_and_run, ['']) test('T7689', normal, compile_and_run, ['']) # These tests are using unboxed tuples, so omit ghci test('T9430', omit_ways(['ghci']), compile_and_run, ['']) -test('T4442', omit_ways(['ghci']), compile_and_run, ['']) +test('T4442', + [omit_ways(['ghci']), when(wordsize(32), expect_broken(15184))], + compile_and_run, ['']) test('T10481', exit_code(1), compile_and_run, ['']) test('T10678', [stats_num_field('bytes allocated', |