summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-04-27 13:30:43 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-04-27 13:30:43 +0100
commit73b97bdfe84b8688e782827d89ecbd214455bb5f (patch)
treedcc7875116b8acf53d579aa55b72f8259948cedc /testsuite
parent32b2573a5e463c46bff857f50f9dec03f581489d (diff)
downloadhaskell-73b97bdfe84b8688e782827d89ecbd214455bb5f.tar.gz
Add test for #6006
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/rts/Makefile2
-rw-r--r--testsuite/tests/rts/T6006.hs7
-rw-r--r--testsuite/tests/rts/T6006.stdout2
-rw-r--r--testsuite/tests/rts/T6006_c.c9
-rw-r--r--testsuite/tests/rts/all.T9
5 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/rts/Makefile b/testsuite/tests/rts/Makefile
index 8f4acc0f9c..971807db93 100644
--- a/testsuite/tests/rts/Makefile
+++ b/testsuite/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/testsuite/tests/rts/T6006.hs b/testsuite/tests/rts/T6006.hs
new file mode 100644
index 0000000000..c6eeb96188
--- /dev/null
+++ b/testsuite/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/testsuite/tests/rts/T6006.stdout b/testsuite/tests/rts/T6006.stdout
new file mode 100644
index 0000000000..16e5ec13b5
--- /dev/null
+++ b/testsuite/tests/rts/T6006.stdout
@@ -0,0 +1,2 @@
+"<unknown>"
+[]
diff --git a/testsuite/tests/rts/T6006_c.c b/testsuite/tests/rts/T6006_c.c
new file mode 100644
index 0000000000..ea480f8545
--- /dev/null
+++ b/testsuite/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/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index f1a7ae6a80..90953e1d76 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/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'])
+