summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-02-12 02:44:01 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2017-02-17 13:43:07 -0800
commitca543154bbf0ec36ee2654050ee67a467420449f (patch)
tree0962e9c12f0aab2631d20f80263d6a96ecbd5346 /testsuite/tests/backpack
parent0e7601749d53d59df528ede996d8b54352051498 (diff)
downloadhaskell-ca543154bbf0ec36ee2654050ee67a467420449f.tar.gz
Fix a Backpack recompilation avoidance bug when signatures change.
Summary: Recompilation avoidance checks if -this-unit-id has changed by relying on the "wanted module" check in readIface ("Something is amiss..."). Unfortunately, this check didn't check if the instantiation made sense, which meant that if you changed the signatures of a Backpack package, we'd still treat the old signatures as up-to-date. The way I fixed this was by having findAndReadIface take in a 'Module' representing the /actual/ module we were intending to lookup. We convert this into the 'Module' we expect to see in 'mi_module' and now do a more elaborate check that will also verify that instantiations make sense. Along the way, I robustified the logging infrastructure for recompilation checking, and folded wrongIfaceModErr (which was dead code) into the error message. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: bgamari, austin Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3130
Diffstat (limited to 'testsuite/tests/backpack')
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/.gitignore3
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/Makefile29
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/Setup.hs2
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/all.T10
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in117
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in217
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/p/A.hsig1
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/q/A/B.hsig.in2
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal04/q/B.hsig.in2
-rw-r--r--testsuite/tests/backpack/should_compile/bkp51.bkp2
10 files changed, 84 insertions, 1 deletions
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/.gitignore b/testsuite/tests/backpack/cabal/bkpcabal04/.gitignore
new file mode 100644
index 0000000000..4a6a47f966
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/.gitignore
@@ -0,0 +1,3 @@
+bkpcabal04.cabal
+q/B.hsig
+q/A/B.hsig
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/Makefile b/testsuite/tests/backpack/cabal/bkpcabal04/Makefile
new file mode 100644
index 0000000000..0e81107d9e
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/Makefile
@@ -0,0 +1,29 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP='$(PWD)/Setup' -v0
+CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst'
+
+bkpcabal04: clean
+ $(MAKE) -s --no-print-directory clean
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' -v0 --make Setup
+ cp bkpcabal04.cabal.in1 bkpcabal04.cabal
+ cp q/B.hsig.in q/B.hsig
+ # typecheck
+ $(CONFIGURE)
+ $(SETUP) build
+ # new version
+ cp bkpcabal04.cabal.in2 bkpcabal04.cabal
+ rm q/B.hsig
+ cp q/A/B.hsig.in q/A/B.hsig
+ # typecheck
+ $(CONFIGURE)
+ $(SETUP) build
+ifneq "$(CLEANUP)" ""
+ $(MAKE) -s --no-print-directory clean
+endif
+
+clean :
+ $(RM) -rf tmp.d inst dist Setup$(exeext) q/A/B.hsig q/B.hsig bkpcabal04.cabal
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/Setup.hs b/testsuite/tests/backpack/cabal/bkpcabal04/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/all.T b/testsuite/tests/backpack/cabal/bkpcabal04/all.T
new file mode 100644
index 0000000000..998882ef5e
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/all.T
@@ -0,0 +1,10 @@
+if config.cleanup:
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = 'CLEANUP=0'
+
+# Test recompilation checking on signatures
+test('bkpcabal04',
+ normal,
+ run_command,
+ ['$MAKE -s --no-print-directory bkpcabal04 ' + cleanup])
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in1 b/testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in1
new file mode 100644
index 0000000000..1ce11c5bcc
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in1
@@ -0,0 +1,17 @@
+name: bkpcabal04
+version: 0.1.0.0
+license: BSD3
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.25
+
+library p
+ signatures: A
+ build-depends: base
+ hs-source-dirs: p
+
+library q
+ signatures: B
+ build-depends: base, p
+ hs-source-dirs: q
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in2 b/testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in2
new file mode 100644
index 0000000000..e6fa4c6660
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in2
@@ -0,0 +1,17 @@
+name: bkpcabal04
+version: 0.1.0.0
+license: BSD3
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.25
+
+library p
+ signatures: A
+ build-depends: base
+ hs-source-dirs: p
+
+library q
+ signatures: A.B
+ build-depends: base, p
+ hs-source-dirs: q
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/p/A.hsig b/testsuite/tests/backpack/cabal/bkpcabal04/p/A.hsig
new file mode 100644
index 0000000000..cd83bfff2a
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/p/A.hsig
@@ -0,0 +1 @@
+signature A where
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/q/A/B.hsig.in b/testsuite/tests/backpack/cabal/bkpcabal04/q/A/B.hsig.in
new file mode 100644
index 0000000000..797f45c401
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/q/A/B.hsig.in
@@ -0,0 +1,2 @@
+signature A.B where
+import A
diff --git a/testsuite/tests/backpack/cabal/bkpcabal04/q/B.hsig.in b/testsuite/tests/backpack/cabal/bkpcabal04/q/B.hsig.in
new file mode 100644
index 0000000000..30fdf7e274
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal04/q/B.hsig.in
@@ -0,0 +1,2 @@
+signature B where
+import A
diff --git a/testsuite/tests/backpack/should_compile/bkp51.bkp b/testsuite/tests/backpack/should_compile/bkp51.bkp
index af0a422464..6b8cecbc64 100644
--- a/testsuite/tests/backpack/should_compile/bkp51.bkp
+++ b/testsuite/tests/backpack/should_compile/bkp51.bkp
@@ -24,7 +24,7 @@ unit s where
import D
z = show id
unit t where
- dependency r[B=s:E,H=<H>]
+ dependency r[B=s[H=<H>]:E,H=<H>]
module F where
import D
a = show id