diff options
Diffstat (limited to 'testsuite/tests/driver/recompChangedPackage')
15 files changed, 179 insertions, 0 deletions
diff --git a/testsuite/tests/driver/recompChangedPackage/Main.hs b/testsuite/tests/driver/recompChangedPackage/Main.hs new file mode 100644 index 0000000000..abdd92d83f --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/Main.hs @@ -0,0 +1,6 @@ +module Main where + +import PLib +import QLib + +main = print [q] diff --git a/testsuite/tests/driver/recompChangedPackage/Makefile b/testsuite/tests/driver/recompChangedPackage/Makefile new file mode 100644 index 0000000000..ecbf49ec03 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/Makefile @@ -0,0 +1,37 @@ +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='$(filter-out -rtsopts,$(TEST_HC_OPTS))' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' $(VANILLA) $(PROF) $(DYN) + +recompChangedPackage: + '$(GHC_PKG)' init tmp.d + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup + # build q + (cd q; cp q.cabal1 q.cabal) + rm -rf q/dist + (cd q; $(CONFIGURE) --ipid "q-0.1") + (cd q; $(SETUP) build) + (cd q; $(SETUP) copy) + (cd q; $(SETUP) register) + + cp PLib1.hs PLib.hs + '$(TEST_HC)' -package-db tmp.d Main.hs + ./Main + + # Now add PLib to q.. Main should be recompiled + + $(GHC_PKG) --package-db tmp.d list + $(GHC_PKG) --package-db tmp.d unregister q-0.1.0.0 + rm PLib.hs + + (cd q; cp q.cabal2 q.cabal) + rm -rf q/dist + (cd q; $(CONFIGURE) --ipid "q-0.1") + (cd q; $(SETUP) build) + (cd q; $(SETUP) copy) + (cd q; $(SETUP) register) + + '$(TEST_HC)' -package-db tmp.d Main.hs + ./Main diff --git a/testsuite/tests/driver/recompChangedPackage/PLib1.hs b/testsuite/tests/driver/recompChangedPackage/PLib1.hs new file mode 100644 index 0000000000..439dcf1f43 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/PLib1.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE FlexibleInstances #-} +module PLib where + +p = 'p' + + diff --git a/testsuite/tests/driver/recompChangedPackage/Setup.hs b/testsuite/tests/driver/recompChangedPackage/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/testsuite/tests/driver/recompChangedPackage/all.T b/testsuite/tests/driver/recompChangedPackage/all.T new file mode 100644 index 0000000000..8acd1655b9 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/all.T @@ -0,0 +1,19 @@ +if config.have_vanilla: + vanilla = '--enable-library-vanilla' +else: + vanilla = '--disable-library-vanilla' + +if config.have_profiling: + prof = '--enable-library-profiling' +else: + prof = '--disable-library-profiling' + +if not config.compiler_profiled and config.have_shared_libs: + dyn = '--enable-shared' +else: + dyn = '--disable-shared' + +test('recompChangedPackage', [extra_files(['q', 'Main.hs', 'Setup.hs', 'PLib1.hs']), + when(fast(), skip)], + run_command, + ['$MAKE -s --no-print-directory recompChangedPackage VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn]) diff --git a/testsuite/tests/driver/recompChangedPackage/q/CHANGELOG.md b/testsuite/tests/driver/recompChangedPackage/q/CHANGELOG.md new file mode 100644 index 0000000000..62632c5376 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for q + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/testsuite/tests/driver/recompChangedPackage/q/LICENSE b/testsuite/tests/driver/recompChangedPackage/q/LICENSE new file mode 100644 index 0000000000..bca70f3531 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/LICENSE @@ -0,0 +1 @@ +q diff --git a/testsuite/tests/driver/recompChangedPackage/q/Main.hs b/testsuite/tests/driver/recompChangedPackage/q/Main.hs new file mode 100644 index 0000000000..b566f91285 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/Main.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE TemplateHaskell #-} +module Main where + +import Lib + +main = print $(p) diff --git a/testsuite/tests/driver/recompChangedPackage/q/PLib.hs b/testsuite/tests/driver/recompChangedPackage/q/PLib.hs new file mode 100644 index 0000000000..ee009a196d --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/PLib.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE FlexibleInstances #-} +module PLib where + +p = 'e' + +instance {-# OVERLAPPING #-} Show [Char] where + show _ = "empty" diff --git a/testsuite/tests/driver/recompChangedPackage/q/QLib.hs b/testsuite/tests/driver/recompChangedPackage/q/QLib.hs new file mode 100644 index 0000000000..b98aa33300 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/QLib.hs @@ -0,0 +1,3 @@ +module QLib where + +q = 'q' diff --git a/testsuite/tests/driver/recompChangedPackage/q/Setup.hs b/testsuite/tests/driver/recompChangedPackage/q/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/testsuite/tests/driver/recompChangedPackage/q/q.cabal b/testsuite/tests/driver/recompChangedPackage/q/q.cabal new file mode 100644 index 0000000000..f9f1e871cb --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/q.cabal @@ -0,0 +1,25 @@ +cabal-version: >=1.10 +-- Initial package description 'q.cabal' generated by 'cabal init'. For +-- further documentation, see http://haskell.org/cabal/users-guide/ + +name: q +version: 0.1.0.0 +-- synopsis: +-- description: +-- bug-reports: +-- license: +license-file: LICENSE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +-- copyright: +-- category: +build-type: Simple +extra-source-files: CHANGELOG.md + +library + exposed-modules: QLib PLib + -- other-modules: + -- other-extensions: + build-depends: base >=4 && <5 + -- hs-source-dirs: + default-language: Haskell2010 diff --git a/testsuite/tests/driver/recompChangedPackage/q/q.cabal1 b/testsuite/tests/driver/recompChangedPackage/q/q.cabal1 new file mode 100644 index 0000000000..01c41cd9d0 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/q.cabal1 @@ -0,0 +1,25 @@ +cabal-version: >=1.10 +-- Initial package description 'q.cabal' generated by 'cabal init'. For +-- further documentation, see http://haskell.org/cabal/users-guide/ + +name: q +version: 0.1.0.0 +-- synopsis: +-- description: +-- bug-reports: +-- license: +license-file: LICENSE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +-- copyright: +-- category: +build-type: Simple +extra-source-files: CHANGELOG.md + +library + exposed-modules: QLib + -- other-modules: + -- other-extensions: + build-depends: base >=4 && <5 + -- hs-source-dirs: + default-language: Haskell2010 diff --git a/testsuite/tests/driver/recompChangedPackage/q/q.cabal2 b/testsuite/tests/driver/recompChangedPackage/q/q.cabal2 new file mode 100644 index 0000000000..f9f1e871cb --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/q/q.cabal2 @@ -0,0 +1,25 @@ +cabal-version: >=1.10 +-- Initial package description 'q.cabal' generated by 'cabal init'. For +-- further documentation, see http://haskell.org/cabal/users-guide/ + +name: q +version: 0.1.0.0 +-- synopsis: +-- description: +-- bug-reports: +-- license: +license-file: LICENSE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +-- copyright: +-- category: +build-type: Simple +extra-source-files: CHANGELOG.md + +library + exposed-modules: QLib PLib + -- other-modules: + -- other-extensions: + build-depends: base >=4 && <5 + -- hs-source-dirs: + default-language: Haskell2010 diff --git a/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout b/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout new file mode 100644 index 0000000000..86d6324225 --- /dev/null +++ b/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout @@ -0,0 +1,10 @@ +[1 of 2] Compiling PLib ( PLib.hs, PLib.o ) +[2 of 2] Compiling Main ( Main.hs, Main.o ) +Linking Main ... +"q" +tmp.d + q-0.1.0.0 + +[1 of 1] Compiling Main ( Main.hs, Main.o ) [PLib removed] +Linking Main ... +empty |