[commit: testsuite] master: add test for #5594 (5e46853)
Simon Marlow
marlowsd at gmail.com
Tue Nov 8 15:29:54 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/5e468535d0d84df94edd27c499c375c91e5a2e18
>---------------------------------------------------------------
commit 5e468535d0d84df94edd27c499c375c91e5a2e18
Author: Simon Marlow <marlowsd at gmail.com>
Date: Mon Nov 7 15:37:30 2011 +0000
add test for #5594
>---------------------------------------------------------------
tests/ffi/should_run/5594.hs | 6 ++++++
tests/ffi/should_run/5594.stdout | 1 +
tests/ffi/should_run/5594_c.c | 12 ++++++++++++
tests/ffi/should_run/Makefile | 4 ++++
tests/ffi/should_run/all.T | 7 +++++++
5 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/tests/ffi/should_run/5594.hs b/tests/ffi/should_run/5594.hs
new file mode 100644
index 0000000..1ec2b87
--- /dev/null
+++ b/tests/ffi/should_run/5594.hs
@@ -0,0 +1,6 @@
+module Lib (hello) where
+
+foreign export ccall "hello" hello :: IO ()
+
+hello :: IO ()
+hello = putStrLn "Hello!"
diff --git a/tests/ffi/should_run/5594.stdout b/tests/ffi/should_run/5594.stdout
new file mode 100644
index 0000000..10ddd6d
--- /dev/null
+++ b/tests/ffi/should_run/5594.stdout
@@ -0,0 +1 @@
+Hello!
diff --git a/tests/ffi/should_run/5594_c.c b/tests/ffi/should_run/5594_c.c
new file mode 100644
index 0000000..5de1f4d
--- /dev/null
+++ b/tests/ffi/should_run/5594_c.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include "5594_stub.h"
+
+#include "HsFFI.h"
+
+int main(int argc, char *argv[])
+{
+ hs_init(&argc, &argv);
+ hello();
+ hs_exit();
+ return 0;
+}
diff --git a/tests/ffi/should_run/Makefile b/tests/ffi/should_run/Makefile
index 64bc63a..3981cd2 100644
--- a/tests/ffi/should_run/Makefile
+++ b/tests/ffi/should_run/Makefile
@@ -16,3 +16,7 @@ ffi002_setup :
5402_setup :
'$(TEST_HC)' $(TEST_HC_OPTS) -c 5402.hs
+
+5594_setup :
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c 5594.hs
+
diff --git a/tests/ffi/should_run/all.T b/tests/ffi/should_run/all.T
index b55c5cd..118a26f 100644
--- a/tests/ffi/should_run/all.T
+++ b/tests/ffi/should_run/all.T
@@ -180,3 +180,10 @@ test('5402', [ omit_ways(['ghci']),
compile_cmd_prefix('$MAKE --no-print-directory 5402_setup && ') ],
compile_and_run, ["-no-hs-main 5402_main.c"])
+test('5594', [ omit_ways(['ghci']),
+ extra_clean(['5594_c.o']),
+ compile_cmd_prefix('$MAKE --no-print-directory 5594_setup && ') ],
+ # The 5594_setup hack is to ensure that we generate
+ # 5594_stub.h before compiling 5594_c.c, which
+ # needs it.
+ compile_and_run, ['5594_c.c -no-hs-main'])
More information about the Cvs-ghc
mailing list