summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver/recomp007
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/driver/recomp007')
-rw-r--r--testsuite/tests/driver/recomp007/Makefile28
-rw-r--r--testsuite/tests/driver/recomp007/Setup.hs2
-rw-r--r--testsuite/tests/driver/recomp007/a1/A.hs3
-rw-r--r--testsuite/tests/driver/recomp007/a1/a.cabal7
-rw-r--r--testsuite/tests/driver/recomp007/a2/A.hs3
-rw-r--r--testsuite/tests/driver/recomp007/a2/a.cabal7
-rw-r--r--testsuite/tests/driver/recomp007/all.T9
-rw-r--r--testsuite/tests/driver/recomp007/b/B.hs5
-rw-r--r--testsuite/tests/driver/recomp007/b/Main.hs5
-rw-r--r--testsuite/tests/driver/recomp007/b/b.cabal10
-rw-r--r--testsuite/tests/driver/recomp007/recomp007.stderr1
-rw-r--r--testsuite/tests/driver/recomp007/recomp007.stdout4
12 files changed, 84 insertions, 0 deletions
diff --git a/testsuite/tests/driver/recomp007/Makefile b/testsuite/tests/driver/recomp007/Makefile
new file mode 100644
index 0000000000..94d46e8242
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/Makefile
@@ -0,0 +1,28 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+LOCAL_PKGCONF=local.package.conf
+
+clean:
+ rm -f Setup$(exeext)
+ rm -rf a1/dist a2/dist b/dist
+ rm -f *.o *.hi
+ rm -f clean.out prep.out
+ rm -rf $(LOCAL_PKGCONF)
+
+recomp007:
+ $(MAKE) clean
+ "$(GHC_PKG)" init $(LOCAL_PKGCONF)
+ "$(TEST_HC)" -v0 --make Setup.hs
+ $(MAKE) prep.a1
+ $(MAKE) prep.b
+ "$(GHC_PKG)" unregister --package-conf=$(LOCAL_PKGCONF) a-1.0
+ $(MAKE) prep.a2
+ cd b && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF)
+ cd b && ../Setup build
+
+prep.%:
+ cd $* && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF)
+ cd $* && ../Setup build -v0
+ cd $* && ../Setup register -v0 --inplace
diff --git a/testsuite/tests/driver/recomp007/Setup.hs b/testsuite/tests/driver/recomp007/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/recomp007/a1/A.hs b/testsuite/tests/driver/recomp007/a1/A.hs
new file mode 100644
index 0000000000..8e028dcab8
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/a1/A.hs
@@ -0,0 +1,3 @@
+module A (a) where
+
+a = "1.0"
diff --git a/testsuite/tests/driver/recomp007/a1/a.cabal b/testsuite/tests/driver/recomp007/a1/a.cabal
new file mode 100644
index 0000000000..cb6d3c01b9
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/a1/a.cabal
@@ -0,0 +1,7 @@
+name: a
+version: 1.0
+exposed-modules: A
+build-depends: base
+build-type: Simple
+ghc-options: -O0
+
diff --git a/testsuite/tests/driver/recomp007/a2/A.hs b/testsuite/tests/driver/recomp007/a2/A.hs
new file mode 100644
index 0000000000..273896245c
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/a2/A.hs
@@ -0,0 +1,3 @@
+module A (a) where
+
+a = "2.0"
diff --git a/testsuite/tests/driver/recomp007/a2/a.cabal b/testsuite/tests/driver/recomp007/a2/a.cabal
new file mode 100644
index 0000000000..5c3ae6a74d
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/a2/a.cabal
@@ -0,0 +1,7 @@
+name: a
+version: 2.0
+exposed-modules: A
+build-depends: base
+build-type: Simple
+ghc-options: -O0
+
diff --git a/testsuite/tests/driver/recomp007/all.T b/testsuite/tests/driver/recomp007/all.T
new file mode 100644
index 0000000000..5a93a12d68
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/all.T
@@ -0,0 +1,9 @@
+# This tests for correct recompilation when a package version changes.
+# See the patch
+# "Fix a recompilation checking bug when a package dependency changes"
+
+test('recomp007',
+ [ skip_if_fast, clean_cmd('$MAKE -s clean'), normalise_slashes ],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp007'])
+
diff --git a/testsuite/tests/driver/recomp007/b/B.hs b/testsuite/tests/driver/recomp007/b/B.hs
new file mode 100644
index 0000000000..742c5d3a3f
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/b/B.hs
@@ -0,0 +1,5 @@
+module B (b) where
+
+import A
+
+b = a
diff --git a/testsuite/tests/driver/recomp007/b/Main.hs b/testsuite/tests/driver/recomp007/b/Main.hs
new file mode 100644
index 0000000000..ca60a5902b
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/b/Main.hs
@@ -0,0 +1,5 @@
+module Main (main) where
+
+import B
+
+main = print b
diff --git a/testsuite/tests/driver/recomp007/b/b.cabal b/testsuite/tests/driver/recomp007/b/b.cabal
new file mode 100644
index 0000000000..988ef871a2
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/b/b.cabal
@@ -0,0 +1,10 @@
+name: b
+version: 1.0
+build-type: Simple
+cabal-version: >= 1.2
+executable test {
+ build-depends: base, a
+ main-is: Main.hs
+ other-modules: B
+ ghc-options: -O0
+}
diff --git a/testsuite/tests/driver/recomp007/recomp007.stderr b/testsuite/tests/driver/recomp007/recomp007.stderr
new file mode 100644
index 0000000000..290be5f14d
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/recomp007.stderr
@@ -0,0 +1 @@
+Linking dist/build/test/test ...
diff --git a/testsuite/tests/driver/recomp007/recomp007.stdout b/testsuite/tests/driver/recomp007/recomp007.stdout
new file mode 100644
index 0000000000..b956b8f9a3
--- /dev/null
+++ b/testsuite/tests/driver/recomp007/recomp007.stdout
@@ -0,0 +1,4 @@
+Building b-1.0...
+Preprocessing executable 'test' for b-1.0...
+[1 of 2] Compiling B ( B.hs, dist/build/test/test-tmp/B.o )
+[2 of 2] Compiling Main ( Main.hs, dist/build/test/test-tmp/Main.o )