summaryrefslogtreecommitdiff
path: root/testsuite/tests/cabal/cabal02
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/cabal/cabal02')
-rw-r--r--testsuite/tests/cabal/cabal02/Makefile33
-rw-r--r--testsuite/tests/cabal/cabal02/P1/A.hs3
-rw-r--r--testsuite/tests/cabal/cabal02/P1/P1.cabal4
-rw-r--r--testsuite/tests/cabal/cabal02/P2/A.hs3
-rw-r--r--testsuite/tests/cabal/cabal02/P2/P2.cabal4
-rw-r--r--testsuite/tests/cabal/cabal02/Q/B.hs5
-rw-r--r--testsuite/tests/cabal/cabal02/Q/Q.cabal4
-rw-r--r--testsuite/tests/cabal/cabal02/R/Main.hs4
-rw-r--r--testsuite/tests/cabal/cabal02/R/R.cabal6
-rw-r--r--testsuite/tests/cabal/cabal02/all.T8
10 files changed, 74 insertions, 0 deletions
diff --git a/testsuite/tests/cabal/cabal02/Makefile b/testsuite/tests/cabal/cabal02/Makefile
new file mode 100644
index 0000000000..c7348a3927
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/Makefile
@@ -0,0 +1,33 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+CABAL_SETUP = $(FPTOOLS_TOP_ABS)/libraries/Cabal/cabal-setup/cabal-setup
+
+CONFIG_ARGS = --with-compiler=$(TEST_HC) --ghc-options='$(TEST_HC_OPTS)' --with-hc-pkg=$(GHC_PKG)
+
+# We have 3 packages, P-1.0, P-2.0, and Q. Q depends on P-1.0.
+# We have an executable R, that depends on P-2.0 and Q, so the resulting
+# executable will link to both P-1.0 and P-2.0.
+
+cabal02 :
+ (cd P1 && $(CABAL_SETUP) configure $(CONFIG_ARGS))
+ (cd P1 && $(CABAL_SETUP) build)
+ (cd P1 && $(CABAL_SETUP) register --inplace --user)
+ (cd P2 && $(CABAL_SETUP) configure $(CONFIG_ARGS))
+ (cd P2 && $(CABAL_SETUP) build)
+ (cd P2 && $(CABAL_SETUP) register --inplace --user)
+ (cd Q && $(CABAL_SETUP) configure $(CONFIG_ARGS))
+ (cd Q && $(CABAL_SETUP) build)
+ (cd Q && $(CABAL_SETUP) register --inplace --user)
+ (cd R && $(CABAL_SETUP) configure $(CONFIG_ARGS))
+ (cd R && $(CABAL_SETUP) build)
+ $(MAKE) clean
+
+clean ::
+ (cd P1 && $(CABAL_SETUP) unregister --user)
+ (cd P2 && $(CABAL_SETUP) unregister --user)
+ (cd Q && $(CABAL_SETUP) unregister --user)
+ (cd P1 && $(CABAL_SETUP) clean)
+ (cd P2 && $(CABAL_SETUP) clean)
+ (cd Q && $(CABAL_SETUP) clean)
diff --git a/testsuite/tests/cabal/cabal02/P1/A.hs b/testsuite/tests/cabal/cabal02/P1/A.hs
new file mode 100644
index 0000000000..411d1dd4ef
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/P1/A.hs
@@ -0,0 +1,3 @@
+module A where
+
+a = 1 :: Int
diff --git a/testsuite/tests/cabal/cabal02/P1/P1.cabal b/testsuite/tests/cabal/cabal02/P1/P1.cabal
new file mode 100644
index 0000000000..c4b2161cea
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/P1/P1.cabal
@@ -0,0 +1,4 @@
+Name: P
+Version: 1.0
+Exposed-Modules: A
+Build-depends: base>=1.0, haskell98
diff --git a/testsuite/tests/cabal/cabal02/P2/A.hs b/testsuite/tests/cabal/cabal02/P2/A.hs
new file mode 100644
index 0000000000..3db5ca96ef
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/P2/A.hs
@@ -0,0 +1,3 @@
+module A where
+
+a = 2
diff --git a/testsuite/tests/cabal/cabal02/P2/P2.cabal b/testsuite/tests/cabal/cabal02/P2/P2.cabal
new file mode 100644
index 0000000000..3991b20839
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/P2/P2.cabal
@@ -0,0 +1,4 @@
+Name: P
+Version: 2.0
+Exposed-Modules: A
+Build-depends: base>=1.0, haskell98
diff --git a/testsuite/tests/cabal/cabal02/Q/B.hs b/testsuite/tests/cabal/cabal02/Q/B.hs
new file mode 100644
index 0000000000..0fd13a9ff3
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/Q/B.hs
@@ -0,0 +1,5 @@
+module B where
+
+import A -- from package P
+
+b = a
diff --git a/testsuite/tests/cabal/cabal02/Q/Q.cabal b/testsuite/tests/cabal/cabal02/Q/Q.cabal
new file mode 100644
index 0000000000..e439f49175
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/Q/Q.cabal
@@ -0,0 +1,4 @@
+Name: Q
+Version: 1.0
+Build-depends: base>=1.0, haskell98, P==1.0
+Exposed-modules: B
diff --git a/testsuite/tests/cabal/cabal02/R/Main.hs b/testsuite/tests/cabal/cabal02/R/Main.hs
new file mode 100644
index 0000000000..a6ddcdf6c1
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/R/Main.hs
@@ -0,0 +1,4 @@
+import A
+import B
+
+main = do print a; print b
diff --git a/testsuite/tests/cabal/cabal02/R/R.cabal b/testsuite/tests/cabal/cabal02/R/R.cabal
new file mode 100644
index 0000000000..73c6bfc881
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/R/R.cabal
@@ -0,0 +1,6 @@
+Name: R
+Version: 1.0
+Build-depends: base>=1.0, haskell98, P==2.0, Q
+
+Executable: R
+Main-is: Main.hs
diff --git a/testsuite/tests/cabal/cabal02/all.T b/testsuite/tests/cabal/cabal02/all.T
new file mode 100644
index 0000000000..bfa809109b
--- /dev/null
+++ b/testsuite/tests/cabal/cabal02/all.T
@@ -0,0 +1,8 @@
+# cabal-setup isn't in the GHC tree any more; this test should probably
+# be moved to the cabal-setup package.
+test('cabal02',
+ [skip,
+ skip_if_fast,
+ if_platform('i386-unknown-mingw32', expect_broken(1196))],
+ run_command,
+ ['$MAKE -s --no-print-directory cabal02'])