summaryrefslogtreecommitdiff
path: root/testsuite/tests/cabal
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-10-18 22:17:10 -0400
committerBen Gamari <ben@smart-cactus.org>2016-10-18 22:17:10 -0400
commit3866481f228b28687c4021d9deb16e2138fdc008 (patch)
treea0fb1dcfba56022d434bd2f7a7fd2e161c7b118f /testsuite/tests/cabal
parenta3bc93e58f917c0e03aed1a08fe56bddb16ca773 (diff)
downloadhaskell-3866481f228b28687c4021d9deb16e2138fdc008.tar.gz
Compute export hash based on ALL transitive orphan modules.
Previously we pruned out orphan modules from external packages but this was wrong. Fixes #12733 (which has more discussion.) Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2610 GHC Trac Issues: #12733
Diffstat (limited to 'testsuite/tests/cabal')
-rw-r--r--testsuite/tests/cabal/T12733/.gitignore1
-rw-r--r--testsuite/tests/cabal/T12733/Makefile31
-rw-r--r--testsuite/tests/cabal/T12733/Setup.hs2
-rw-r--r--testsuite/tests/cabal/T12733/T12733.stderr5
-rw-r--r--testsuite/tests/cabal/T12733/all.T9
-rw-r--r--testsuite/tests/cabal/T12733/p/P.hs.in13
-rw-r--r--testsuite/tests/cabal/T12733/p/P.hs.in25
-rw-r--r--testsuite/tests/cabal/T12733/p/Setup.hs2
-rw-r--r--testsuite/tests/cabal/T12733/p/p.cabal11
-rw-r--r--testsuite/tests/cabal/T12733/q/Q.hs2
-rw-r--r--testsuite/tests/cabal/T12733/q/Q2.hs4
-rw-r--r--testsuite/tests/cabal/T12733/q/Setup.hs2
-rw-r--r--testsuite/tests/cabal/T12733/q/q.cabal11
13 files changed, 88 insertions, 0 deletions
diff --git a/testsuite/tests/cabal/T12733/.gitignore b/testsuite/tests/cabal/T12733/.gitignore
new file mode 100644
index 0000000000..b5b727a0d5
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/.gitignore
@@ -0,0 +1 @@
+p/P.hs
diff --git a/testsuite/tests/cabal/T12733/Makefile b/testsuite/tests/cabal/T12733/Makefile
new file mode 100644
index 0000000000..04de2ada62
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/Makefile
@@ -0,0 +1,31 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP=../Setup -v0
+
+T12733: clean
+ $(MAKE) -s --no-print-directory clean
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' -v0 --make Setup
+ cp p/P.hs.in1 p/P.hs
+ cd p && $(SETUP) clean
+ cd p && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
+ cd p && $(SETUP) build
+ cd p && $(SETUP) register --inplace
+ cd q && $(SETUP) clean
+ cd q && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
+ cd q && $(SETUP) build
+ cd q && $(SETUP) register --inplace
+ # Building q should have taken enough time
+ cp p/P.hs.in2 p/P.hs
+ cd p && $(SETUP) build
+ # should fail due to overlapping instance
+ cd q && ! $(SETUP) build
+
+ifneq "$(CLEANUP)" ""
+ $(MAKE) -s --no-print-directory clean
+endif
+
+clean :
+ $(RM) -r tmp*.d inst-* *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext)
diff --git a/testsuite/tests/cabal/T12733/Setup.hs b/testsuite/tests/cabal/T12733/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/cabal/T12733/T12733.stderr b/testsuite/tests/cabal/T12733/T12733.stderr
new file mode 100644
index 0000000000..bc4156d518
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/T12733.stderr
@@ -0,0 +1,5 @@
+
+Q2.hs:3:10: error:
+ Duplicate instance declarations:
+ instance Show (IO a) -- Defined at Q2.hs:3:10
+ instance [safe] Show (IO a) -- Defined in ā€˜Pā€™
diff --git a/testsuite/tests/cabal/T12733/all.T b/testsuite/tests/cabal/T12733/all.T
new file mode 100644
index 0000000000..8b00daa66a
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/all.T
@@ -0,0 +1,9 @@
+if config.cleanup:
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = 'CLEANUP=0'
+
+test('T12733',
+ normal,
+ run_command,
+ ['$MAKE -s --no-print-directory T12733 ' + cleanup])
diff --git a/testsuite/tests/cabal/T12733/p/P.hs.in1 b/testsuite/tests/cabal/T12733/p/P.hs.in1
new file mode 100644
index 0000000000..41aaf80ee1
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/p/P.hs.in1
@@ -0,0 +1,3 @@
+module P where
+instance Show (a -> b) where
+ show = undefined
diff --git a/testsuite/tests/cabal/T12733/p/P.hs.in2 b/testsuite/tests/cabal/T12733/p/P.hs.in2
new file mode 100644
index 0000000000..4a8061979e
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/p/P.hs.in2
@@ -0,0 +1,5 @@
+module P where
+instance Show (a -> b) where
+ show = undefined
+instance Show (IO a) where
+ show = undefined
diff --git a/testsuite/tests/cabal/T12733/p/Setup.hs b/testsuite/tests/cabal/T12733/p/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/p/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/cabal/T12733/p/p.cabal b/testsuite/tests/cabal/T12733/p/p.cabal
new file mode 100644
index 0000000000..b0113ee1f1
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/p/p.cabal
@@ -0,0 +1,11 @@
+name: p
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: P
+ build-depends: base
+ default-language: Haskell2010
diff --git a/testsuite/tests/cabal/T12733/q/Q.hs b/testsuite/tests/cabal/T12733/q/Q.hs
new file mode 100644
index 0000000000..8c7bcdc87b
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/q/Q.hs
@@ -0,0 +1,2 @@
+module Q where
+import P
diff --git a/testsuite/tests/cabal/T12733/q/Q2.hs b/testsuite/tests/cabal/T12733/q/Q2.hs
new file mode 100644
index 0000000000..c85e9baec1
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/q/Q2.hs
@@ -0,0 +1,4 @@
+module Q2 where
+import Q
+instance Show (IO a) where
+ show = undefined
diff --git a/testsuite/tests/cabal/T12733/q/Setup.hs b/testsuite/tests/cabal/T12733/q/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/q/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/cabal/T12733/q/q.cabal b/testsuite/tests/cabal/T12733/q/q.cabal
new file mode 100644
index 0000000000..81591a1db1
--- /dev/null
+++ b/testsuite/tests/cabal/T12733/q/q.cabal
@@ -0,0 +1,11 @@
+name: q
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: Q Q2
+ build-depends: base, p
+ default-language: Haskell2010