add test for #2276
authorSimon Marlow <simonmar@microsoft.com>
Wed, 14 May 2008 10:04:05 +0000 (10:04 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Wed, 14 May 2008 10:04:05 +0000 (10:04 +0000)
testsuite/tests/ghc-regress/ffi/should_run/2276.hs [new file with mode: 0644]
testsuite/tests/ghc-regress/ffi/should_run/2276.stdout [new file with mode: 0644]
testsuite/tests/ghc-regress/ffi/should_run/2276_c.c [new file with mode: 0644]
testsuite/tests/ghc-regress/ffi/should_run/Makefile
testsuite/tests/ghc-regress/ffi/should_run/all.T

diff --git a/testsuite/tests/ghc-regress/ffi/should_run/2276.hs b/testsuite/tests/ghc-regress/ffi/should_run/2276.hs
new file mode 100644 (file)
index 0000000..0ee1ee9
--- /dev/null
@@ -0,0 +1,7 @@
+import Foreign\r
+import Foreign.C\r
+\r
+foreign import stdcall "&test" ptest :: FunPtr (CInt -> IO ())\r
+foreign import stdcall "dynamic" ctest :: FunPtr (CInt -> IO ()) -> CInt -> IO ()\r
+\r
+main = ctest ptest 3\r
diff --git a/testsuite/tests/ghc-regress/ffi/should_run/2276.stdout b/testsuite/tests/ghc-regress/ffi/should_run/2276.stdout
new file mode 100644 (file)
index 0000000..ef6be04
--- /dev/null
@@ -0,0 +1 @@
+The argument passed was 3
diff --git a/testsuite/tests/ghc-regress/ffi/should_run/2276_c.c b/testsuite/tests/ghc-regress/ffi/should_run/2276_c.c
new file mode 100644 (file)
index 0000000..0e53860
--- /dev/null
@@ -0,0 +1,6 @@
+#include <stdio.h>\r
+\r
+void _stdcall test(int arg)\r
+{\r
+   printf("The argument passed was %i\n", arg );\r
+}\r
index a3ef862..93b7a8b 100644 (file)
@@ -9,3 +9,7 @@ ffi018_ghci_setup :
 1288_ghci_setup :
        cp 1288_c.c 1288_ghci_c.c
        $(TEST_HC) -c 1288_ghci_c.c
+
+2276_ghci_setup :
+       cp 2276_c.c 2276_ghci_c.c
+       $(TEST_HC) -c 2276_ghci_c.c
index b2e6043..f27b92b 100644 (file)
@@ -118,3 +118,11 @@ test('1288', [ skip_if_not_windows, only_ways(['ghci']),
                extra_clean(['1288_ghci_c.c', '1288_ghci_c.o']) ],
              compile_and_run, ['1288_ghci_c.o'])
 
+test('2276', [ skip_if_not_windows, omit_ways(['ghci']), 
+               extra_clean(['2276_c.o']) ],
+             compile_and_run, ['2276_c.c'])
+test('2276', [ skip_if_not_windows, only_ways(['ghci']),
+               cmd_prefix('$MAKE --no-print-directory -C ' + getTestDir() +
+                          ' 2276_ghci_setup && '),
+               extra_clean(['2276_ghci_c.c', '2276_ghci_c.o']) ],
+             compile_and_run, ['-fobject-code 2276_ghci_c.o'])