[commit: testsuite] master: Add another -dynamic-too test (5be6042)

Ian Lynagh igloo at earth.li
Sat Jun 22 13:39:02 CEST 2013


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

https://github.com/ghc/testsuite/commit/5be60424d26006ef6e4f8fecbc19a7936e928ba2

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

commit 5be60424d26006ef6e4f8fecbc19a7936e928ba2
Author: Ian Lynagh <ian at well-typed.com>
Date:   Fri Jun 21 15:50:03 2013 +0100

    Add another -dynamic-too test

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

 tests/driver/dynamicToo/dynamicToo004/Makefile     |   55 ++++++++++++++++++++
 .../{T3007/A => dynamicToo/dynamicToo004}/Setup.hs |    0 
 tests/driver/dynamicToo/dynamicToo004/pkg1/A.hs    |    5 ++
 .../dynamicToo/dynamicToo004/pkg1/pkg1.cabal       |    7 +++
 tests/driver/dynamicToo/dynamicToo004/pkg1dyn/A.hs |    5 ++
 .../dynamicToo/dynamicToo004/pkg1dyn/pkg1.cabal    |    7 +++
 tests/driver/dynamicToo/dynamicToo004/pkg2/B.hs    |    5 ++
 tests/driver/dynamicToo/dynamicToo004/pkg2/C.hs    |    9 +++
 .../dynamicToo/dynamicToo004/pkg2/pkg2.cabal       |    7 +++
 tests/driver/dynamicToo/dynamicToo004/prog.hs      |    7 +++
 tests/driver/dynamicToo/dynamicToo004/test.T       |    9 +++
 11 files changed, 116 insertions(+), 0 deletions(-)

