summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver/dynamicToo
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-12-14 21:26:44 +0000
committerIan Lynagh <ian@well-typed.com>2012-12-14 21:29:43 +0000
commit6f506011adbd8d8b179d6fd4de3151b05650b60e (patch)
tree4d21b216acb644bfbcf97e790554a0c415e883ec /testsuite/tests/driver/dynamicToo
parent9924685191447eec88bef6cf9265dc54ed0aa855 (diff)
downloadhaskell-6f506011adbd8d8b179d6fd4de3151b05650b60e.tar.gz
Add a test for -dynamic-too
Diffstat (limited to 'testsuite/tests/driver/dynamicToo')
-rw-r--r--testsuite/tests/driver/dynamicToo/A001.hs6
-rw-r--r--testsuite/tests/driver/dynamicToo/B001.hs6
-rw-r--r--testsuite/tests/driver/dynamicToo/B001_1.hs6
-rw-r--r--testsuite/tests/driver/dynamicToo/B001_2.hs6
-rw-r--r--testsuite/tests/driver/dynamicToo/C001.hs9
-rw-r--r--testsuite/tests/driver/dynamicToo/Makefile23
-rw-r--r--testsuite/tests/driver/dynamicToo/all.T11
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicToo001.stdout4
8 files changed, 71 insertions, 0 deletions
diff --git a/testsuite/tests/driver/dynamicToo/A001.hs b/testsuite/tests/driver/dynamicToo/A001.hs
new file mode 100644
index 0000000000..073c5fd5f6
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/A001.hs
@@ -0,0 +1,6 @@
+
+module A001 where
+
+a :: Char
+a = 'a'
+
diff --git a/testsuite/tests/driver/dynamicToo/B001.hs b/testsuite/tests/driver/dynamicToo/B001.hs
new file mode 100644
index 0000000000..bd06202abe
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/B001.hs
@@ -0,0 +1,6 @@
+
+module B001 where
+
+b :: Char
+b = 'c'
+
diff --git a/testsuite/tests/driver/dynamicToo/B001_1.hs b/testsuite/tests/driver/dynamicToo/B001_1.hs
new file mode 100644
index 0000000000..9640f7b783
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/B001_1.hs
@@ -0,0 +1,6 @@
+
+module B001 where
+
+b :: Char
+b = 'b'
+
diff --git a/testsuite/tests/driver/dynamicToo/B001_2.hs b/testsuite/tests/driver/dynamicToo/B001_2.hs
new file mode 100644
index 0000000000..bd06202abe
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/B001_2.hs
@@ -0,0 +1,6 @@
+
+module B001 where
+
+b :: Char
+b = 'c'
+
diff --git a/testsuite/tests/driver/dynamicToo/C001.hs b/testsuite/tests/driver/dynamicToo/C001.hs
new file mode 100644
index 0000000000..1adff5fc44
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/C001.hs
@@ -0,0 +1,9 @@
+
+module Main where
+
+import A001
+import B001
+
+main = do print a
+ print b
+
diff --git a/testsuite/tests/driver/dynamicToo/Makefile b/testsuite/tests/driver/dynamicToo/Makefile
new file mode 100644
index 0000000000..5083fe4f78
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/Makefile
@@ -0,0 +1,23 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+TEST_HC_OPTS_DYN = -dynamic -hisuf dyn_hi -osuf dyn_o
+
+.PHONY: dynamicToo001
+# -dynamic-too should notice that the interface files for B don't match,
+# and so compile the dyn way separately. This means that the right value
+# of B.b should get inlined.
+dynamicToo001:
+ "$(TEST_HC)" $(TEST_HC_OPTS) -O -c A001.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) $(TEST_HC_OPTS_DYN) -O -c A001.hs
+ cp B001_1.hs B001.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -O -c B001.hs
+ cp B001_2.hs B001.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) $(TEST_HC_OPTS_DYN) -O -c B001.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -O -c C001.hs -dynamic-too
+ "$(TEST_HC)" $(TEST_HC_OPTS) A001.o B001.o C001.o -o s001
+ "$(TEST_HC)" $(TEST_HC_OPTS) A001.dyn_o B001.dyn_o C001.dyn_o -o d001
+ ./s001
+ ./d001
+
diff --git a/testsuite/tests/driver/dynamicToo/all.T b/testsuite/tests/driver/dynamicToo/all.T
new file mode 100644
index 0000000000..c10aa2ea48
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/all.T
@@ -0,0 +1,11 @@
+setTestOpts(only_compiler_types(['ghc']))
+
+test('dynamicToo001',
+ extra_clean(['A001.o', 'B001.o', 'C001.o',
+ 'A001.hi', 'B001.hi', 'C001.hi',
+ 'A001.dyn_o', 'B001.dyn_o', 'C001.dyn_o',
+ 'A001.dyn_hi', 'B001.dyn_hi', 'C001.dyn_hi',
+ 's001', 'd001']),
+ run_command,
+ ['$MAKE -s --no-print-directory dynamicToo001'])
+
diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo001.stdout b/testsuite/tests/driver/dynamicToo/dynamicToo001.stdout
new file mode 100644
index 0000000000..e7aea0735f
--- /dev/null
+++ b/testsuite/tests/driver/dynamicToo/dynamicToo001.stdout
@@ -0,0 +1,4 @@
+'a'
+'b'
+'a'
+'c'