[commit: testsuite] master: Add a test for #8083 (9aae6aa)
Ian Lynagh
igloo at ghc.haskell.org
Tue Jul 23 14:56:18 CEST 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/9aae6aa889c624545b05814867ffb708fd0b800e
>---------------------------------------------------------------
commit 9aae6aa889c624545b05814867ffb708fd0b800e
Author: Ian Lynagh <ian at well-typed.com>
Date: Tue Jul 23 12:35:59 2013 +0100
Add a test for #8083
>---------------------------------------------------------------
tests/ffi/should_run/T8083.hs | 17 +++++++++++++++++
tests/ffi/should_run/T8083.stdout | 1 +
tests/ffi/should_run/T8083_c.c | 10 ++++++++++
tests/ffi/should_run/all.T | 5 +++++
4 files changed, 33 insertions(+)
diff --git a/tests/ffi/should_run/T8083.hs b/tests/ffi/should_run/T8083.hs
new file mode 100644
index 0000000..bf61ac9
--- /dev/null
+++ b/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/tests/ffi/should_run/T8083.stdout b/tests/ffi/should_run/T8083.stdout
new file mode 100644
index 0000000..c5669f5
--- /dev/null
+++ b/tests/ffi/should_run/T8083.stdout
@@ -0,0 +1 @@
+In blah
diff --git a/tests/ffi/should_run/T8083_c.c b/tests/ffi/should_run/T8083_c.c
new file mode 100644
index 0000000..e10451e
--- /dev/null
+++ b/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/tests/ffi/should_run/all.T b/tests/ffi/should_run/all.T
index 89bb0fb..80cb773 100644
--- a/tests/ffi/should_run/all.T
+++ b/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'])
+
More information about the ghc-commits
mailing list