diff --git a/tests/driver/dynamicToo/dynamicToo004/Makefile b/tests/driver/dynamicToo/dynamicToo004/Makefile
new file mode 100644
index 0000000..16ea193
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/Makefile
@@ -0,0 +1,55 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+checkExists = [ -f $1 ] || echo $1 missing
+
+LOCAL_PKGCONF=local.package.conf
+
+.PHONY: clean
+clean:
+	rm -f Setup.o Setup.hi Setup Setup.exe
+	rm -rf $(LOCAL_PKGCONF)
+	rm -rf pkg1/dist
+	rm -rf pkg1dyn/dist
+	rm -rf pkg2/dist
+	rm -f prog.o     prog.hi     progstatic  progstatic.exe
+	rm -f prog.dyn_o prog.dyn_hi progdynamic progdynamic.exe
+
+.PHONY: dynamicToo004
+dynamicToo004:
+	$(MAKE) clean
+
+	"$(GHC_PKG)" init $(LOCAL_PKGCONF)
+	"$(TEST_HC)" -v0 --make Setup.hs
+
+# First make the vanilla pkg1
+	cd pkg1 && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF) --enable-library-vanilla --disable-shared
+	cd pkg1 && ../Setup build
+	cd pkg1 && ../Setup register --inplace
+
+# Then the dynamic pkg1. This has different code in A.hs, so we get
+# a different hash.
+	cd pkg1dyn && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF) --disable-library-vanilla --enable-shared
+	cd pkg1dyn && ../Setup build
+
+# Now merge the dynamic outputs into the registered directory
+	cp pkg1dyn/dist/build/A.dyn_hi   pkg1/dist/build/
+	cp pkg1dyn/dist/build/A.dyn_o    pkg1/dist/build/
+	cp pkg1dyn/dist/build/libHSpkg1* pkg1/dist/build/
+
+# Next compile pkg2 both ways, which will use -dynamic-too
+	cd pkg2 && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF) --enable-library-vanilla --enable-shared
+	cd pkg2 && ../Setup build
+	cd pkg2 && ../Setup register --inplace
+
+# And then compile a program using the library both ways
+	"$(TEST_HC)" -package-db $(LOCAL_PKGCONF) --make prog -o progstatic
+	"$(TEST_HC)" -package-db $(LOCAL_PKGCONF) --make prog -o progdynamic -dynamic -osuf dyn_o -hisuf dyn_hi
+
+# Both should run, giving their respective outputs
+	echo static
+	./progstatic
+	echo dynamic
+	./progdynamic
+
diff --git a/tests/driver/T3007/A/Setup.hs b/tests/driver/dynamicToo/dynamicToo004/Setup.hs
similarity index 100%
copy from tests/driver/T3007/A/Setup.hs
copy to tests/driver/dynamicToo/dynamicToo004/Setup.hs
diff --git a/tests/driver/dynamicToo/dynamicToo004/pkg1/A.hs b/tests/driver/dynamicToo/dynamicToo004/pkg1/A.hs
new file mode 100644
index 0000000..ff865ff
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/pkg1/A.hs
@@ -0,0 +1,5 @@
+
+module A where
+
+a :: Char
+a = 'a'
diff --git a/tests/driver/dynamicToo/dynamicToo004/pkg1/pkg1.cabal b/tests/driver/dynamicToo/dynamicToo004/pkg1/pkg1.cabal
new file mode 100644
index 0000000..9d6c2d3
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/pkg1/pkg1.cabal
@@ -0,0 +1,7 @@
+Name:    pkg1
+Version: 1
+
+Library
+    Exposed-Modules: A
+    Build-Depends: base
+
diff --git a/tests/driver/dynamicToo/dynamicToo004/pkg1dyn/A.hs b/tests/driver/dynamicToo/dynamicToo004/pkg1dyn/A.hs
new file mode 100644
index 0000000..ec75bb3
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/pkg1dyn/A.hs
@@ -0,0 +1,5 @@
+
+module A where
+
+a :: Char
+a = 'x'
diff --git a/tests/driver/dynamicToo/dynamicToo004/pkg1dyn/pkg1.cabal b/tests/driver/dynamicToo/dynamicToo004/pkg1dyn/pkg1.cabal
new file mode 100644
index 0000000..9d6c2d3
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/pkg1dyn/pkg1.cabal
@@ -0,0 +1,7 @@
+Name:    pkg1
+Version: 1
+
+Library
+    Exposed-Modules: A
+    Build-Depends: base
+
diff --git a/tests/driver/dynamicToo/dynamicToo004/pkg2/B.hs b/tests/driver/dynamicToo/dynamicToo004/pkg2/B.hs
new file mode 100644
index 0000000..abbce05
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/pkg2/B.hs
@@ -0,0 +1,5 @@
+
+module B where
+
+b :: Char
+b = 'b'
diff --git a/tests/driver/dynamicToo/dynamicToo004/pkg2/C.hs b/tests/driver/dynamicToo/dynamicToo004/pkg2/C.hs
new file mode 100644
index 0000000..a853f2f
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/pkg2/C.hs
@@ -0,0 +1,9 @@
+
+module C where
+
+import A
+import B
+
+c :: String
+c = [a, b]
+
diff --git a/tests/driver/dynamicToo/dynamicToo004/pkg2/pkg2.cabal b/tests/driver/dynamicToo/dynamicToo004/pkg2/pkg2.cabal
new file mode 100644
index 0000000..163dda6
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/pkg2/pkg2.cabal
@@ -0,0 +1,7 @@
+Name:    pkg2
+Version: 1
+
+Library
+    Exposed-Modules: B, C
+    Build-Depends: base, pkg1
+
diff --git a/tests/driver/dynamicToo/dynamicToo004/prog.hs b/tests/driver/dynamicToo/dynamicToo004/prog.hs
new file mode 100644
index 0000000..de674d3
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/prog.hs
@@ -0,0 +1,7 @@
+
+module Main (main) where
+
+import C
+
+main :: IO ()
+main = putStrLn c
diff --git a/tests/driver/dynamicToo/dynamicToo004/test.T b/tests/driver/dynamicToo/dynamicToo004/test.T
new file mode 100644
index 0000000..d8618f5
--- /dev/null
+++ b/tests/driver/dynamicToo/dynamicToo004/test.T
@@ -0,0 +1,9 @@
+
+test('dynamicToo004',
+     [only_compiler_types(['ghc']),
+      expect_broken(7665),
+      unless(have_vanilla(), skip),
+      unless(have_dynamic(), skip)],
+     run_command,
+     ['$MAKE -s --no-print-directory dynamicToo004'])
+





More information about the ghc-commits mailing list