summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack/cabal
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-25 22:50:55 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2017-04-02 16:39:40 -0700
commit5fb485a3e1e83a1f5c6acf989be292940229e1a4 (patch)
tree755ff931bfe2fc94d5985464d1a623b4c8ab06d0 /testsuite/tests/backpack/cabal
parentd4e8ebcd04cc210bd15a1fd7677558e8b04b3da8 (diff)
downloadhaskell-5fb485a3e1e83a1f5c6acf989be292940229e1a4.tar.gz
Fix recompilation avoidance bug for implementor of hsig.
Summary: I observed a bug where if I modified the module which implemented an hsig in another package, GHC would not recompile the signature in this situation. The root cause was that we were conflating modules from user imports, and "system" module dependencies (from signature merging and instantiation.) So this patch handles them separately. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, bgamari, austin Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3381
Diffstat (limited to 'testsuite/tests/backpack/cabal')
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/.gitignore1
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/Makefile27
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/Setup.hs2
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/all.T9
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.cabal24
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr4
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/impl/P.hs.in13
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/impl/P.hs.in21
-rw-r--r--testsuite/tests/backpack/cabal/bkpcabal06/sig/P.hsig2
9 files changed, 73 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/.gitignore b/testsuite/tests/backpack/cabal/bkpcabal06/.gitignore
new file mode 100644
index 0000000000..873250a6f8
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/.gitignore
@@ -0,0 +1 @@
+impl/P.hs
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/Makefile b/testsuite/tests/backpack/cabal/bkpcabal06/Makefile
new file mode 100644
index 0000000000..29f1456e63
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/Makefile
@@ -0,0 +1,27 @@
+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'
+
+# This test checks if recompilation works correctly when we change an
+# hsig file which modifies the set of exported instances. Makes sure
+# we track dependencies on instances from signatures correctly.
+
+bkpcabal06: clean
+ $(MAKE) -s --no-print-directory clean
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' -v0 --make Setup
+ $(CONFIGURE)
+ cp impl/P.hs.in1 impl/P.hs
+ $(SETUP) build
+ sleep 1
+ cp impl/P.hs.in2 impl/P.hs
+ ! $(SETUP) build
+ifneq "$(CLEANUP)" ""
+ $(MAKE) -s --no-print-directory clean
+endif
+
+clean :
+ $(RM) -rf tmp.d inst dist Setup$(exeext) impl/P.hs
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/Setup.hs b/testsuite/tests/backpack/cabal/bkpcabal06/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/all.T b/testsuite/tests/backpack/cabal/bkpcabal06/all.T
new file mode 100644
index 0000000000..26db90c976
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/all.T
@@ -0,0 +1,9 @@
+if config.cleanup:
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = 'CLEANUP=0'
+
+test('bkpcabal06',
+ extra_files(['bkpcabal06.cabal', 'Setup.hs', 'sig', 'impl']),
+ run_command,
+ ['$MAKE -s --no-print-directory bkpcabal06 ' + cleanup])
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.cabal b/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.cabal
new file mode 100644
index 0000000000..7dfac20986
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.cabal
@@ -0,0 +1,24 @@
+name: bkpcabal06
+version: 0.1.0.0
+license: BSD3
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library sig
+ signatures: P
+ reexported-modules: Prelude
+ build-depends: base
+ default-language: Haskell2010
+ hs-source-dirs: sig
+
+library impl
+ exposed-modules: P
+ build-depends: base
+ default-language: Haskell2010
+ hs-source-dirs: impl
+
+library
+ build-depends: sig, impl
+ default-language: Haskell2010
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr b/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr
new file mode 100644
index 0000000000..8998e6555e
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr
@@ -0,0 +1,4 @@
+
+sig/P.hsig:1:1: error:
+ • ‘p’ is exported by the hsig file, but not exported by the implementing module ‘z-bkpcabal06-z-impl-0.1.0.0:P’
+ • while checking that z-bkpcabal06-z-impl-0.1.0.0:P implements signature P in bkpcabal06-0.1.0.0:sig[P=z-bkpcabal06-z-impl-0.1.0.0:P]
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/impl/P.hs.in1 b/testsuite/tests/backpack/cabal/bkpcabal06/impl/P.hs.in1
new file mode 100644
index 0000000000..f0a4da313b
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/impl/P.hs.in1
@@ -0,0 +1,3 @@
+module P where
+p :: Int
+p = 3
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/impl/P.hs.in2 b/testsuite/tests/backpack/cabal/bkpcabal06/impl/P.hs.in2
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/impl/P.hs.in2
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/sig/P.hsig b/testsuite/tests/backpack/cabal/bkpcabal06/sig/P.hsig
new file mode 100644
index 0000000000..3c99ed9ed9
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/bkpcabal06/sig/P.hsig
@@ -0,0 +1,2 @@
+signature P where
+p :: Int