[commit: testsuite] master: Add a test for shutting down a process with in-calls in progress (640750a)

Simon Marlow marlowsd at gmail.com
Fri May 10 10:30:48 CEST 2013


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

https://github.com/ghc/testsuite/commit/640750a11cadf2048cbaf65772000a7f1bea9a48

>---------------------------------------------------------------

commit 640750a11cadf2048cbaf65772000a7f1bea9a48
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Wed Mar 6 10:37:33 2013 +0000

    Add a test for shutting down a process with in-calls in progress

>---------------------------------------------------------------

 tests/rts/all.T              |    4 ++++
 tests/rts/ffishutdown.hs     |   13 +++++++++++++
 tests/rts/ffishutdown.stderr |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/tests/rts/all.T b/tests/rts/all.T
index a592d96..319d121 100644
--- a/tests/rts/all.T
+++ b/tests/rts/all.T
@@ -169,3 +169,7 @@ test('stablename001', expect_fail_for(['hpc']), compile_and_run, [''])
 test('T7815', [ multi_cpu_race,
                 extra_run_opts('50000 +RTS -N2 -RTS'),
                 only_ways(['threaded1', 'threaded2']) ], compile_and_run, [''] )
+
+# ignore_output because it contains a unique:
+#   ffishutdown: Main_dul: interrupted
+test('ffishutdown', [ ignore_output, only_ways(['threaded1','threaded2']) ], compile_and_run, [''])
diff --git a/tests/rts/ffishutdown.hs b/tests/rts/ffishutdown.hs
new file mode 100644
index 0000000..e168843
--- /dev/null
+++ b/tests/rts/ffishutdown.hs
@@ -0,0 +1,13 @@
+import Control.Concurrent
+import Control.Monad
+import Foreign.Ptr
+
+main = do
+  fptr <- wrap $ return . (*4)
+  forkIO $ forever $ do
+    _ <- dyn fptr 4
+    return ()
+  threadDelay $ 100 * 1000
+
+foreign import ccall "wrapper" wrap :: (Double -> IO Double) -> IO (FunPtr (Double -> IO Double))
+foreign import ccall "dynamic" dyn :: FunPtr (Double -> IO Double) -> Double -> IO Double
diff --git a/tests/rts/ffishutdown.stderr b/tests/rts/ffishutdown.stderr
new file mode 100644
index 0000000..9fa255e
--- /dev/null
+++ b/tests/rts/ffishutdown.stderr
@@ -0,0 +1 @@
+ffishutdown: Main_dui: interrupted





More information about the ghc-commits mailing list