summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-07-23 12:35:59 +0100
committerIan Lynagh <ian@well-typed.com>2013-07-23 12:35:59 +0100
commit9c3bfb1fff75e934d483acc3e4431771606176f3 (patch)
treed2559c2ecfaaa5c898adffa408b575f1fb18d06b /testsuite/tests/ffi
parentaab4cdaacafeaadbdfb0fa4275ac859e0f6b0148 (diff)
downloadhaskell-9c3bfb1fff75e934d483acc3e4431771606176f3.tar.gz
Add a test for #8083
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r--testsuite/tests/ffi/should_run/T8083.hs17
-rw-r--r--testsuite/tests/ffi/should_run/T8083.stdout1
-rw-r--r--testsuite/tests/ffi/should_run/T8083_c.c10
-rw-r--r--testsuite/tests/ffi/should_run/all.T5
4 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_run/T8083.hs b/testsuite/tests/ffi/should_run/T8083.hs
new file mode 100644
index 0000000000..bf61ac911f
--- /dev/null
+++ b/testsuite/tests/ffi/should_run/T8083.hs
@@ -0,0 +1,17 @@
+
+import Foreign
+import Foreign.C
+-- import System.IO
+
+main :: IO ()
+main = do
+ -- hSetBuffering stdout NoBuffering
+ n <- peek pn
+ -- print n
+ case n of
+ 1 -> do -- putStrLn "Calling blah"
+ blah
+ _ -> return ()
+
+foreign import ccall "&n" pn :: Ptr CInt
+foreign import ccall safe blah :: IO ()
diff --git a/testsuite/tests/ffi/should_run/T8083.stdout b/testsuite/tests/ffi/should_run/T8083.stdout
new file mode 100644
index 0000000000..c5669f568b
--- /dev/null
+++ b/testsuite/tests/ffi/should_run/T8083.stdout
@@ -0,0 +1 @@
+In blah
diff --git a/testsuite/tests/ffi/should_run/T8083_c.c b/testsuite/tests/ffi/should_run/T8083_c.c
new file mode 100644
index 0000000000..e10451ed1a
--- /dev/null
+++ b/testsuite/tests/ffi/should_run/T8083_c.c
@@ -0,0 +1,10 @@
+
+#include <stdio.h>
+
+void blah (void) {
+ printf("In blah\n");
+ fflush(stdout);
+}
+
+int n = 1;
+
diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T
index 89bb0fb83e..80cb7736c6 100644
--- a/testsuite/tests/ffi/should_run/all.T
+++ b/testsuite/tests/ffi/should_run/all.T
@@ -220,3 +220,8 @@ test('T4012',
multimod_compile_and_run,
['T4012', ''])
+test('T8083',
+ [extra_clean(['T8083_c.o'])],
+ compile_and_run,
+ ['T8083_c.c'])
+