aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Simon Marlow <marlowsd@gmail.com>2009-10-21 09:07:41 +0000
committerGravatar Simon Marlow <marlowsd@gmail.com>2009-10-21 09:07:41 +0000
commit3ffe5680e675def6754896ef480a10d85d9c04d2 (patch)
tree43cac502a3d326d8d5b2683e57c7f84b062f289d /tests
parentfab44c12e7f91e0d81e1d3d0b60ffc970e8e915d (diff)
add a test for #1185
Diffstat (limited to 'tests')
-rw-r--r--tests/1185.hs24
-rw-r--r--tests/1185.stdout2
-rw-r--r--tests/all.T10
3 files changed, 36 insertions, 0 deletions
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'])