diff options
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/package/T20010/Makefile | 18 | ||||
-rw-r--r-- | testsuite/tests/package/T20010/T20010-ghci.script | 2 | ||||
-rw-r--r-- | testsuite/tests/package/T20010/T20010-ghci.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/package/T20010/T20010.hs | 10 | ||||
-rw-r--r-- | testsuite/tests/package/T20010/T20010.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/package/T20010/T20010_c.cpp | 7 | ||||
-rw-r--r-- | testsuite/tests/package/T20010/all.T | 4 |
7 files changed, 43 insertions, 0 deletions
diff --git a/testsuite/tests/package/T20010/Makefile b/testsuite/tests/package/T20010/Makefile new file mode 100644 index 0000000000..9343836a5e --- /dev/null +++ b/testsuite/tests/package/T20010/Makefile @@ -0,0 +1,18 @@ +TOP=../../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +T20010: + '$(TEST_HC)' $(TEST_HC_OPTS) -c T20010.hs + '$(TEST_HC)' $(TEST_HC_OPTS) -c T20010_c.cpp + '$(TEST_HC)' $(TEST_HC_OPTS) -package system-cxx-std-lib T20010_c.o T20010.o -o T20010 + ./T20010 + +T20010-ghci: + '$(TEST_HC)' $(TEST_HC_OPTS) -c T20010.hs + # We must build with PIC lest we end up with R_X86_64_32 relocations in + # .rodata which precludes linking into a shared object and therefore loading + # in GHCi + '$(TEST_HC)' $(TEST_HC_OPTS) -c -fPIC T20010_c.cpp + '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) -package system-cxx-std-lib T20010_c.o <T20010-ghci.script + diff --git a/testsuite/tests/package/T20010/T20010-ghci.script b/testsuite/tests/package/T20010/T20010-ghci.script new file mode 100644 index 0000000000..da04af1cb0 --- /dev/null +++ b/testsuite/tests/package/T20010/T20010-ghci.script @@ -0,0 +1,2 @@ +:load T20010 +hello 42 diff --git a/testsuite/tests/package/T20010/T20010-ghci.stdout b/testsuite/tests/package/T20010/T20010-ghci.stdout new file mode 100644 index 0000000000..d9a45b2f81 --- /dev/null +++ b/testsuite/tests/package/T20010/T20010-ghci.stdout @@ -0,0 +1 @@ +hello world 42 diff --git a/testsuite/tests/package/T20010/T20010.hs b/testsuite/tests/package/T20010/T20010.hs new file mode 100644 index 0000000000..306ed607e2 --- /dev/null +++ b/testsuite/tests/package/T20010/T20010.hs @@ -0,0 +1,10 @@ +module Main where + +import Foreign.C.Types + +foreign import ccall unsafe "hello" hello :: CInt -> IO () + +main :: IO () +main = do + hello 42 + diff --git a/testsuite/tests/package/T20010/T20010.stdout b/testsuite/tests/package/T20010/T20010.stdout new file mode 100644 index 0000000000..d9a45b2f81 --- /dev/null +++ b/testsuite/tests/package/T20010/T20010.stdout @@ -0,0 +1 @@ +hello world 42 diff --git a/testsuite/tests/package/T20010/T20010_c.cpp b/testsuite/tests/package/T20010/T20010_c.cpp new file mode 100644 index 0000000000..582c561b3f --- /dev/null +++ b/testsuite/tests/package/T20010/T20010_c.cpp @@ -0,0 +1,7 @@ +#include <iostream> + +extern "C" { +void hello(int x) { + std::cout << "hello world " << x << std::endl; +} +} diff --git a/testsuite/tests/package/T20010/all.T b/testsuite/tests/package/T20010/all.T new file mode 100644 index 0000000000..4bfaecfcc2 --- /dev/null +++ b/testsuite/tests/package/T20010/all.T @@ -0,0 +1,4 @@ +# Test that GHC links to the C++ standard library as expected +# when the system-cxx-std-lib package is used. +test('T20010', normal, makefile_test, []) +test('T20010-ghci', extra_files(['T20010_c.cpp', 'T20010.hs']), makefile_test, []) |