summaryrefslogtreecommitdiff
path: root/testsuite/tests/hsc2hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-10-25 15:31:38 +0100
committerIan Lynagh <igloo@earth.li>2011-10-25 15:58:15 +0100
commit2eb3bf121e5e60686b6e86cd24d0e49ca476eba9 (patch)
treea6e62480a507316f30fdf856123a5f33f75042fa /testsuite/tests/hsc2hs
parent5695b73d93ffe39321b716743e20b45cefa9b92b (diff)
downloadhaskell-2eb3bf121e5e60686b6e86cd24d0e49ca476eba9.tar.gz
Add a couple of hsc2hs tests
Diffstat (limited to 'testsuite/tests/hsc2hs')
-rw-r--r--testsuite/tests/hsc2hs/Makefile22
-rw-r--r--testsuite/tests/hsc2hs/all.T12
-rw-r--r--testsuite/tests/hsc2hs/hsc2hs003.hsc10
-rw-r--r--testsuite/tests/hsc2hs/hsc2hs003.stdout1
-rw-r--r--testsuite/tests/hsc2hs/hsc2hs004.hsc10
-rw-r--r--testsuite/tests/hsc2hs/hsc2hs004.stdout1
6 files changed, 52 insertions, 4 deletions
diff --git a/testsuite/tests/hsc2hs/Makefile b/testsuite/tests/hsc2hs/Makefile
index 0b904f317c..9fbd62c989 100644
--- a/testsuite/tests/hsc2hs/Makefile
+++ b/testsuite/tests/hsc2hs/Makefile
@@ -2,14 +2,28 @@ TOP=../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
-ALL_TESTS = hsc2hs001 hsc2hs002
-
-.PHONY: $(TESTS)
+.PHONY: hsc2hs001
+hsc2hs001:
+ '$(HSC2HS)' $@.hsc
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c $@.hs
-$(ALL_TESTS):
+.PHONY: hsc2hs002
+hsc2hs002:
'$(HSC2HS)' $@.hsc
'$(TEST_HC)' $(TEST_HC_OPTS) -c $@.hs
+.PHONY: hsc2hs003
+hsc2hs003:
+ '$(HSC2HS)' $@.hsc
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@
+ ./$@
+
+.PHONY: hsc2hs004
+hsc2hs004:
+ '$(HSC2HS)' --cross-compile $@.hsc
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@
+ ./$@
+
.PHONY: 3837
3837:
LANG=C '$(HSC2HS)' $@.hsc
diff --git a/testsuite/tests/hsc2hs/all.T b/testsuite/tests/hsc2hs/all.T
index 32900434d2..7660a0074d 100644
--- a/testsuite/tests/hsc2hs/all.T
+++ b/testsuite/tests/hsc2hs/all.T
@@ -11,6 +11,18 @@ test('hsc2hs002',
run_command,
['$MAKE -s --no-print-directory hsc2hs002'])
+test('hsc2hs003',
+ [extra_clean(['hsc2hs003.hs', 'hsc2hs003_hsc_make.c']),
+ if_platform('i386-unknown-mingw32', expect_broken(3929))],
+ run_command,
+ ['$MAKE -s --no-print-directory hsc2hs003'])
+
+test('hsc2hs004',
+ [extra_clean(['hsc2hs004.hs', 'hsc2hs004_hsc_make.c']),
+ if_platform('i386-unknown-mingw32', expect_broken(3929))],
+ run_command,
+ ['$MAKE -s --no-print-directory hsc2hs004'])
+
test('3837',
[extra_clean(['3837.hs', '3837_hsc_make.c']),
diff --git a/testsuite/tests/hsc2hs/hsc2hs003.hsc b/testsuite/tests/hsc2hs/hsc2hs003.hsc
new file mode 100644
index 0000000000..f46aa42ed1
--- /dev/null
+++ b/testsuite/tests/hsc2hs/hsc2hs003.hsc
@@ -0,0 +1,10 @@
+
+-- Test that hsc2hs actually gives the right answer in "direct" mode
+
+#include <stdint.h>
+
+module Main (main) where
+
+main :: IO ()
+main = print #size uint16_t
+
diff --git a/testsuite/tests/hsc2hs/hsc2hs003.stdout b/testsuite/tests/hsc2hs/hsc2hs003.stdout
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/testsuite/tests/hsc2hs/hsc2hs003.stdout
@@ -0,0 +1 @@
+2
diff --git a/testsuite/tests/hsc2hs/hsc2hs004.hsc b/testsuite/tests/hsc2hs/hsc2hs004.hsc
new file mode 100644
index 0000000000..9dd1b4735a
--- /dev/null
+++ b/testsuite/tests/hsc2hs/hsc2hs004.hsc
@@ -0,0 +1,10 @@
+
+-- Test that hsc2hs actually gives the right answer in "cross-compile" mode
+
+#include <stdint.h>
+
+module Main (main) where
+
+main :: IO ()
+main = print #size uint16_t
+
diff --git a/testsuite/tests/hsc2hs/hsc2hs004.stdout b/testsuite/tests/hsc2hs/hsc2hs004.stdout
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/testsuite/tests/hsc2hs/hsc2hs004.stdout
@@ -0,0 +1 @@
+2