summaryrefslogtreecommitdiff
path: root/testsuite/tests/cabal
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/cabal
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/cabal')
-rw-r--r--testsuite/tests/cabal/1750.stderr5
-rw-r--r--testsuite/tests/cabal/1750.stdout4
-rw-r--r--testsuite/tests/cabal/1750A.pkg4
-rw-r--r--testsuite/tests/cabal/1750B.pkg4
-rw-r--r--testsuite/tests/cabal/Makefile184
-rw-r--r--testsuite/tests/cabal/all.T61
-rw-r--r--testsuite/tests/cabal/cabal01/A.hs4
-rw-r--r--testsuite/tests/cabal/cabal01/B/A.hs4
-rw-r--r--testsuite/tests/cabal/cabal01/B/MainB.hs5
-rw-r--r--testsuite/tests/cabal/cabal01/MainA.hs5
-rw-r--r--testsuite/tests/cabal/cabal01/Makefile41
-rw-r--r--testsuite/tests/cabal/cabal01/Setup.lhs2
-rw-r--r--testsuite/tests/cabal/cabal01/all.T16
-rw-r--r--testsuite/tests/cabal/cabal01/c_src/hello.c1
-rw-r--r--testsuite/tests/cabal/cabal01/cabal01.stdout12
-rw-r--r--testsuite/tests/cabal/cabal01/cabal01.stdout-i386-unknown-mingw3212
-rw-r--r--testsuite/tests/cabal/cabal01/hello.c1
-rw-r--r--testsuite/tests/cabal/cabal01/test.cabal16
-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
-rw-r--r--testsuite/tests/cabal/cabal03/Makefile41
-rw-r--r--testsuite/tests/cabal/cabal03/Setup.lhs2
-rw-r--r--testsuite/tests/cabal/cabal03/all.T9
-rw-r--r--testsuite/tests/cabal/cabal03/p/P.hs3
-rw-r--r--testsuite/tests/cabal/cabal03/p/p.cabal5
-rw-r--r--testsuite/tests/cabal/cabal03/q/q.cabal5
-rw-r--r--testsuite/tests/cabal/cabal03/r/r.cabal5
-rw-r--r--testsuite/tests/cabal/cabal04/Library.hs6
-rw-r--r--testsuite/tests/cabal/cabal04/Makefile23
-rw-r--r--testsuite/tests/cabal/cabal04/Setup.lhs2
-rw-r--r--testsuite/tests/cabal/cabal04/TH.hs6
-rw-r--r--testsuite/tests/cabal/cabal04/all.T21
-rw-r--r--testsuite/tests/cabal/cabal04/thtest.cabal11
-rw-r--r--testsuite/tests/cabal/ghcpkg01.stderr2
-rw-r--r--testsuite/tests/cabal/ghcpkg01.stdout223
-rw-r--r--testsuite/tests/cabal/ghcpkg03.stderr31
-rw-r--r--testsuite/tests/cabal/ghcpkg03.stderr-i386-unknown-mingw3231
-rw-r--r--testsuite/tests/cabal/ghcpkg03.stdout5
-rw-r--r--testsuite/tests/cabal/ghcpkg04.hs1
-rw-r--r--testsuite/tests/cabal/ghcpkg04.stderr4
-rw-r--r--testsuite/tests/cabal/ghcpkg05.stderr18
-rw-r--r--testsuite/tests/cabal/ghcpkg05.stderr-i386-unknown-mingw3218
-rw-r--r--testsuite/tests/cabal/ghcpkg05.stdout6
-rw-r--r--testsuite/tests/cabal/ghcpkg06.stderr2
-rw-r--r--testsuite/tests/cabal/ghcpkg06.stdout2
-rw-r--r--testsuite/tests/cabal/pkg01.hs3
-rw-r--r--testsuite/tests/cabal/pkg01.stderr0
-rw-r--r--testsuite/tests/cabal/pkg02/A.hs5
-rw-r--r--testsuite/tests/cabal/pkg02/Foreign.hs2
-rw-r--r--testsuite/tests/cabal/pkg02/Makefile4
-rw-r--r--testsuite/tests/cabal/pkg02/all.T10
-rw-r--r--testsuite/tests/cabal/pkg02/pkg02.stderr0
-rw-r--r--testsuite/tests/cabal/shadow.stderr4
-rw-r--r--testsuite/tests/cabal/shadow.stdout10
-rw-r--r--testsuite/tests/cabal/shadow1.pkg4
-rw-r--r--testsuite/tests/cabal/shadow2.pkg4
-rw-r--r--testsuite/tests/cabal/shadow3.pkg4
-rw-r--r--testsuite/tests/cabal/test.pkg19
-rw-r--r--testsuite/tests/cabal/test2.pkg19
-rw-r--r--testsuite/tests/cabal/test3.pkg19
-rw-r--r--testsuite/tests/cabal/test4.pkg19
-rw-r--r--testsuite/tests/cabal/test5.pkg18
-rw-r--r--testsuite/tests/cabal/testdup.pkg5
71 files changed, 1086 insertions, 0 deletions
diff --git a/testsuite/tests/cabal/1750.stderr b/testsuite/tests/cabal/1750.stderr
new file mode 100644
index 0000000000..71bed0745b
--- /dev/null
+++ b/testsuite/tests/cabal/1750.stderr
@@ -0,0 +1,5 @@
+WARNING: there are broken packages. Run 'ghc-pkg check' for more details.
+<command line>: cannot satisfy -package 1750A:
+ 1750A-1-XXX is unusable due to missing or recursive dependencies:
+ 1750B-1-XXX
+ (use -v for more information)
diff --git a/testsuite/tests/cabal/1750.stdout b/testsuite/tests/cabal/1750.stdout
new file mode 100644
index 0000000000..dac998e2ac
--- /dev/null
+++ b/testsuite/tests/cabal/1750.stdout
@@ -0,0 +1,4 @@
+local1750.package.conf:
+ {1750A-1}
+ {1750B-1}
+
diff --git a/testsuite/tests/cabal/1750A.pkg b/testsuite/tests/cabal/1750A.pkg
new file mode 100644
index 0000000000..e32c97ff8b
--- /dev/null
+++ b/testsuite/tests/cabal/1750A.pkg
@@ -0,0 +1,4 @@
+name: 1750A
+version: 1
+id: 1750A-1-XXX
+depends: 1750B-1-XXX
diff --git a/testsuite/tests/cabal/1750B.pkg b/testsuite/tests/cabal/1750B.pkg
new file mode 100644
index 0000000000..5e9ff1f56d
--- /dev/null
+++ b/testsuite/tests/cabal/1750B.pkg
@@ -0,0 +1,4 @@
+name: 1750B
+version: 1
+id: 1750B-1-XXX
+depends: 1750A-1-XXX
diff --git a/testsuite/tests/cabal/Makefile b/testsuite/tests/cabal/Makefile
new file mode 100644
index 0000000000..a036d820dd
--- /dev/null
+++ b/testsuite/tests/cabal/Makefile
@@ -0,0 +1,184 @@
+TOP=../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+PKGCONF01=local01.package.conf
+LOCAL_GHC_PKG01 = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONF01)
+
+STRIP_PKGROOT=sed 's/^pkgroot: .*$$/pkgroot: /'
+
+# a bunch of tests for ghc-pkg
+ghcpkg01 :
+ @rm -rf $(PKGCONF01)
+ $(LOCAL_GHC_PKG01) init $(PKGCONF01)
+ $(LOCAL_GHC_PKG01) list
+ $(LOCAL_GHC_PKG01) register --force test.pkg 2>/dev/null
+ $(LOCAL_GHC_PKG01) describe testpkg | $(STRIP_PKGROOT)
+ $(LOCAL_GHC_PKG01) describe testpkg-1.2.3.4 | $(STRIP_PKGROOT)
+ $(LOCAL_GHC_PKG01) field testpkg-1.2.3.4 import-dirs
+
+ @: # test2.pkg is a later version of testpkg-1.2.3.4
+ $(LOCAL_GHC_PKG01) register --force test2.pkg 2>/dev/null
+ $(LOCAL_GHC_PKG01) list
+ $(LOCAL_GHC_PKG01) describe testpkg-2.0 | $(STRIP_PKGROOT)
+ $(LOCAL_GHC_PKG01) describe testpkg-* | $(STRIP_PKGROOT)
+ $(LOCAL_GHC_PKG01) field testpkg-* version
+
+ @: # test hiding/exposing
+ $(LOCAL_GHC_PKG01) hide testpkg-1.2.3.4
+ $(LOCAL_GHC_PKG01) field testpkg-1.2.3.4 exposed | grep False
+ $(LOCAL_GHC_PKG01) expose testpkg-2.0
+ $(LOCAL_GHC_PKG01) field testpkg-2.0 exposed | grep True
+ $(LOCAL_GHC_PKG01) hide testpkg-*
+ $(LOCAL_GHC_PKG01) field testpkg-* exposed
+
+ @: # test3.pkg depends on testpkg-2.0
+ $(LOCAL_GHC_PKG01) register test3.pkg
+
+ @: # unregistering testpkg-2.0 should fail now, testpkg-3.0 depends on it
+ if $(LOCAL_GHC_PKG01) unregister testpkg-2.0; then false; else true; fi
+
+ $(LOCAL_GHC_PKG01) unregister testpkg-3.0
+
+ $(LOCAL_GHC_PKG01) unregister testpkg-2.0
+ $(LOCAL_GHC_PKG01) describe testpkg | $(STRIP_PKGROOT)
+ $(LOCAL_GHC_PKG01) unregister testpkg-*
+ $(LOCAL_GHC_PKG01) list
+
+ @: # registering test3.pkg should fail now, its dependency has gone
+ if $(LOCAL_GHC_PKG01) register test3.pkg; then false; else true; fi
+
+PKGCONF03=local03.package.conf
+LOCAL_GHC_PKG03 = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONF03)
+
+ghcpkg03 :
+ @rm -rf $(PKGCONF03)
+ $(LOCAL_GHC_PKG03) init $(PKGCONF03)
+ @: # update should hide conflicting packages
+ $(LOCAL_GHC_PKG03) register --force test.pkg
+ $(LOCAL_GHC_PKG03) register --force test2.pkg
+
+ @: # test4.pkg depends on testpkg-2.0, which conflicts with testpkg-1.2.3.4,
+ @: # ghc-pkg will happily register it now (it didn't in GHC 6.4)
+ $(LOCAL_GHC_PKG03) register test4.pkg
+ $(LOCAL_GHC_PKG03) update test4.pkg
+
+ @: # and another update of test.pkg will now hide dep-2.0
+ $(LOCAL_GHC_PKG03) update --force test.pkg
+
+PKGCONF04=local04.package.conf
+LOCAL_GHC_PKG04 = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONF04)
+
+# Test that importing a module exposed by two packages reports a conflict
+ghcpkg04 :
+ rm -rf $(PKGCONF04)
+ $(LOCAL_GHC_PKG04) init $(PKGCONF04)
+ $(LOCAL_GHC_PKG04) register --force test.pkg >/dev/null 2>&1
+ $(LOCAL_GHC_PKG04) update --force test5.pkg >/dev/null 2>&1
+ $(LOCAL_GHC_PKG04) expose testpkg-1.2.3.4 >/dev/null 2>&1
+ @: # testpkg-1.2.3.4 and newtestpkg-2.0 are both exposed now
+ '$(TEST_HC)' $(TEST_HC_OPTS) -package-conf $(PKGCONF04) -c ghcpkg04.hs || true
+
+# Test stacking of package.confs (also #2441)
+PKGCONF05a=local05a.package.conf
+PKGCONF05b=local05b.package.conf
+LOCAL_GHC_PKG05a = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONF05a)
+LOCAL_GHC_PKG05b = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONF05a) -f $(PKGCONF05b)
+
+ghcpkg05 :
+ rm -rf $(PKGCONF05a) $(PKGCONF05b)
+ $(LOCAL_GHC_PKG05a) init $(PKGCONF05a)
+ $(LOCAL_GHC_PKG05b) init $(PKGCONF05b)
+ $(LOCAL_GHC_PKG05a) register --force test2.pkg >/dev/null 2>&1
+ $(LOCAL_GHC_PKG05b) register --force test3.pkg >/dev/null 2>&1
+ $(LOCAL_GHC_PKG05b) check || true
+ $(LOCAL_GHC_PKG05b) list
+ $(LOCAL_GHC_PKG05b) expose testpkg-2.0
+ $(LOCAL_GHC_PKG05b) hide testpkg-2.0
+ if $(LOCAL_GHC_PKG05b) unregister testpkg-2.0; then false; else true; fi
+ $(LOCAL_GHC_PKG05b) unregister testpkg-3.0
+ $(LOCAL_GHC_PKG05b) unregister testpkg-2.0
+
+# Test for #2330: reject duplicate dependencies
+PKGCONF06=local06.package.conf
+LOCAL_GHC_PKG06 = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONF06)
+
+ghcpkg06 :
+ rm -rf $(PKGCONF06)
+ $(LOCAL_GHC_PKG06) init $(PKGCONF06)
+ $(LOCAL_GHC_PKG06) register --force test.pkg >/dev/null 2>&1
+ if $(LOCAL_GHC_PKG06) register testdup.pkg; then false else true; fi
+ $(LOCAL_GHC_PKG06) register --force testdup.pkg
+
+PKGCONF1750=local1750.package.conf
+LOCAL_GHC_PKG1750 = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONF1750)
+
+1750:
+ rm -rf $(PKGCONF1750) 1750.hs 1750.o 1750.hi 1750.out
+ $(LOCAL_GHC_PKG1750) init $(PKGCONF1750)
+ $(LOCAL_GHC_PKG1750) register --force 1750A.pkg >1750.out 2>&1
+ $(LOCAL_GHC_PKG1750) register --force 1750B.pkg >1750.out 2>&1
+ GHC_PACKAGE_PATH=$(PKGCONF1750) '$(GHC_PKG)' --no-user-package-conf list
+# GHC_PACKAGE_PATH trick is to make this work with 6.8.2 which doesn't have
+# the patch "Change the command-line semantics for query commands" to
+# ghc-pkg
+ echo "main = return ()" >1750.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -package-conf $(PKGCONF1750) -package 1750A 1750.hs || true
+
+PKGCONFSHADOW1=localshadow1.package.conf
+PKGCONFSHADOW2=localshadow2.package.conf
+LOCAL_GHC_PKGSHADOW1 = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONFSHADOW1)
+LOCAL_GHC_PKGSHADOW2 = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONFSHADOW2)
+LOCAL_GHC_PKGSHADOW3 = '$(GHC_PKG)' --no-user-package-conf -f $(PKGCONFSHADOW1) -f $(PKGCONFSHADOW2)
+
+# Test package shadowing behaviour.
+#
+# localshadow1.package.conf: shadowdep-1-XXX <- shadow-1-XXX
+# localshadow2.package.conf: shadow-1-YYY
+#
+# shadow-1-XXX will be shadowed by shadow-1-YYY, thus invalidating
+# shadowdep-1-XXX.
+shadow:
+ rm -rf $(PKGCONFSHADOW1) $(PKGCONFSHADOW2) shadow.hs shadow.o shadow.hi shadow.out shadow.hs shadow.hi
+ $(LOCAL_GHC_PKGSHADOW1) init $(PKGCONFSHADOW1)
+ $(LOCAL_GHC_PKGSHADOW2) init $(PKGCONFSHADOW2)
+ $(LOCAL_GHC_PKGSHADOW1) register --force shadow1.pkg >shadow1.out 2>&1
+ $(LOCAL_GHC_PKGSHADOW1) register --force shadow2.pkg >shadow2.out 2>&1
+ $(LOCAL_GHC_PKGSHADOW2) register --force shadow3.pkg >shadow3.out 2>&1
+ $(LOCAL_GHC_PKGSHADOW3) list
+ echo "main = return ()" >shadow.hs
+#
+# In this test, shadow-1-XXX is shadowed by shadow-1-YYY, which causes
+# shadowdep-1-XXX to be unavailable:
+#
+ @echo "should FAIL:"
+ '$(TEST_HC)' $(TEST_HC_OPTS) -package-conf $(PKGCONFSHADOW1) -package-conf $(PKGCONFSHADOW2) -package shadowdep -c shadow.hs -fno-code || true
+#
+# Reversing the order of the package.conf files should fix the problem:
+#
+ @echo "should SUCCEED:"
+ '$(TEST_HC)' $(TEST_HC_OPTS) -package-conf $(PKGCONFSHADOW2) -package-conf $(PKGCONFSHADOW1) -package shadowdep -c shadow.hs -fno-code || true
+#
+# We can also fix the problem by using an explicit -package-id flag to
+# specify a package we really want to use:
+#
+ @echo "should SUCCEED:"
+ '$(TEST_HC)' $(TEST_HC_OPTS) -package-conf $(PKGCONFSHADOW1) -package-conf $(PKGCONFSHADOW2) -package-id shadowdep-1-XXX -c shadow.hs -fno-code
+
+
+# -----------------------------------------------------------------------------
+# Try piping the output of "ghc-pkg describe" into "ghc-pkg update" for
+# every package we know about. This is for testing the pretty printing/parsing
+# of InstalledPackageInfo.
+
+PACKAGE_CONF_ghcpkg02 = package.conf.ghcpkg02
+GHC_PKG_ghcpkg02 = '$(GHC_PKG)' --no-user-package-conf --global-conf=$(PACKAGE_CONF_ghcpkg02)
+
+ghcpkg02:
+ rm -rf $(PACKAGE_CONF_ghcpkg02)
+ $(GHC_PKG_ghcpkg02) init $(PACKAGE_CONF_ghcpkg02)
+ set -e; \
+ for i in `$(GHC_PKG) list --global --simple-output -v0`; do \
+ echo Updating $$i; \
+ $(GHC_PKG) describe --global $$i | $(GHC_PKG_ghcpkg02) update --global --force -; \
+ done
diff --git a/testsuite/tests/cabal/all.T b/testsuite/tests/cabal/all.T
new file mode 100644
index 0000000000..2ec0fa8ff7
--- /dev/null
+++ b/testsuite/tests/cabal/all.T
@@ -0,0 +1,61 @@
+setTestOpts(only_compiler_types(['ghc']))
+
+test('ghcpkg01',
+ extra_clean(['local01.package.conf',
+ 'local01.package.conf.old']),
+ run_command,
+ ['$MAKE -s --no-print-directory ghcpkg01'])
+test('ghcpkg02',
+ [ignore_output,
+ extra_clean(['package.conf.ghcpkg02', 'package.conf.ghcpkg02.old'])],
+ run_command,
+ ['$MAKE -s --no-print-directory ghcpkg02'])
+test('ghcpkg03',
+ extra_clean(['local03.package.conf',
+ 'local03.package.conf.old']),
+ run_command,
+ ['$MAKE -s --no-print-directory ghcpkg03'])
+test('ghcpkg04',
+ [ignore_output,
+ extra_clean(['local04.package.conf',
+ 'local04.package.conf.old'])],
+ run_command,
+ ['$MAKE -s --no-print-directory ghcpkg04'])
+
+# Sometimes we get spurious warnings from ghc-pkg about missing
+# haddock-interfaces; this filters them out.
+def normalise_haddock_junk( str ):
+ return re.sub(r'Warning: haddock.*\n', '', str)
+
+test('ghcpkg05',
+ [ extra_clean(['local05a.package.conf',
+ 'local05a.package.conf.old',
+ 'local05b.package.conf',
+ 'local05b.package.conf.old']),
+ normalise_fun(normalise_haddock_junk)
+ ],
+ run_command,
+ ['$MAKE -s --no-print-directory ghcpkg05'])
+test('ghcpkg06',
+ [extra_clean(['local06.package.conf',
+ 'local06.package.conf.old'])],
+ run_command,
+ ['$MAKE -s --no-print-directory ghcpkg06'])
+
+# Test that we *can* compile a module that also belongs to a package
+# (this was disallowed in GHC 6.4 and earlier)
+test('pkg01', normal, compile, [''])
+
+test('1750',
+ extra_clean(['1750.hs', '1750.out',
+ 'local1750.package.conf',
+ 'local1750.package.conf.old']),
+ run_command, ['$MAKE -s --no-print-directory 1750'])
+
+test('shadow',
+ extra_clean(['shadow.out', 'shadow.hs', 'shadow.hi',
+ 'local1shadow1.package.conf',
+ 'local1shadow1.package.conf.old',
+ 'local1shadow2.package.conf',
+ 'local1shadow2.package.conf.old']),
+ run_command, ['$MAKE -s --no-print-directory shadow'])
diff --git a/testsuite/tests/cabal/cabal01/A.hs b/testsuite/tests/cabal/cabal01/A.hs
new file mode 100644
index 0000000000..c5227050f9
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/A.hs
@@ -0,0 +1,4 @@
+module A where
+a = 42 :: Int
+
+main2 = print a
diff --git a/testsuite/tests/cabal/cabal01/B/A.hs b/testsuite/tests/cabal/cabal01/B/A.hs
new file mode 100644
index 0000000000..3e1183b315
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/B/A.hs
@@ -0,0 +1,4 @@
+module B.A where
+a = 42 :: Int
+
+main = print a
diff --git a/testsuite/tests/cabal/cabal01/B/MainB.hs b/testsuite/tests/cabal/cabal01/B/MainB.hs
new file mode 100644
index 0000000000..823fb19c43
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/B/MainB.hs
@@ -0,0 +1,5 @@
+module Main where
+
+import A
+
+main = print a
diff --git a/testsuite/tests/cabal/cabal01/MainA.hs b/testsuite/tests/cabal/cabal01/MainA.hs
new file mode 100644
index 0000000000..823fb19c43
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/MainA.hs
@@ -0,0 +1,5 @@
+module Main where
+
+import A
+
+main = print a
diff --git a/testsuite/tests/cabal/cabal01/Makefile b/testsuite/tests/cabal/cabal01/Makefile
new file mode 100644
index 0000000000..5217d89cc1
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/Makefile
@@ -0,0 +1,41 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+clean:
+ rm -rf setup a.out dist/build/testA
+ rm -rf ,tmp dist ,tmp2
+ find . -name "*.o" |xargs rm -f
+ find . -name "*.hi" |xargs rm -f
+ rm -fr install-tmp
+ rm -fr install
+ rm -f .setup-config .installed-pkg-config
+ rm -rf local.db
+
+# We use the global package database as there's no easy way to tell
+# ghc-pkg (via Cabal) to use one in ., and the global one at least
+# won't affect the installed GHC and is more likely to work
+
+PREFIX := $(abspath install)
+$(eval $(call canonicalise,PREFIX))
+
+cabal01:
+ $(MAKE) clean
+ '$(TEST_HC)' --make -o setup Setup.lhs -v0
+
+ '$(GHC_PKG)' init local.db
+ ./setup configure -v0 --prefix=$(PREFIX) --with-compiler='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --with-hc-pkg='$(GHC_PKG)' --package-db=local.db $(PROF)
+ ./setup build -v0
+ ./setup copy -v0
+ echo install1:
+ ls -1 install
+ rm -r install
+# install w/ register!
+ ./setup install -v0
+ echo install2:
+ ls -1 install
+ ./setup sdist -v0
+ echo dist:
+ ls -1 dist
+ if [ "$(CLEANUP)" != "" ]; then $(MAKE) clean; fi
+
diff --git a/testsuite/tests/cabal/cabal01/Setup.lhs b/testsuite/tests/cabal/cabal01/Setup.lhs
new file mode 100644
index 0000000000..b2dccbe310
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/Setup.lhs
@@ -0,0 +1,2 @@
+> import Distribution.Simple
+> main = defaultMain
diff --git a/testsuite/tests/cabal/cabal01/all.T b/testsuite/tests/cabal/cabal01/all.T
new file mode 100644
index 0000000000..299b0b8a06
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/all.T
@@ -0,0 +1,16 @@
+setTestOpts(only_compiler_types(['ghc']))
+
+if config.have_profiling:
+ prof = '--enable-library-profiling'
+else:
+ prof = ''
+
+if default_testopts.cleanup != '':
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = ''
+
+test('cabal01',
+ normal,
+ run_command,
+ ['$MAKE -s --no-print-directory cabal01 PROF=' + prof + ' ' + cleanup])
diff --git a/testsuite/tests/cabal/cabal01/c_src/hello.c b/testsuite/tests/cabal/cabal01/c_src/hello.c
new file mode 100644
index 0000000000..2ae1c276eb
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/c_src/hello.c
@@ -0,0 +1 @@
+int foo () {return 9;}
diff --git a/testsuite/tests/cabal/cabal01/cabal01.stdout b/testsuite/tests/cabal/cabal01/cabal01.stdout
new file mode 100644
index 0000000000..e828cbe68a
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/cabal01.stdout
@@ -0,0 +1,12 @@
+install1:
+bin
+lib
+install2:
+bin
+lib
+dist:
+build
+package.conf.inplace
+setup-config
+src
+test-1.0.tar.gz
diff --git a/testsuite/tests/cabal/cabal01/cabal01.stdout-i386-unknown-mingw32 b/testsuite/tests/cabal/cabal01/cabal01.stdout-i386-unknown-mingw32
new file mode 100644
index 0000000000..647a2324b0
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/cabal01.stdout-i386-unknown-mingw32
@@ -0,0 +1,12 @@
+install1:
+bin
+test-1.0
+install2:
+bin
+test-1.0
+dist:
+build
+package.conf.inplace
+setup-config
+src
+test-1.0.tar.gz
diff --git a/testsuite/tests/cabal/cabal01/hello.c b/testsuite/tests/cabal/cabal01/hello.c
new file mode 100644
index 0000000000..de051f6f6b
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/hello.c
@@ -0,0 +1 @@
+int main () {return 9;}
diff --git a/testsuite/tests/cabal/cabal01/test.cabal b/testsuite/tests/cabal/cabal01/test.cabal
new file mode 100644
index 0000000000..f49d8742da
--- /dev/null
+++ b/testsuite/tests/cabal/cabal01/test.cabal
@@ -0,0 +1,16 @@
+Name: test
+Version: 1.0
+Exposed-Modules: A
+Other-Modules: B.A
+C-Sources: hello.c, c_src/hello.c
+Extensions: ForeignFunctionInterface
+Build-depends: base>=1.0
+
+Executable: testA
+Other-Modules: A, MainA
+Main-is: MainA.hs
+Extensions: OverlappingInstances
+
+Executable: testB
+Other-Modules: B.A, B.MainB
+Main-is: B/MainB.hs
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'])
diff --git a/testsuite/tests/cabal/cabal03/Makefile b/testsuite/tests/cabal/cabal03/Makefile
new file mode 100644
index 0000000000..f87212f349
--- /dev/null
+++ b/testsuite/tests/cabal/cabal03/Makefile
@@ -0,0 +1,41 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# SETUP=../Setup
+SETUP=../Setup -v0
+
+# This test is for overlapping/shadowing packages with Cabal. We
+# 1. install p-1.0 to the global DB
+# 2. install q-1.0 (depending on p-1.0) to a temporary DB
+# 3. install a differnet p-1.0 to the temp DB
+# 4. attempt to configure and buidl r, which depends on p-1.0 and q-1.0
+#
+# step 4 will elicit a warning from Cabal's configure step that the
+# packages are inconsistent, and will cause an error from GHC.
+# Currently the error message from GHC is swallowed by Cabal.
+
+cabal03: clean
+ $(MAKE) clean
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' -v0 --make Setup
+ cd p && $(SETUP) clean
+ cd p && $(SETUP) configure --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --disable-optimisation --ghc-pkg-option=--force
+ cd p && $(SETUP) build
+ cd p && $(SETUP) register
+ cd q && $(SETUP) configure --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --ghc-pkg-option=--force
+ cd q && $(SETUP) build
+ cd q && $(SETUP) register
+ cd p && $(SETUP) clean
+ cd p && $(SETUP) configure --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --ghc-pkg-option=--force
+ cd p && $(SETUP) build
+ cd p && $(SETUP) register
+ cd r && ! ../Setup configure --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --ghc-pkg-option=--force
+ifneq "$(CLEANUP)" ""
+ $(MAKE) clean
+endif
+
+clean :
+ '$(GHC_PKG)' unregister --force p >/dev/null 2>&1 || true
+ '$(GHC_PKG)' unregister --force q >/dev/null 2>&1 || true
+ $(RM) -r tmp.d *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext)
diff --git a/testsuite/tests/cabal/cabal03/Setup.lhs b/testsuite/tests/cabal/cabal03/Setup.lhs
new file mode 100644
index 0000000000..b2dccbe310
--- /dev/null
+++ b/testsuite/tests/cabal/cabal03/Setup.lhs
@@ -0,0 +1,2 @@
+> import Distribution.Simple
+> main = defaultMain
diff --git a/testsuite/tests/cabal/cabal03/all.T b/testsuite/tests/cabal/cabal03/all.T
new file mode 100644
index 0000000000..01d3882a84
--- /dev/null
+++ b/testsuite/tests/cabal/cabal03/all.T
@@ -0,0 +1,9 @@
+if default_testopts.cleanup != '':
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = ''
+
+test('cabal03',
+ ignore_output,
+ run_command,
+ ['$MAKE -s --no-print-directory cabal03 ' + cleanup])
diff --git a/testsuite/tests/cabal/cabal03/p/P.hs b/testsuite/tests/cabal/cabal03/p/P.hs
new file mode 100644
index 0000000000..801fa390bd
--- /dev/null
+++ b/testsuite/tests/cabal/cabal03/p/P.hs
@@ -0,0 +1,3 @@
+module P (p) where
+p = ()
+
diff --git a/testsuite/tests/cabal/cabal03/p/p.cabal b/testsuite/tests/cabal/cabal03/p/p.cabal
new file mode 100644
index 0000000000..5ef93a0b92
--- /dev/null
+++ b/testsuite/tests/cabal/cabal03/p/p.cabal
@@ -0,0 +1,5 @@
+name: p
+version: 1.0
+exposed-modules: P
+build-depends: base
+build-type: Simple
diff --git a/testsuite/tests/cabal/cabal03/q/q.cabal b/testsuite/tests/cabal/cabal03/q/q.cabal
new file mode 100644
index 0000000000..691e60b623
--- /dev/null
+++ b/testsuite/tests/cabal/cabal03/q/q.cabal
@@ -0,0 +1,5 @@
+name: q
+version: 1.0
+build-depends: p
+exposed-modules:
+build-type: Simple
diff --git a/testsuite/tests/cabal/cabal03/r/r.cabal b/testsuite/tests/cabal/cabal03/r/r.cabal
new file mode 100644
index 0000000000..b874bb4e15
--- /dev/null
+++ b/testsuite/tests/cabal/cabal03/r/r.cabal
@@ -0,0 +1,5 @@
+name: r
+version: 1.0
+build-depends: p, q
+exposed-modules:
+build-type: Simple
diff --git a/testsuite/tests/cabal/cabal04/Library.hs b/testsuite/tests/cabal/cabal04/Library.hs
new file mode 100644
index 0000000000..e21ed20bdf
--- /dev/null
+++ b/testsuite/tests/cabal/cabal04/Library.hs
@@ -0,0 +1,6 @@
+ {-# LANGUAGE TemplateHaskell #-}
+ module Library where
+
+import TH
+
+main = print ($(spliceMe) [1, 2])
diff --git a/testsuite/tests/cabal/cabal04/Makefile b/testsuite/tests/cabal/cabal04/Makefile
new file mode 100644
index 0000000000..dbdf30745f
--- /dev/null
+++ b/testsuite/tests/cabal/cabal04/Makefile
@@ -0,0 +1,23 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP=./Setup -v0
+
+# This tests that we can build a Cabal package that uses TH with both
+# profiling and dynamic linking. (#3604)
+
+cabal04:
+ $(MAKE) clean
+ '$(TEST_HC)' -v0 --make Setup
+ $(SETUP) clean
+ $(SETUP) configure --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' $(PROF) $(DYN)
+ $(SETUP) build 2> err
+ ! grep -v "Creating library file" err
+ifneq "$(CLEANUP)" ""
+ $(MAKE) clean
+endif
+
+clean :
+ $(RM) -r *.o *.hi dist Setup$(exeext) err
+
diff --git a/testsuite/tests/cabal/cabal04/Setup.lhs b/testsuite/tests/cabal/cabal04/Setup.lhs
new file mode 100644
index 0000000000..b2dccbe310
--- /dev/null
+++ b/testsuite/tests/cabal/cabal04/Setup.lhs
@@ -0,0 +1,2 @@
+> import Distribution.Simple
+> main = defaultMain
diff --git a/testsuite/tests/cabal/cabal04/TH.hs b/testsuite/tests/cabal/cabal04/TH.hs
new file mode 100644
index 0000000000..8719c7d550
--- /dev/null
+++ b/testsuite/tests/cabal/cabal04/TH.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module TH where
+
+import Language.Haskell.TH
+
+spliceMe = [| (\xs -> tail xs ++ init xs) |]
diff --git a/testsuite/tests/cabal/cabal04/all.T b/testsuite/tests/cabal/cabal04/all.T
new file mode 100644
index 0000000000..81c11f12b5
--- /dev/null
+++ b/testsuite/tests/cabal/cabal04/all.T
@@ -0,0 +1,21 @@
+setTestOpts(only_compiler_types(['ghc']))
+
+if config.have_profiling:
+ prof = '--enable-library-profiling'
+else:
+ prof = ''
+
+if config.have_shared_libs:
+ dyn = '--enable-shared'
+else:
+ dyn = ''
+
+if default_testopts.cleanup != '':
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = ''
+
+test('cabal04',
+ normal,
+ run_command,
+ ['$MAKE -s --no-print-directory cabal04 PROF=' + prof + ' DYN=' + dyn + ' ' + cleanup])
diff --git a/testsuite/tests/cabal/cabal04/thtest.cabal b/testsuite/tests/cabal/cabal04/thtest.cabal
new file mode 100644
index 0000000000..73d63ca236
--- /dev/null
+++ b/testsuite/tests/cabal/cabal04/thtest.cabal
@@ -0,0 +1,11 @@
+name: thtest
+version: 1.0
+cabal-version: >= 1.2
+build-type: Simple
+
+library {
+ build-depends: base, template-haskell
+ extensions: TemplateHaskell
+ exposed-modules: Library
+ other-modules: TH
+}
diff --git a/testsuite/tests/cabal/ghcpkg01.stderr b/testsuite/tests/cabal/ghcpkg01.stderr
new file mode 100644
index 0000000000..585c7aaa83
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg01.stderr
@@ -0,0 +1,2 @@
+ghc-pkg: unregistering testpkg-2.0 would break the following packages: testpkg-3.0 (use --force to override)
+testpkg-3.0: dependency "testpkg-2.0-XXX" doesn't exist (use --force to override)
diff --git a/testsuite/tests/cabal/ghcpkg01.stdout b/testsuite/tests/cabal/ghcpkg01.stdout
new file mode 100644
index 0000000000..fb3ecdf6e8
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg01.stdout
@@ -0,0 +1,223 @@
+local01.package.conf:
+
+Reading package info from "test.pkg" ... done.
+name: testpkg
+version: 1.2.3.4
+id: testpkg-1.2.3.4-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: stable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+synopsis:
+description: A Test Package
+category: none
+author: simonmar@microsoft.com
+exposed: True
+exposed-modules: A
+hidden-modules: B C.D
+trusted: False
+import-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+hs-libraries: testpkg-1.2.3.4
+extra-libraries:
+extra-ghci-libraries:
+include-dirs: /usr/local/include/testpkg "c:/Program Files/testpkg"
+includes:
+depends:
+hugs-options:
+cc-options:
+ld-options:
+framework-dirs:
+frameworks:
+haddock-interfaces:
+haddock-html:
+pkgroot:
+
+name: testpkg
+version: 1.2.3.4
+id: testpkg-1.2.3.4-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: stable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+synopsis:
+description: A Test Package
+category: none
+author: simonmar@microsoft.com
+exposed: True
+exposed-modules: A
+hidden-modules: B C.D
+trusted: False
+import-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+hs-libraries: testpkg-1.2.3.4
+extra-libraries:
+extra-ghci-libraries:
+include-dirs: /usr/local/include/testpkg "c:/Program Files/testpkg"
+includes:
+depends:
+hugs-options:
+cc-options:
+ld-options:
+framework-dirs:
+frameworks:
+haddock-interfaces:
+haddock-html:
+pkgroot:
+
+import-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+Reading package info from "test2.pkg" ... done.
+local01.package.conf:
+ testpkg-1.2.3.4
+ (testpkg-2.0)
+
+name: testpkg
+version: 2.0
+id: testpkg-2.0-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: unstable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+synopsis:
+description: A Test Package (new version)
+category: none
+author: simonmar@microsoft.com
+exposed: False
+exposed-modules: A
+hidden-modules: B C.D C.E
+trusted: False
+import-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+hs-libraries: testpkg-2.0
+extra-libraries:
+extra-ghci-libraries:
+include-dirs: /usr/local/include/testpkg "c:/Program Files/testpkg"
+includes:
+depends:
+hugs-options:
+cc-options:
+ld-options:
+framework-dirs:
+frameworks:
+haddock-interfaces:
+haddock-html:
+pkgroot:
+
+name: testpkg
+version: 2.0
+id: testpkg-2.0-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: unstable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+synopsis:
+description: A Test Package (new version)
+category: none
+author: simonmar@microsoft.com
+exposed: False
+exposed-modules: A
+hidden-modules: B C.D C.E
+trusted: False
+import-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+hs-libraries: testpkg-2.0
+extra-libraries:
+extra-ghci-libraries:
+include-dirs: /usr/local/include/testpkg "c:/Program Files/testpkg"
+includes:
+depends:
+hugs-options:
+cc-options:
+ld-options:
+framework-dirs:
+frameworks:
+haddock-interfaces:
+haddock-html:
+pkgroot:
+---
+name: testpkg
+version: 1.2.3.4
+id: testpkg-1.2.3.4-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: stable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+synopsis:
+description: A Test Package
+category: none
+author: simonmar@microsoft.com
+exposed: True
+exposed-modules: A
+hidden-modules: B C.D
+trusted: False
+import-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+hs-libraries: testpkg-1.2.3.4
+extra-libraries:
+extra-ghci-libraries:
+include-dirs: /usr/local/include/testpkg "c:/Program Files/testpkg"
+includes:
+depends:
+hugs-options:
+cc-options:
+ld-options:
+framework-dirs:
+frameworks:
+haddock-interfaces:
+haddock-html:
+pkgroot:
+
+version: 2.0
+version: 1.2.3.4
+exposed: False
+exposed: True
+exposed: False
+exposed: False
+Reading package info from "test3.pkg" ... done.
+name: testpkg
+version: 1.2.3.4
+id: testpkg-1.2.3.4-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: stable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+synopsis:
+description: A Test Package
+category: none
+author: simonmar@microsoft.com
+exposed: False
+exposed-modules: A
+hidden-modules: B C.D
+trusted: False
+import-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg "c:/Program Files/testpkg"
+hs-libraries: testpkg-1.2.3.4
+extra-libraries:
+extra-ghci-libraries:
+include-dirs: /usr/local/include/testpkg "c:/Program Files/testpkg"
+includes:
+depends:
+hugs-options:
+cc-options:
+ld-options:
+framework-dirs:
+frameworks:
+haddock-interfaces:
+haddock-html:
+pkgroot:
+
+local01.package.conf:
+
+Reading package info from "test3.pkg" ... done.
diff --git a/testsuite/tests/cabal/ghcpkg03.stderr b/testsuite/tests/cabal/ghcpkg03.stderr
new file mode 100644
index 0000000000..f30d7fd1e8
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg03.stderr
@@ -0,0 +1,31 @@
+testpkg-1.2.3.4: Warning: library-dirs: /usr/local/lib/testpkg doesn't exist or isn't a directory
+testpkg-1.2.3.4: Warning: include-dirs: /usr/local/include/testpkg doesn't exist or isn't a directory
+testpkg-1.2.3.4: import-dirs: /usr/local/lib/testpkg doesn't exist or isn't a directory (ignoring)
+testpkg-1.2.3.4: import-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: library-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: include-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: file A.hi is missing (ignoring)
+testpkg-1.2.3.4: file B.hi is missing (ignoring)
+testpkg-1.2.3.4: file C/D.hi is missing (ignoring)
+testpkg-1.2.3.4: cannot find libtestpkg-1.2.3.4.a on library path (ignoring)
+testpkg-2.0: Warning: library-dirs: /usr/local/lib/testpkg doesn't exist or isn't a directory
+testpkg-2.0: Warning: include-dirs: /usr/local/include/testpkg doesn't exist or isn't a directory
+testpkg-2.0: import-dirs: /usr/local/lib/testpkg doesn't exist or isn't a directory (ignoring)
+testpkg-2.0: import-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-2.0: library-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-2.0: include-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-2.0: file A.hi is missing (ignoring)
+testpkg-2.0: file B.hi is missing (ignoring)
+testpkg-2.0: file C/D.hi is missing (ignoring)
+testpkg-2.0: file C/E.hi is missing (ignoring)
+testpkg-2.0: cannot find libtestpkg-2.0.a on library path (ignoring)
+testpkg-1.2.3.4: Warning: library-dirs: /usr/local/lib/testpkg doesn't exist or isn't a directory
+testpkg-1.2.3.4: Warning: include-dirs: /usr/local/include/testpkg doesn't exist or isn't a directory
+testpkg-1.2.3.4: import-dirs: /usr/local/lib/testpkg doesn't exist or isn't a directory (ignoring)
+testpkg-1.2.3.4: import-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: library-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: include-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: file A.hi is missing (ignoring)
+testpkg-1.2.3.4: file B.hi is missing (ignoring)
+testpkg-1.2.3.4: file C/D.hi is missing (ignoring)
+testpkg-1.2.3.4: cannot find libtestpkg-1.2.3.4.a on library path (ignoring)
diff --git a/testsuite/tests/cabal/ghcpkg03.stderr-i386-unknown-mingw32 b/testsuite/tests/cabal/ghcpkg03.stderr-i386-unknown-mingw32
new file mode 100644
index 0000000000..71ff88a16b
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg03.stderr-i386-unknown-mingw32
@@ -0,0 +1,31 @@
+testpkg-1.2.3.4: Warning: library-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+testpkg-1.2.3.4: Warning: include-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+testpkg-1.2.3.4: import-dirs: /usr/local/lib/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: import-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory (ignoring)
+testpkg-1.2.3.4: library-dirs: /usr/local/lib/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: include-dirs: /usr/local/include/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: file A.hi is missing (ignoring)
+testpkg-1.2.3.4: file B.hi is missing (ignoring)
+testpkg-1.2.3.4: file C\D.hi is missing (ignoring)
+testpkg-1.2.3.4: cannot find libtestpkg-1.2.3.4.a on library path (ignoring)
+testpkg-2.0: Warning: library-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+testpkg-2.0: Warning: include-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+testpkg-2.0: import-dirs: /usr/local/lib/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-2.0: import-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory (ignoring)
+testpkg-2.0: library-dirs: /usr/local/lib/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-2.0: include-dirs: /usr/local/include/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-2.0: file A.hi is missing (ignoring)
+testpkg-2.0: file B.hi is missing (ignoring)
+testpkg-2.0: file C\D.hi is missing (ignoring)
+testpkg-2.0: file C\E.hi is missing (ignoring)
+testpkg-2.0: cannot find libtestpkg-2.0.a on library path (ignoring)
+testpkg-1.2.3.4: Warning: library-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+testpkg-1.2.3.4: Warning: include-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+testpkg-1.2.3.4: import-dirs: /usr/local/lib/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: import-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory (ignoring)
+testpkg-1.2.3.4: library-dirs: /usr/local/lib/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: include-dirs: /usr/local/include/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (ignoring)
+testpkg-1.2.3.4: file A.hi is missing (ignoring)
+testpkg-1.2.3.4: file B.hi is missing (ignoring)
+testpkg-1.2.3.4: file C\D.hi is missing (ignoring)
+testpkg-1.2.3.4: cannot find libtestpkg-1.2.3.4.a on library path (ignoring)
diff --git a/testsuite/tests/cabal/ghcpkg03.stdout b/testsuite/tests/cabal/ghcpkg03.stdout
new file mode 100644
index 0000000000..9f148b82e4
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg03.stdout
@@ -0,0 +1,5 @@
+Reading package info from "test.pkg" ... done.
+Reading package info from "test2.pkg" ... done.
+Reading package info from "test4.pkg" ... done.
+Reading package info from "test4.pkg" ... done.
+Reading package info from "test.pkg" ... done.
diff --git a/testsuite/tests/cabal/ghcpkg04.hs b/testsuite/tests/cabal/ghcpkg04.hs
new file mode 100644
index 0000000000..9da260a695
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg04.hs
@@ -0,0 +1 @@
+import A
diff --git a/testsuite/tests/cabal/ghcpkg04.stderr b/testsuite/tests/cabal/ghcpkg04.stderr
new file mode 100644
index 0000000000..29a912b991
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg04.stderr
@@ -0,0 +1,4 @@
+
+ghcpkg04.hs:1:0:
+ Failed to load interface for `A':
+ it was found in multiple packages: testpkg-1.2.3.4 newtestpkg-2.0
diff --git a/testsuite/tests/cabal/ghcpkg05.stderr b/testsuite/tests/cabal/ghcpkg05.stderr
new file mode 100644
index 0000000000..5d30ba0381
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg05.stderr
@@ -0,0 +1,18 @@
+There are problems in package testpkg-2.0:
+ Warning: library-dirs: /usr/local/lib/testpkg doesn't exist or isn't a directory
+ Warning: include-dirs: /usr/local/include/testpkg doesn't exist or isn't a directory
+ import-dirs: /usr/local/lib/testpkg doesn't exist or isn't a directory
+ import-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}.
+ library-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}.
+ include-dirs: c:/Program Files/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}.
+ file A.hi is missing
+ file B.hi is missing
+ file C/D.hi is missing
+ file C/E.hi is missing
+ cannot find libtestpkg-2.0.a on library path
+
+The following packages are broken, either because they have a problem
+listed above, or because they depend on a broken package.
+testpkg-2.0
+testpkg-3.0
+ghc-pkg: unregistering testpkg-2.0 would break the following packages: testpkg-3.0 (use --force to override)
diff --git a/testsuite/tests/cabal/ghcpkg05.stderr-i386-unknown-mingw32 b/testsuite/tests/cabal/ghcpkg05.stderr-i386-unknown-mingw32
new file mode 100644
index 0000000000..360783bd78
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg05.stderr-i386-unknown-mingw32
@@ -0,0 +1,18 @@
+There are problems in package testpkg-2.0:
+ Warning: library-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+ Warning: include-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+ import-dirs: /usr/local/lib/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}.
+ import-dirs: c:/Program Files/testpkg doesn't exist or isn't a directory
+ library-dirs: /usr/local/lib/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}.
+ include-dirs: /usr/local/include/testpkg is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}.
+ file A.hi is missing
+ file B.hi is missing
+ file C\D.hi is missing
+ file C\E.hi is missing
+ cannot find libtestpkg-2.0.a on library path
+
+The following packages are broken, either because they have a problem
+listed above, or because they depend on a broken package.
+testpkg-2.0
+testpkg-3.0
+ghc-pkg.exe: unregistering testpkg-2.0 would break the following packages: testpkg-3.0 (use --force to override)
diff --git a/testsuite/tests/cabal/ghcpkg05.stdout b/testsuite/tests/cabal/ghcpkg05.stdout
new file mode 100644
index 0000000000..f89d332351
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg05.stdout
@@ -0,0 +1,6 @@
+local05a.package.conf:
+ (testpkg-2.0)
+
+local05b.package.conf:
+ (testpkg-3.0)
+
diff --git a/testsuite/tests/cabal/ghcpkg06.stderr b/testsuite/tests/cabal/ghcpkg06.stderr
new file mode 100644
index 0000000000..d33eef7b8e
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg06.stderr
@@ -0,0 +1,2 @@
+testdup-1.0: package has duplicate dependencies: testpkg-1.2.3.4-XXX (use --force to override)
+testdup-1.0: package has duplicate dependencies: testpkg-1.2.3.4-XXX (ignoring)
diff --git a/testsuite/tests/cabal/ghcpkg06.stdout b/testsuite/tests/cabal/ghcpkg06.stdout
new file mode 100644
index 0000000000..3bc1858b6a
--- /dev/null
+++ b/testsuite/tests/cabal/ghcpkg06.stdout
@@ -0,0 +1,2 @@
+Reading package info from "testdup.pkg" ... done.
+Reading package info from "testdup.pkg" ... done.
diff --git a/testsuite/tests/cabal/pkg01.hs b/testsuite/tests/cabal/pkg01.hs
new file mode 100644
index 0000000000..b06b8e0276
--- /dev/null
+++ b/testsuite/tests/cabal/pkg01.hs
@@ -0,0 +1,3 @@
+module Data.Map where
+-- conflicts with module from containers package
+import Data.Set
diff --git a/testsuite/tests/cabal/pkg01.stderr b/testsuite/tests/cabal/pkg01.stderr
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/cabal/pkg01.stderr
diff --git a/testsuite/tests/cabal/pkg02/A.hs b/testsuite/tests/cabal/pkg02/A.hs
new file mode 100644
index 0000000000..fa288c35e6
--- /dev/null
+++ b/testsuite/tests/cabal/pkg02/A.hs
@@ -0,0 +1,5 @@
+module A where
+import Foreign -- a local module
+import Foreign.C -- a package module
+
+y = Foreign.x
diff --git a/testsuite/tests/cabal/pkg02/Foreign.hs b/testsuite/tests/cabal/pkg02/Foreign.hs
new file mode 100644
index 0000000000..3970ce1896
--- /dev/null
+++ b/testsuite/tests/cabal/pkg02/Foreign.hs
@@ -0,0 +1,2 @@
+module Foreign (x) where
+x = "test"
diff --git a/testsuite/tests/cabal/pkg02/Makefile b/testsuite/tests/cabal/pkg02/Makefile
new file mode 100644
index 0000000000..4a268530f1
--- /dev/null
+++ b/testsuite/tests/cabal/pkg02/Makefile
@@ -0,0 +1,4 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
diff --git a/testsuite/tests/cabal/pkg02/all.T b/testsuite/tests/cabal/pkg02/all.T
new file mode 100644
index 0000000000..b3dfecc0b5
--- /dev/null
+++ b/testsuite/tests/cabal/pkg02/all.T
@@ -0,0 +1,10 @@
+# This used to be a test for conflicting module names, but the error
+# case that it was testing for went away (conflicting module names in
+# separate packages are allowed). Now it is a straightforward test
+# for shadowing: the local Foreign module shadows the base package
+# one.
+test('pkg02',
+ [extra_clean(['A.o', 'A.hi', 'Foreign.o', 'Foreign.hi'])],
+ multimod_compile,
+ ['A','-v0'])
+
diff --git a/testsuite/tests/cabal/pkg02/pkg02.stderr b/testsuite/tests/cabal/pkg02/pkg02.stderr
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/cabal/pkg02/pkg02.stderr
diff --git a/testsuite/tests/cabal/shadow.stderr b/testsuite/tests/cabal/shadow.stderr
new file mode 100644
index 0000000000..a0a38cde22
--- /dev/null
+++ b/testsuite/tests/cabal/shadow.stderr
@@ -0,0 +1,4 @@
+<command line>: cannot satisfy -package shadowdep:
+ shadowdep-1-XXX is unusable due to missing or recursive dependencies:
+ shadow-1-XXX
+ (use -v for more information)
diff --git a/testsuite/tests/cabal/shadow.stdout b/testsuite/tests/cabal/shadow.stdout
new file mode 100644
index 0000000000..0d14e9cb8a
--- /dev/null
+++ b/testsuite/tests/cabal/shadow.stdout
@@ -0,0 +1,10 @@
+localshadow1.package.conf:
+ (shadow-1)
+ (shadowdep-1)
+
+localshadow2.package.conf:
+ (shadow-1)
+
+should FAIL:
+should SUCCEED:
+should SUCCEED:
diff --git a/testsuite/tests/cabal/shadow1.pkg b/testsuite/tests/cabal/shadow1.pkg
new file mode 100644
index 0000000000..7bf047f3d2
--- /dev/null
+++ b/testsuite/tests/cabal/shadow1.pkg
@@ -0,0 +1,4 @@
+name: shadow
+version: 1
+id: shadow-1-XXX
+depends:
diff --git a/testsuite/tests/cabal/shadow2.pkg b/testsuite/tests/cabal/shadow2.pkg
new file mode 100644
index 0000000000..b720dc9479
--- /dev/null
+++ b/testsuite/tests/cabal/shadow2.pkg
@@ -0,0 +1,4 @@
+name: shadowdep
+version: 1
+id: shadowdep-1-XXX
+depends: shadow-1-XXX
diff --git a/testsuite/tests/cabal/shadow3.pkg b/testsuite/tests/cabal/shadow3.pkg
new file mode 100644
index 0000000000..933ed3f67d
--- /dev/null
+++ b/testsuite/tests/cabal/shadow3.pkg
@@ -0,0 +1,4 @@
+name: shadow
+version: 1
+id: shadow-1-YYY
+depends:
diff --git a/testsuite/tests/cabal/test.pkg b/testsuite/tests/cabal/test.pkg
new file mode 100644
index 0000000000..02a07ab7b6
--- /dev/null
+++ b/testsuite/tests/cabal/test.pkg
@@ -0,0 +1,19 @@
+name: testpkg
+version: 1.2.3.4
+id: testpkg-1.2.3.4-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: stable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+description: A Test Package
+category: none
+author: simonmar@microsoft.com
+exposed: True
+exposed-modules: A
+hidden-modules: B, "C.D"
+import-dirs: /usr/local/lib/testpkg, "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg, "c:/Program Files/testpkg"
+include-dirs: /usr/local/include/testpkg, "c:/Program Files/testpkg"
+hs-libraries: testpkg-1.2.3.4
diff --git a/testsuite/tests/cabal/test2.pkg b/testsuite/tests/cabal/test2.pkg
new file mode 100644
index 0000000000..a6d28d629a
--- /dev/null
+++ b/testsuite/tests/cabal/test2.pkg
@@ -0,0 +1,19 @@
+name: "testpkg"
+version: 2.0
+id: testpkg-2.0-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: unstable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+description: A Test Package (new version)
+category: none
+author: simonmar@microsoft.com
+exposed: False
+exposed-modules: A
+hidden-modules: B, "C.D", "C.E"
+import-dirs: /usr/local/lib/testpkg, "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg, "c:/Program Files/testpkg"
+include-dirs: /usr/local/include/testpkg, "c:/Program Files/testpkg"
+hs-libraries: testpkg-2.0
diff --git a/testsuite/tests/cabal/test3.pkg b/testsuite/tests/cabal/test3.pkg
new file mode 100644
index 0000000000..6d3257126b
--- /dev/null
+++ b/testsuite/tests/cabal/test3.pkg
@@ -0,0 +1,19 @@
+name: "testpkg"
+version: 3.0
+id: testpkg-3.0-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: unstable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+description: A Test Package (failure)
+category: none
+author: simonmar@microsoft.com
+exposed: False
+exposed-modules:
+hidden-modules:
+import-dirs:
+library-dirs:
+hs-libraries:
+depends: testpkg-2.0-XXX
diff --git a/testsuite/tests/cabal/test4.pkg b/testsuite/tests/cabal/test4.pkg
new file mode 100644
index 0000000000..598559a80f
--- /dev/null
+++ b/testsuite/tests/cabal/test4.pkg
@@ -0,0 +1,19 @@
+name: "testpkg"
+version: 4.0
+id: testpkg-4.0-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: unstable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+description: A Test Package (failure)
+category: none
+author: simonmar@microsoft.com
+exposed: True
+exposed-modules:
+hidden-modules:
+import-dirs:
+library-dirs:
+hs-libraries:
+depends: testpkg-2.0-XXX
diff --git a/testsuite/tests/cabal/test5.pkg b/testsuite/tests/cabal/test5.pkg
new file mode 100644
index 0000000000..fc27bc9ba5
--- /dev/null
+++ b/testsuite/tests/cabal/test5.pkg
@@ -0,0 +1,18 @@
+name: "newtestpkg"
+version: 2.0
+id: newtestpkg-2.0-XXX
+license: BSD3
+copyright: (c) The Univsersity of Glasgow 2004
+maintainer: glasgow-haskell-users@haskell.org
+stability: unstable
+homepage: http://www.haskell.org/ghc
+package-url: http://www.haskell.org/ghc
+description: A Test Package (new version)
+category: none
+author: simonmar@microsoft.com
+exposed: True
+exposed-modules: A
+hidden-modules: B, "C.D", "C.E"
+import-dirs: /usr/local/lib/testpkg, "c:/Program Files/testpkg"
+library-dirs: /usr/local/lib/testpkg, "c:/Program Files/testpkg"
+hs-libraries: testpkg-2.0
diff --git a/testsuite/tests/cabal/testdup.pkg b/testsuite/tests/cabal/testdup.pkg
new file mode 100644
index 0000000000..77000eda27
--- /dev/null
+++ b/testsuite/tests/cabal/testdup.pkg
@@ -0,0 +1,5 @@
+name: testdup
+version: 1.0
+id: testdup-1.0-XXX
+license: BSD3
+depends: testpkg-1.2.3.4-XXX testpkg-1.2.3.4-XXX