From 3ffe5680e675def6754896ef480a10d85d9c04d2 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 21 Oct 2009 09:07:41 +0000 Subject: add a test for #1185 --- tests/1185.hs | 24 ++++++++++++++++++++++++ tests/1185.stdout | 2 ++ tests/all.T | 10 ++++++++++ 3 files changed, 36 insertions(+) create mode 100644 tests/1185.hs create mode 100644 tests/1185.stdout (limited to 'tests') diff --git a/tests/1185.hs b/tests/1185.hs new file mode 100644 index 0000000..4948417 --- /dev/null +++ b/tests/1185.hs @@ -0,0 +1,24 @@ +module Main where + +import Control.Concurrent +import System.Posix +import System.IO +import System.Exit + +main = + do putStrLn "running..." + (stdinr, stdinw) <- createPipe + (stdoutr, stdoutw) <- createPipe + pid <- forkProcess $ do hw <- fdToHandle stdoutw + hr <- fdToHandle stdinr + closeFd stdinw + hGetContents hr >>= hPutStr hw + hClose hr + hClose hw + exitImmediately ExitSuccess + threadDelay 100000 + closeFd stdoutw + closeFd stdinw + hr2 <- fdToHandle stdoutr + hGetContents hr2 >>= putStr + getProcessStatus True False pid >>= print diff --git a/tests/1185.stdout b/tests/1185.stdout new file mode 100644 index 0000000..7062314 --- /dev/null +++ b/tests/1185.stdout @@ -0,0 +1,2 @@ +running... +Just (Exited ExitSuccess) diff --git a/tests/all.T b/tests/all.T index fa31856..dc9258c 100644 --- a/tests/all.T +++ b/tests/all.T @@ -44,3 +44,13 @@ test('fileStatus', compile_and_run, ['-package unix']) + +# Omit GHCi way because in GHCi there are two IO manager threads, one +# for GHCi itself and one for the user program. This is a consequence +# of the fact that we aren't sharing the base package between GHCi and +# the user program, and it will change when we switch to shared +# libraries. Unfortunately the test hangs if we try to run it under +# GHCi right now, so we can't just make it an expected failure. +# +test('1185', [ omit_ways(['ghci']), expect_fail_for(['threaded2']) ], + compile_and_run, ['-package unix']) -- cgit v1.2.3