summaryrefslogtreecommitdiff
path: root/testsuite/tests/cabal/cabal01
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/cabal/cabal01')
-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
12 files changed, 119 insertions, 0 deletions
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