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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/8dfa8fefbc9f32a6b4b0d5f7c4685cfb8fed78ed

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

commit 8dfa8fefbc9f32a6b4b0d5f7c4685cfb8fed78ed
Author: Simon Marlow <[email protected]>
Date:   Fri Apr 27 13:30:43 2012 +0100

    Add test for #6006

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

 tests/rts/Makefile     |    2 ++
 tests/rts/T6006.hs     |    7 +++++++
 tests/rts/T6006.stdout |    2 ++
 tests/rts/T6006_c.c    |    9 +++++++++
 tests/rts/all.T        |    9 +++++++++
 5 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/tests/rts/Makefile b/tests/rts/Makefile
index 8f4acc0..971807d 100644
--- a/tests/rts/Makefile
+++ b/tests/rts/Makefile
@@ -45,3 +45,5 @@ T5423:
        "$(TEST_HC)" $(TEST_HC_OPTS) -v0 T5423.o T5423_cmm.o -o T5423$(exeext)
        ./T5423
 
+T6006_setup :
+       '$(TEST_HC)' $(TEST_HC_OPTS) -c T6006.hs
diff --git a/tests/rts/T6006.hs b/tests/rts/T6006.hs
new file mode 100644
index 0000000..c6eeb96
--- /dev/null
+++ b/tests/rts/T6006.hs
@@ -0,0 +1,7 @@
+module F where
+import System.Environment
+
+foreign export ccall f :: IO ()
+f = do
+  getProgName >>= print
+  getArgs >>= print
diff --git a/tests/rts/T6006.stdout b/tests/rts/T6006.stdout
new file mode 100644
index 0000000..16e5ec1
--- /dev/null
+++ b/tests/rts/T6006.stdout
@@ -0,0 +1,2 @@
+"<unknown>"
+[]
diff --git a/tests/rts/T6006_c.c b/tests/rts/T6006_c.c
new file mode 100644
index 0000000..ea480f8
--- /dev/null
+++ b/tests/rts/T6006_c.c
@@ -0,0 +1,9 @@
+#include "HsFFI.h"
+#include "T6006_stub.h"
+#include <stdlib.h>
+int main(int argc, char** argv) {
+    hs_init(NULL,NULL);
+    f();
+    hs_exit();
+    exit(0);
+}
diff --git a/tests/rts/all.T b/tests/rts/all.T
index f1a7ae6..90953e1 100644
--- a/tests/rts/all.T
+++ b/tests/rts/all.T
@@ -130,3 +130,12 @@ test('T5423',
      ['$MAKE -s --no-print-directory T5423'])
 
 test('5993', extra_run_opts('+RTS -k8 -RTS'), compile_and_run, [''])
+
+test('T6006', [ omit_ways(['ghci']),
+                 extra_clean(['T6006_c.o']),
+                 compile_cmd_prefix('$MAKE T6006_setup && ') ],
+                 # The T6006_setup hack is to ensure that we generate
+                 # T6006_stub.h before compiling T6006_c.c, which
+                 # needs it.
+               compile_and_run, ['T6006_c.c -no-hs-main'])
+



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to