diff options
author | Simon Marlow <marlowsd@gmail.com> | 2011-11-07 15:37:30 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2011-11-08 14:29:46 +0000 |
commit | 5f48bc14749eb46c172d2dc6af7967fb0dcdd0cf (patch) | |
tree | 9a4a52062e0db4ea528e958668f3f6fe38f30230 /testsuite/tests/ffi | |
parent | be88f020ea1b73421d4c95a8516f44090838a6e0 (diff) | |
download | haskell-5f48bc14749eb46c172d2dc6af7967fb0dcdd0cf.tar.gz |
add test for #5594
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r-- | testsuite/tests/ffi/should_run/5594.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/5594.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/5594_c.c | 12 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/Makefile | 4 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/all.T | 7 |
5 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_run/5594.hs b/testsuite/tests/ffi/should_run/5594.hs new file mode 100644 index 0000000000..1ec2b87d9c --- /dev/null +++ b/testsuite/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/testsuite/tests/ffi/should_run/5594.stdout b/testsuite/tests/ffi/should_run/5594.stdout new file mode 100644 index 0000000000..10ddd6d257 --- /dev/null +++ b/testsuite/tests/ffi/should_run/5594.stdout @@ -0,0 +1 @@ +Hello! diff --git a/testsuite/tests/ffi/should_run/5594_c.c b/testsuite/tests/ffi/should_run/5594_c.c new file mode 100644 index 0000000000..5de1f4d4c6 --- /dev/null +++ b/testsuite/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/testsuite/tests/ffi/should_run/Makefile b/testsuite/tests/ffi/should_run/Makefile index 64bc63a2d3..3981cd2166 100644 --- a/testsuite/tests/ffi/should_run/Makefile +++ b/testsuite/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/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T index b55c5cd7d6..118a26fb44 100644 --- a/testsuite/tests/ffi/should_run/all.T +++ b/testsuite/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']) |