[commit: testsuite] master: Add a test for -dynamic-too (9f1f5ff)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/9f1f5ffe3f0db0b095312a734ed0763bf9d362a8

>---------------------------------------------------------------

commit 9f1f5ffe3f0db0b095312a734ed0763bf9d362a8
Author: Ian Lynagh <[email protected]>
Date:   Fri Dec 14 21:26:44 2012 +0000

    Add a test for -dynamic-too

>---------------------------------------------------------------

 tests/driver/dynamicToo/A001.hs              |    6 ++++++
 tests/driver/dynamicToo/B001.hs              |    6 ++++++
 tests/driver/dynamicToo/B001_1.hs            |    6 ++++++
 tests/driver/dynamicToo/B001_2.hs            |    6 ++++++
 tests/driver/dynamicToo/C001.hs              |    9 +++++++++
 tests/driver/dynamicToo/Makefile             |   23 +++++++++++++++++++++++
 tests/driver/dynamicToo/all.T                |   11 +++++++++++
 tests/driver/dynamicToo/dynamicToo001.stdout |    4 ++++
 8 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/tests/driver/dynamicToo/A001.hs b/tests/driver/dynamicToo/A001.hs
new file mode 100644
index 0000000..073c5fd
--- /dev/null
+++ b/tests/driver/dynamicToo/A001.hs
@@ -0,0 +1,6 @@
+
+module A001 where
+
+a :: Char
+a = 'a'
+
diff --git a/tests/driver/dynamicToo/B001.hs b/tests/driver/dynamicToo/B001.hs
new file mode 100644
index 0000000..bd06202
--- /dev/null
+++ b/tests/driver/dynamicToo/B001.hs
@@ -0,0 +1,6 @@
+
+module B001 where
+
+b :: Char
+b = 'c'
+
diff --git a/tests/driver/dynamicToo/B001_1.hs b/tests/driver/dynamicToo/B001_1.hs
new file mode 100644
index 0000000..9640f7b
--- /dev/null
+++ b/tests/driver/dynamicToo/B001_1.hs
@@ -0,0 +1,6 @@
+
+module B001 where
+
+b :: Char
+b = 'b'
+
diff --git a/tests/driver/dynamicToo/B001_2.hs b/tests/driver/dynamicToo/B001_2.hs
new file mode 100644
index 0000000..bd06202
--- /dev/null
+++ b/tests/driver/dynamicToo/B001_2.hs
@@ -0,0 +1,6 @@
+
+module B001 where
+
+b :: Char
+b = 'c'
+
diff --git a/tests/driver/dynamicToo/C001.hs b/tests/driver/dynamicToo/C001.hs
new file mode 100644
index 0000000..1adff5f
--- /dev/null
+++ b/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/tests/driver/dynamicToo/Makefile b/tests/driver/dynamicToo/Makefile
new file mode 100644
index 0000000..5083fe4
--- /dev/null
+++ b/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/tests/driver/dynamicToo/all.T b/tests/driver/dynamicToo/all.T
new file mode 100644
index 0000000..c10aa2e
--- /dev/null
+++ b/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/tests/driver/dynamicToo/dynamicToo001.stdout b/tests/driver/dynamicToo/dynamicToo001.stdout
new file mode 100644
index 0000000..e7aea07
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo001.stdout
@@ -0,0 +1,4 @@
+'a'
+'b'
+'a'
+'c'
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.