diff options
author | Merijn Verstraaten <merijn@inconsistent.nl> | 2014-11-07 07:32:18 -0600 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-11-07 07:32:19 -0600 |
commit | 24e05f48f3a3a1130ecd5a46e3089b76ee5a2304 (patch) | |
tree | 0a74d2046aa7cdfdd859b683815a30e7a9a345dd /libraries/base/tests/T8089.hs | |
parent | b0e8e34ac1b4dcab2e4ec92d00440e047d260562 (diff) | |
download | haskell-24e05f48f3a3a1130ecd5a46e3089b76ee5a2304.tar.gz |
*Really*, really fix RTS crash due to bad coercion.
Summary:
My previous attempt to fix the new coercion bug introduced by my fix actually
just reverted back to the *old* bug. This time it should properly handle all
three size scenarios.
Signed-off-by: Merijn Verstraaten <merijn@inconsistent.nl>
Test Plan: validate
Reviewers: dfeuer, austin, hvr
Reviewed By: austin, hvr
Subscribers: thomie, carter, simonmar
Differential Revision: https://phabricator.haskell.org/D407
GHC Trac Issues: #8089
Diffstat (limited to 'libraries/base/tests/T8089.hs')
-rw-r--r-- | libraries/base/tests/T8089.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libraries/base/tests/T8089.hs b/libraries/base/tests/T8089.hs new file mode 100644 index 0000000000..2b98f94198 --- /dev/null +++ b/libraries/base/tests/T8089.hs @@ -0,0 +1,32 @@ +import Control.Applicative +import Control.Concurrent +import Control.Exception +import Control.Monad +import System.Environment +import System.Exit +import System.Process +import System.Timeout + +testLoop :: Int -> IO (Maybe a) -> IO (Maybe a) +testLoop 0 _ = return Nothing +testLoop i act = do + result <- act + case result of + Nothing -> threadDelay 100000 >> testLoop (i-1) act + Just x -> return (Just x) + + +forkTestChild :: IO () +forkTestChild = do + (_, _, _, hnd) <- createProcess (proc "./T8089" ["test"]) + result <- testLoop 50 $ getProcessExitCode hnd + case result of + Nothing -> terminateProcess hnd >> exitSuccess + Just exitCode -> exitWith exitCode + +main :: IO () +main = do + numArgs <- length <$> getArgs + if numArgs > 0 + then threadDelay maxBound + else forkTestChild |