summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-07-20 11:49:22 +0200
committerMatthew Pickering <matthewtpickering@gmail.com>2021-12-28 09:47:53 +0000
commitfd42ab5fa1df847a6b595dfe4b63d9c7eecbf400 (patch)
tree3bd7add640ee4e1340de079a16a05fd34548925f /testsuite
parent3219610e3ba6cb6a5cd1f4e32e2b4befea5bd384 (diff)
downloadhaskell-fd42ab5fa1df847a6b595dfe4b63d9c7eecbf400.tar.gz
Multiple Home Units
Multiple home units allows you to load different packages which may depend on each other into one GHC session. This will allow both GHCi and HLS to support multi component projects more naturally. Public Interface ~~~~~~~~~~~~~~~~ In order to specify multiple units, the -unit @⟨filename⟩ flag is given multiple times with a response file containing the arguments for each unit. The response file contains a newline separated list of arguments. ``` ghc -unit @unitLibCore -unit @unitLib ``` where the `unitLibCore` response file contains the normal arguments that cabal would pass to `--make` mode. ``` -this-unit-id lib-core-0.1.0.0 -i -isrc LibCore.Utils LibCore.Types ``` The response file for lib, can specify a dependency on lib-core, so then modules in lib can use modules from lib-core. ``` -this-unit-id lib-0.1.0.0 -package-id lib-core-0.1.0.0 -i -isrc Lib.Parse Lib.Render ``` Then when the compiler starts in --make mode it will compile both units lib and lib-core. There is also very basic support for multiple home units in GHCi, at the moment you can start a GHCi session with multiple units but only the :reload is supported. Most commands in GHCi assume a single home unit, and so it is additional work to work out how to modify the interface to support multiple loaded home units. Options used when working with Multiple Home Units There are a few extra flags which have been introduced specifically for working with multiple home units. The flags allow a home unit to pretend it’s more like an installed package, for example, specifying the package name, module visibility and reexported modules. -working-dir ⟨dir⟩ It is common to assume that a package is compiled in the directory where its cabal file resides. Thus, all paths used in the compiler are assumed to be relative to this directory. When there are multiple home units the compiler is often not operating in the standard directory and instead where the cabal.project file is located. In this case the -working-dir option can be passed which specifies the path from the current directory to the directory the unit assumes to be it’s root, normally the directory which contains the cabal file. When the flag is passed, any relative paths used by the compiler are offset by the working directory. Notably this includes -i and -I⟨dir⟩ flags. -this-package-name ⟨name⟩ This flag papers over the awkward interaction of the PackageImports and multiple home units. When using PackageImports you can specify the name of the package in an import to disambiguate between modules which appear in multiple packages with the same name. This flag allows a home unit to be given a package name so that you can also disambiguate between multiple home units which provide modules with the same name. -hidden-module ⟨module name⟩ This flag can be supplied multiple times in order to specify which modules in a home unit should not be visible outside of the unit it belongs to. The main use of this flag is to be able to recreate the difference between an exposed and hidden module for installed packages. -reexported-module ⟨module name⟩ This flag can be supplied multiple times in order to specify which modules are not defined in a unit but should be reexported. The effect is that other units will see this module as if it was defined in this unit. The use of this flag is to be able to replicate the reexported modules feature of packages with multiple home units. Offsetting Paths in Template Haskell splices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When using Template Haskell to embed files into your program, traditionally the paths have been interpreted relative to the directory where the .cabal file resides. This causes problems for multiple home units as we are compiling many different libraries at once which have .cabal files in different directories. For this purpose we have introduced a way to query the value of the -working-dir flag to the Template Haskell API. By using this function we can implement a makeRelativeToProject function which offsets a path which is relative to the original project root by the value of -working-dir. ``` import Language.Haskell.TH.Syntax ( makeRelativeToProject ) foo = $(makeRelativeToProject "./relative/path" >>= embedFile) ``` > If you write a relative path in a Template Haskell splice you should use the makeRelativeToProject function so that your library works correctly with multiple home units. A similar function already exists in the file-embed library. The function in template-haskell implements this function in a more robust manner by honouring the -working-dir flag rather than searching the file system. Closure Property for Home Units ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For tools or libraries using the API there is one very important closure property which must be adhered to: > Any dependency which is not a home unit must not (transitively) depend on a home unit. For example, if you have three packages p, q and r, then if p depends on q which depends on r then it is illegal to load both p and r as home units but not q, because q is a dependency of the home unit p which depends on another home unit r. If you are using GHC by the command line then this property is checked, but if you are using the API then you need to check this property yourself. If you get it wrong you will probably get some very confusing errors about overlapping instances. Limitations of Multiple Home Units ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are a few limitations of the initial implementation which will be smoothed out on user demand. * Package thinning/renaming syntax is not supported * More complicated reexports/renaming are not yet supported. * It’s more common to run into existing linker bugs when loading a large number of packages in a session (for example #20674, #20689) * Backpack is not yet supported when using multiple home units. * Dependency chasing can be quite slow with a large number of modules and packages. * Loading wired-in packages as home units is currently not supported (this only really affects GHC developers attempting to load template-haskell). * Barely any normal GHCi features are supported, it would be good to support enough for ghcid to work correctly. Despite these limitations, the implementation works already for nearly all packages. It has been testing on large dependency closures, including the whole of head.hackage which is a total of 4784 modules from 452 packages. Internal Changes ~~~~~~~~~~~~~~~~ * The biggest change is that the HomePackageTable is replaced with the HomeUnitGraph. The HomeUnitGraph is a map from UnitId to HomeUnitEnv, which contains information specific to each home unit. * The HomeUnitEnv contains: - A unit state, each home unit can have different package db flags - A set of dynflags, each home unit can have different flags - A HomePackageTable * LinkNode: A new node type is added to the ModuleGraph, this is used to place the linking step into the build plan so linking can proceed in parralel with other packages being built. * New invariant: Dependencies of a ModuleGraphNode can be completely determined by looking at the value of the node. In order to achieve this, downsweep now performs a more complete job of downsweeping and then the dependenices are recorded forever in the node rather than being computed again from the ModSummary. * Some transitive module calculations are rewritten to use the ModuleGraph which is more efficient. * There is always an active home unit, which simplifies modifying a lot of the existing API code which is unit agnostic (for example, in the driver). The road may be bumpy for a little while after this change but the basics are well-tested. One small metric increase, which we accept and also submodule update to haddock which removes ExtendedModSummary. Closes #10827 ------------------------- Metric Increase: MultiLayerModules ------------------------- Co-authored-by: Fendor <power.walross@gmail.com>
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/driver/testlib.py46
-rw-r--r--testsuite/tests/backpack/should_compile/bkp40.bkp2
-rw-r--r--testsuite/tests/backpack/should_compile/bkp40.stderr4
-rw-r--r--testsuite/tests/backpack/should_compile/bkp41.bkp2
-rw-r--r--testsuite/tests/backpack/should_compile/bkp41.stderr4
-rw-r--r--testsuite/tests/backpack/should_compile/bkp42.bkp2
-rw-r--r--testsuite/tests/backpack/should_compile/bkp42.stderr4
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail51.stderr2
-rw-r--r--testsuite/tests/cabal/T12485/T12485.stdout8
-rw-r--r--testsuite/tests/cabal/cabal08/cabal08.stdout16
-rw-r--r--testsuite/tests/cmm/should_compile/T16930.stdout4
-rw-r--r--testsuite/tests/count-deps/CountDepsAst.stdout3
-rw-r--r--testsuite/tests/count-deps/CountDepsParser.stdout3
-rw-r--r--testsuite/tests/deriving/should_fail/T14365.stderr1
-rw-r--r--testsuite/tests/driver/MultiRootsErr.hs1
-rw-r--r--testsuite/tests/driver/MultiRootsErr.stderr4
-rw-r--r--testsuite/tests/driver/T12983/T12983.stdout16
-rw-r--r--testsuite/tests/driver/T13914/T13914.stdout12
-rw-r--r--testsuite/tests/driver/T16608/T16608_1.stdout10
-rw-r--r--testsuite/tests/driver/T16608/T16608_2.stdout10
-rw-r--r--testsuite/tests/driver/T17481.stdout8
-rw-r--r--testsuite/tests/driver/T17586/T17586.stdout8
-rw-r--r--testsuite/tests/driver/T20300/T20300.stderr2
-rw-r--r--testsuite/tests/driver/T20316.stdout2
-rw-r--r--testsuite/tests/driver/T20459.stderr2
-rw-r--r--testsuite/tests/driver/T437/T437.stdout14
-rw-r--r--testsuite/tests/driver/all.T1
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeA.stdout12
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeB.stdout6
-rw-r--r--testsuite/tests/driver/dynamicToo/dynamicToo006/dynamicToo006.stdout4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/MHU_OptionsGHC.hs5
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/MHU_OptionsGHC.stderr12
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/Makefile33
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/a/A.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/all.T57
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/b/B.hs8
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/b2/B.hs8
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/c-file/C.hs6
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/c-file/c.c5
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/c-file/include/header1.h1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/c-file/include/header2.h1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/c/C.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/callstack/Main.hs4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/cpp-import/M.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/cpp-includes/CPPIncludes.hs11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/cpp-includes/CPPIncludes_Down.hs7
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/cpp-includes/include/header1.h1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/cpp-includes/include/header2.h1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/d/C.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/Makefile38
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/all.T9
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/different-db.stdout10
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/p/P.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/p/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/p/p.cabal11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/p1/P.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/p1/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/p1/p1.cabal11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/q/Q.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/q/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/q/q.cabal11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/r/R.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/r/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/r/r.cabal11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/unitP1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/unitQ1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/different-db/unitR1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/e/E.hs10
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/hi-dir/Makefile12
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/hi-dir/all.T6
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/hi-dir/p1/Main.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/hi-dir/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/instance-vis/all.T1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/instance-vis/multipleHomeUnits_instance-vis.stderr3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/instance-vis/p1/P.hs7
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/instance-vis/p2/P.hs11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/instance-vis/q/Q.hs6
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/instance-vis/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/instance-vis/unitP21
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/instance-vis/unitQ1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/Makefile41
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/all.T9
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stderr10
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stdout9
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/P.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/p.cabal11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/Q.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/q.cabal11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/R.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/r.cabal11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/R.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/Setup.hs2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/r1.cabal11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitP1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitQ1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitR1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitR11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/module-visibility-import/MV.hs5
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/module-visibility/MV1.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/module-visibility/MV2.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multiGHCi.script2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multiGHCi.stderr1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits001.stderr2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits001.stdout2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits002.stdout6
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits003.stdout8
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004.stderr2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004.stdout2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004_recomp.stdout2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stderr5
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stdout3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsPackageImports.stderr3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsPackageImports.stdout3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_callstack.stderr3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cfile.stderr1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cpp.stderr2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cpp2.stderr3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single1.stderr1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single1.stdout1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single2.stderr1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single2.stdout1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single3.stderr2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single3.stdout3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single4.stderr2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single4.stdout3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single5.stderr1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single5.stdout1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-dir/Makefile12
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-dir/all.T6
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-dir/p1/Main.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-dir/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-files/Makefile7
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-files/all.T6
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-files/multipleHomeUnits_o-files.stderr2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-files/p1/Main.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-files/p1/hello.c6
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/o-files/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/package-imports/P.hs4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/pi-roots/all.T2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/pi-roots/multipleHomeUnits_pi_duplicate.stderr3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/pi-roots/p1/P.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/pi-roots/p2/P.hs4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/pi-roots/p2/Q.hs4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/pi-roots/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/pi-roots/unitP21
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/reexport/all.T2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/reexport/p1/P.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/reexport/p2/Q.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/reexport/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/reexport/unitP21
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/self-import/Makefile9
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/self-import/all.T4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/self-import/p1/P.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/self-import/p2/P.hs4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/self-import/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/self-import/unitP21
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/target-file-path/all.T6
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/target-file-path/multipleHomeUnits_target-file-path.stderr2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/target-file-path/p1/Main.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/target-file-path/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th-deps/all.T1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th-deps/multipleHomeUnits_th-deps.stderr4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th-deps/p1/P.hs3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th-deps/p2/P.hs4
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th-deps/q/Q.hs9
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th-deps/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th-deps/unitP21
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th-deps/unitQ1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th/TH.hs8
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/th/data1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-clash/A.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-clash/B.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-clash/all.T2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-clash/multipleHomeUnits_unit-clash.stderr3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-clash/unitA1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-clash/unitB1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-cycles/all.T2
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-cycles/multipleHomeUnits_unit-cycles.stderr3
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-cycles/p1/P.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-cycles/p2/P.hs1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-cycles/unitP11
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unit-cycles/unitP21
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitA1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitB1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitB21
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitC1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitCFile1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitCPPImport1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitCPPIncludes1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitCallstack1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitD1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitE1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitMV1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitMV-import1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitPI1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitTH1
-rw-r--r--testsuite/tests/driver/multipleHomeUnits/unitTH11
-rw-r--r--testsuite/tests/driver/recomp007/recomp007.stdout4
-rw-r--r--testsuite/tests/driver/recomp011/recomp011.stdout12
-rw-r--r--testsuite/tests/driver/recomp015/recomp015.stdout8
-rw-r--r--testsuite/tests/driver/recomp019/recomp019.stdout12
-rw-r--r--testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout10
-rw-r--r--testsuite/tests/driver/retc001/retc001.stdout10
-rw-r--r--testsuite/tests/driver/should_fail/T10895.stderr4
-rw-r--r--testsuite/tests/driver/th-new-test/th-new-test.stdout34
-rw-r--r--testsuite/tests/ghc-api/T10052/T10052.stdout2
-rw-r--r--testsuite/tests/ghc-api/T7478/T7478.stdout10
-rw-r--r--testsuite/tests/ghc-api/downsweep/OldModLocation.hs9
-rw-r--r--testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs9
-rw-r--r--testsuite/tests/ghci/scripts/T18330.stdout5
-rw-r--r--testsuite/tests/ghci/scripts/T20587.script13
-rw-r--r--testsuite/tests/ghci/scripts/T20587.stdout4
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T2
-rw-r--r--testsuite/tests/ghci/scripts/ghci021.stderr2
-rw-r--r--testsuite/tests/hp2ps/T15904.stdout4
-rw-r--r--testsuite/tests/indexed-types/should_compile/impexp.stderr4
-rw-r--r--testsuite/tests/llvm/should_run/subsections_via_symbols/subsections_via_symbols.stdout4
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr4
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail04.stderr6
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr4
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr8
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr6
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.stderr8
-rw-r--r--testsuite/tests/parser/should_compile/T5243.stderr6
-rw-r--r--testsuite/tests/parser/should_fail/RecordDotSyntaxFail6.stderr6
-rw-r--r--testsuite/tests/parser/should_fail/RecordDotSyntaxFail7.stderr6
-rw-r--r--testsuite/tests/perf/compiler/Makefile12
-rw-r--r--testsuite/tests/perf/compiler/MultiLayerModulesTH_Make.stderr8
-rw-r--r--testsuite/tests/perf/compiler/MultiLayerModulesTH_OneShot.stderr8
-rw-r--r--testsuite/tests/perf/compiler/all.T41
-rwxr-xr-xtestsuite/tests/perf/compiler/genMultiComp.py78
-rwxr-xr-xtestsuite/tests/perf/compiler/genMultiLayerModulesTH47
-rw-r--r--testsuite/tests/plugins/frontend01.stdout4
-rw-r--r--testsuite/tests/plugins/plugin-recomp-flags.stdout8
-rw-r--r--testsuite/tests/plugins/plugin-recomp-impure.stdout8
-rw-r--r--testsuite/tests/plugins/plugin-recomp-pure.stdout4
-rw-r--r--testsuite/tests/regalloc/regalloc_unit_tests.hs2
-rw-r--r--testsuite/tests/rts/T9405.stdout4
-rw-r--r--testsuite/tests/rts/linker/linker_unload.stdout4
-rw-r--r--testsuite/tests/rts/linker/linker_unload_native.stdout4
-rw-r--r--testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.stdout4
-rw-r--r--testsuite/tests/safeHaskell/check/Check04.stderr4
-rw-r--r--testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr4
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang10.stderr6
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr6
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang17.stderr6
-rw-r--r--testsuite/tests/tcplugins/TcPlugin_RewritePerf.stderr6
-rw-r--r--testsuite/tests/th/TH_linker/path_with_commas.stdout4
-rw-r--r--testsuite/tests/typecheck/should_fail/T13068.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/T6018fail.stderr10
-rw-r--r--testsuite/tests/unboxedsums/module/sum_mod.stdout4
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727a.stderr9
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727b.stderr9
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727c.stderr6
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727d.stderr6
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727e.stderr6
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727f.stderr12
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727g.stderr12
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727h.stderr11
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727i.stderr11
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727j.stderr11
-rw-r--r--testsuite/tests/warnings/should_compile/T13727/T13727k.stderr8
-rw-r--r--testsuite/tests/warnings/should_compile/UnusedPackages.stderr4
269 files changed, 1269 insertions, 291 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index d41fc9b88c..fb2a7010f5 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1342,46 +1342,53 @@ def ghci_script( name, way, script):
# Compile-only tests
def compile( name, way, extra_hc_opts ):
- return do_compile( name, way, False, None, [], extra_hc_opts )
+ return do_compile( name, way, False, None, [], [], extra_hc_opts )
def compile_fail( name, way, extra_hc_opts ):
- return do_compile( name, way, True, None, [], extra_hc_opts )
+ return do_compile( name, way, True, None, [], [], extra_hc_opts )
def backpack_typecheck( name, way, extra_hc_opts ):
- return do_compile( name, way, False, None, [], "-fno-code -fwrite-interface " + extra_hc_opts, backpack=True )
+ return do_compile( name, way, False, None, [], [], "-fno-code -fwrite-interface " + extra_hc_opts, backpack=True )
def backpack_typecheck_fail( name, way, extra_hc_opts ):
- return do_compile( name, way, True, None, [], "-fno-code -fwrite-interface " + extra_hc_opts, backpack=True )
+ return do_compile( name, way, True, None, [], [], "-fno-code -fwrite-interface " + extra_hc_opts, backpack=True )
def backpack_compile( name, way, extra_hc_opts ):
- return do_compile( name, way, False, None, [], extra_hc_opts, backpack=True )
+ return do_compile( name, way, False, None, [], [], extra_hc_opts, backpack=True )
def backpack_compile_fail( name, way, extra_hc_opts ):
- return do_compile( name, way, True, None, [], extra_hc_opts, backpack=True )
+ return do_compile( name, way, True, None, [], [], extra_hc_opts, backpack=True )
def backpack_run( name, way, extra_hc_opts ):
return compile_and_run__( name, way, None, [], extra_hc_opts, backpack=True )
def multimod_compile( name, way, top_mod, extra_hc_opts ):
- return do_compile( name, way, False, top_mod, [], extra_hc_opts )
+ return do_compile( name, way, False, top_mod, [], [], extra_hc_opts )
def multimod_compile_fail( name, way, top_mod, extra_hc_opts ):
- return do_compile( name, way, True, top_mod, [], extra_hc_opts )
+ return do_compile( name, way, True, top_mod, [], [], extra_hc_opts )
def multimod_compile_filter( name, way, top_mod, extra_hc_opts, filter_with, suppress_stdout=True ):
- return do_compile( name, way, False, top_mod, [], extra_hc_opts, filter_with=filter_with, suppress_stdout=suppress_stdout )
+ return do_compile( name, way, False, top_mod, [], [], extra_hc_opts, filter_with=filter_with, suppress_stdout=suppress_stdout )
+
+def multiunit_compile( name, way, units, extra_hc_opts ):
+ return do_compile( name, way, False, None, [], units, extra_hc_opts )
+
+def multiunit_compile_fail( name, way, units, extra_hc_opts ):
+ return do_compile( name, way, True, None, [], units, extra_hc_opts )
def multi_compile( name, way, top_mod, extra_mods, extra_hc_opts ):
- return do_compile( name, way, False, top_mod, extra_mods, extra_hc_opts)
+ return do_compile( name, way, False, top_mod, extra_mods, [], extra_hc_opts)
def multi_compile_fail( name, way, top_mod, extra_mods, extra_hc_opts ):
- return do_compile( name, way, True, top_mod, extra_mods, extra_hc_opts)
+ return do_compile( name, way, True, top_mod, extra_mods, [], extra_hc_opts)
def do_compile(name: TestName,
way: WayName,
should_fail: bool,
top_mod: Optional[Path],
extra_mods: List[str],
+ units: List[str],
extra_hc_opts: str,
**kwargs
) -> PassFail:
@@ -1392,7 +1399,7 @@ def do_compile(name: TestName,
return result
extra_hc_opts = result.hc_opts
- result = simple_build(name, way, extra_hc_opts, should_fail, top_mod, False, True, **kwargs)
+ result = simple_build(name, way, extra_hc_opts, should_fail, top_mod, units, False, True, **kwargs)
if badResult(result):
return result
@@ -1427,7 +1434,7 @@ def compile_cmp_asm(name: TestName,
extra_hc_opts: str
) -> PassFail:
print('Compile only, extra args = ', extra_hc_opts)
- result = simple_build(name + '.' + ext, way, '-keep-s-files -O ' + extra_hc_opts, False, None, False, False)
+ result = simple_build(name + '.' + ext, way, '-keep-s-files -O ' + extra_hc_opts, False, None, [], False, False)
if badResult(result):
return result
@@ -1454,7 +1461,7 @@ def compile_grep_asm(name: TestName,
extra_hc_opts: str
) -> PassFail:
print('Compile only, extra args = ', extra_hc_opts)
- result = simple_build(name + '.' + ext, way, '-keep-s-files -O ' + extra_hc_opts, False, None, False, False)
+ result = simple_build(name + '.' + ext, way, '-keep-s-files -O ' + extra_hc_opts, False, None, [], False, False)
if badResult(result):
return result
@@ -1475,7 +1482,7 @@ def compile_grep_core(name: TestName,
extra_hc_opts: str
) -> PassFail:
print('Compile only, extra args = ', extra_hc_opts)
- result = simple_build(name + '.hs', way, '-ddump-to-file -dsuppress-all -ddump-simpl -O ' + extra_hc_opts, False, None, False, False)
+ result = simple_build(name + '.hs', way, '-ddump-to-file -dsuppress-all -ddump-simpl -O ' + extra_hc_opts, False, None, [], False, False)
if badResult(result):
return result
@@ -1511,7 +1518,7 @@ def compile_and_run__(name: TestName,
if way.startswith('ghci'): # interpreted...
return interpreter_run(name, way, extra_hc_opts, top_mod)
else: # compiled...
- result = simple_build(name, way, extra_hc_opts, False, top_mod, True, True, backpack = backpack)
+ result = simple_build(name, way, extra_hc_opts, False, top_mod, [], True, True, backpack = backpack)
if badResult(result):
return result
@@ -1621,7 +1628,7 @@ def check_stats(name: TestName,
def extras_build( way, extra_mods, extra_hc_opts ):
for mod, opts in extra_mods:
- result = simple_build(mod, way, opts + ' ' + extra_hc_opts, False, None, False, False)
+ result = simple_build(mod, way, opts + ' ' + extra_hc_opts, False, None, [], False, False)
if not (mod.endswith('.hs') or mod.endswith('.lhs')):
extra_hc_opts += ' %s' % Path(mod).with_suffix('.o')
if badResult(result):
@@ -1634,6 +1641,7 @@ def simple_build(name: Union[TestName, str],
extra_hc_opts: str,
should_fail: bool,
top_mod: Optional[Path],
+ units: List[str],
link: bool,
addsuf: bool,
backpack: bool = False,
@@ -1667,6 +1675,10 @@ def simple_build(name: Union[TestName, str],
to_do = to_do + '--backpack '
elif link:
to_do = '-o ' + name
+ elif len(units) > 0:
+ to_do = '--make'
+ for u in units:
+ to_do = to_do + ' -unit @%s' % u
else:
to_do = '-c' # just compile
diff --git a/testsuite/tests/backpack/should_compile/bkp40.bkp b/testsuite/tests/backpack/should_compile/bkp40.bkp
index d149d75877..749cfa5f92 100644
--- a/testsuite/tests/backpack/should_compile/bkp40.bkp
+++ b/testsuite/tests/backpack/should_compile/bkp40.bkp
@@ -36,7 +36,7 @@ unit eqmap where
-- Need to insert redundant constraint to make it work...
insert :: Eq k => k -> a -> Map k a -> Map k a
insert k v (Assoc xs) = Assoc ((k,v):xs)
-unit main where
+unit top where
dependency user[Map=ordmap:Map] (User as User.Ord)
dependency user[Map=eqmap:Map] (User as User.Eq)
diff --git a/testsuite/tests/backpack/should_compile/bkp40.stderr b/testsuite/tests/backpack/should_compile/bkp40.stderr
index f250951578..56216c5f3e 100644
--- a/testsuite/tests/backpack/should_compile/bkp40.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp40.stderr
@@ -7,8 +7,8 @@
[3 of 4] Processing eqmap
Instantiating eqmap
[1 of 1] Compiling Map ( eqmap/Map.hs, bkp40.out/eqmap/Map.o )
-[4 of 4] Processing main
- Instantiating main
+[4 of 4] Processing top
+ Instantiating top
[1 of 2] Including user[Map=ordmap:Map]
Instantiating user[Map=ordmap:Map]
[1 of 2] Compiling Map[sig] ( user/Map.hsig, bkp40.out/user/user-GzloW2NeDdA2M0V8qzN4g2/Map.o )
diff --git a/testsuite/tests/backpack/should_compile/bkp41.bkp b/testsuite/tests/backpack/should_compile/bkp41.bkp
index e8b5b24e35..fae5bc81fc 100644
--- a/testsuite/tests/backpack/should_compile/bkp41.bkp
+++ b/testsuite/tests/backpack/should_compile/bkp41.bkp
@@ -14,5 +14,5 @@ unit sig where
import B
app = print T
-unit main where
+unit top where
dependency sig[B=impl:B]
diff --git a/testsuite/tests/backpack/should_compile/bkp41.stderr b/testsuite/tests/backpack/should_compile/bkp41.stderr
index 766317718c..1ef9343d38 100644
--- a/testsuite/tests/backpack/should_compile/bkp41.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp41.stderr
@@ -5,8 +5,8 @@
[2 of 3] Processing sig
[1 of 2] Compiling B[sig] ( sig/B.hsig, nothing )
[2 of 2] Compiling App ( sig/App.hs, nothing )
-[3 of 3] Processing main
- Instantiating main
+[3 of 3] Processing top
+ Instantiating top
[1 of 1] Including sig[B=impl:B]
Instantiating sig[B=impl:B]
[1 of 2] Compiling B[sig] ( sig/B.hsig, bkp41.out/sig/sig-HVnmSw44WZeBfwnUur4wzl/B.o )
diff --git a/testsuite/tests/backpack/should_compile/bkp42.bkp b/testsuite/tests/backpack/should_compile/bkp42.bkp
index 59590f9125..9541738852 100644
--- a/testsuite/tests/backpack/should_compile/bkp42.bkp
+++ b/testsuite/tests/backpack/should_compile/bkp42.bkp
@@ -17,5 +17,5 @@ unit sig where
app :: T -> IO ()
app t = print t
-unit main where
+unit top where
dependency sig[B=impl:C]
diff --git a/testsuite/tests/backpack/should_compile/bkp42.stderr b/testsuite/tests/backpack/should_compile/bkp42.stderr
index ae2bb75c51..460a098e18 100644
--- a/testsuite/tests/backpack/should_compile/bkp42.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp42.stderr
@@ -6,8 +6,8 @@
[2 of 3] Processing sig
[1 of 2] Compiling B[sig] ( sig/B.hsig, nothing )
[2 of 2] Compiling App ( sig/App.hs, nothing )
-[3 of 3] Processing main
- Instantiating main
+[3 of 3] Processing top
+ Instantiating top
[1 of 1] Including sig[B=impl:C]
Instantiating sig[B=impl:C]
[1 of 2] Compiling B[sig] ( sig/B.hsig, bkp42.out/sig/sig-Ko6MwJiRFc509cOdDShPV5/B.o )
diff --git a/testsuite/tests/backpack/should_fail/bkpfail51.stderr b/testsuite/tests/backpack/should_fail/bkpfail51.stderr
index c732e0bcbf..9f40ff1d01 100644
--- a/testsuite/tests/backpack/should_fail/bkpfail51.stderr
+++ b/testsuite/tests/backpack/should_fail/bkpfail51.stderr
@@ -2,7 +2,7 @@
[1 of 2] Compiling H[sig] ( p/H.hsig, nothing )
[2 of 2] Compiling I ( p/I.hs, nothing )
[2 of 2] Processing q
-Module imports and instantiations form a cycle:
+Module graph contains a cycle:
instantiated unit p[H=A]
imports module ‘A’ (q/A.hsig)
which imports instantiated unit p[H=A]
diff --git a/testsuite/tests/cabal/T12485/T12485.stdout b/testsuite/tests/cabal/T12485/T12485.stdout
index aefbf389b1..5d24c873ce 100644
--- a/testsuite/tests/cabal/T12485/T12485.stdout
+++ b/testsuite/tests/cabal/T12485/T12485.stdout
@@ -1,6 +1,6 @@
Reading package info from "a.pkg" ... done.
Reading package info from "b.pkg" ... done.
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main [Objects changed]
diff --git a/testsuite/tests/cabal/cabal08/cabal08.stdout b/testsuite/tests/cabal/cabal08/cabal08.stdout
index 06a164b150..200f53e482 100644
--- a/testsuite/tests/cabal/cabal08/cabal08.stdout
+++ b/testsuite/tests/cabal/cabal08/cabal08.stdout
@@ -1,12 +1,12 @@
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main
p2
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main [Objects changed]
p1
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main [Objects changed]
p2
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main [Objects changed]
p1
diff --git a/testsuite/tests/cmm/should_compile/T16930.stdout b/testsuite/tests/cmm/should_compile/T16930.stdout
index bc33620682..ebbb14dcd5 100644
--- a/testsuite/tests/cmm/should_compile/T16930.stdout
+++ b/testsuite/tests/cmm/should_compile/T16930.stdout
@@ -1,6 +1,6 @@
testing -ddump-cmm-verbose for T16930 ...
-[1 of 1] Compiling Main ( T16930.hs, T16930.o )
-Linking T16930 ...
+[1 of 2] Compiling Main ( T16930.hs, T16930.o )
+[2 of 2] Linking T16930
T16930.dump-cmm-caf
T16930.dump-cmm-cfg
T16930.dump-cmm-cps
diff --git a/testsuite/tests/count-deps/CountDepsAst.stdout b/testsuite/tests/count-deps/CountDepsAst.stdout
index c4d629069c..05fb3712ae 100644
--- a/testsuite/tests/count-deps/CountDepsAst.stdout
+++ b/testsuite/tests/count-deps/CountDepsAst.stdout
@@ -1,4 +1,4 @@
-Found 276 Language.Haskell.Syntax module dependencies
+Found 277 Language.Haskell.Syntax module dependencies
GHC.Builtin.Names
GHC.Builtin.PrimOps
GHC.Builtin.Types
@@ -121,6 +121,7 @@ GHC.Iface.Ext.Fields
GHC.Iface.Recomp.Binary
GHC.Iface.Syntax
GHC.Iface.Type
+GHC.Linker.Static.Utils
GHC.Linker.Types
GHC.Parser.Annotation
GHC.Parser.Errors.Basic
diff --git a/testsuite/tests/count-deps/CountDepsParser.stdout b/testsuite/tests/count-deps/CountDepsParser.stdout
index 457e42da8e..11b74ade5f 100644
--- a/testsuite/tests/count-deps/CountDepsParser.stdout
+++ b/testsuite/tests/count-deps/CountDepsParser.stdout
@@ -1,4 +1,4 @@
-Found 282 GHC.Parser module dependencies
+Found 283 GHC.Parser module dependencies
GHC.Builtin.Names
GHC.Builtin.PrimOps
GHC.Builtin.Types
@@ -122,6 +122,7 @@ GHC.Iface.Ext.Fields
GHC.Iface.Recomp.Binary
GHC.Iface.Syntax
GHC.Iface.Type
+GHC.Linker.Static.Utils
GHC.Linker.Types
GHC.Parser
GHC.Parser.Annotation
diff --git a/testsuite/tests/deriving/should_fail/T14365.stderr b/testsuite/tests/deriving/should_fail/T14365.stderr
index f8f106fea8..a166953cf5 100644
--- a/testsuite/tests/deriving/should_fail/T14365.stderr
+++ b/testsuite/tests/deriving/should_fail/T14365.stderr
@@ -11,3 +11,4 @@ T14365B.hs-boot:7:1: error:
Cannot derive instances in hs-boot files
Write an instance declaration instead
• In the stand-alone deriving instance for ‘Foldable Foo’
+[3 of 3] Compiling T14365B ( T14365B.hs, T14365B.o )
diff --git a/testsuite/tests/driver/MultiRootsErr.hs b/testsuite/tests/driver/MultiRootsErr.hs
new file mode 100644
index 0000000000..858ea3b9bb
--- /dev/null
+++ b/testsuite/tests/driver/MultiRootsErr.hs
@@ -0,0 +1 @@
+module MultiRootsErr where
diff --git a/testsuite/tests/driver/MultiRootsErr.stderr b/testsuite/tests/driver/MultiRootsErr.stderr
new file mode 100644
index 0000000000..c4b11bfe84
--- /dev/null
+++ b/testsuite/tests/driver/MultiRootsErr.stderr
@@ -0,0 +1,4 @@
+
+<no location info>: error:
+ module ‘main:MultiRootsErr’ is defined in multiple files: MultiRootsErr.hs
+ MultiRootsErr.hs
diff --git a/testsuite/tests/driver/T12983/T12983.stdout b/testsuite/tests/driver/T12983/T12983.stdout
index 321e702d27..3e34b745fc 100644
--- a/testsuite/tests/driver/T12983/T12983.stdout
+++ b/testsuite/tests/driver/T12983/T12983.stdout
@@ -1,18 +1,18 @@
Preparing everyting with --make ...
-[1 of 3] Compiling Hospital
-[2 of 3] Compiling Types
-[3 of 3] Compiling Main
-Linking src/MetaHandler ...
+[1 of 4] Compiling Hospital
+[2 of 4] Compiling Types
+[3 of 4] Compiling Main
+[4 of 4] Linking src/MetaHandler
Done with preparations with --make
Building with --make
-[1 of 4] Compiling ShortText
-[2 of 4] Compiling Hospital [Source file changed]
-[4 of 4] Compiling Main [Hospital[TH] changed]
-Linking src/MetaHandler ...
+[1 of 5] Compiling ShortText
+[2 of 5] Compiling Hospital [Source file changed]
+[4 of 5] Compiling Main [Hospital[TH] changed]
+[5 of 5] Linking src/MetaHandler [Objects changed]
Preparing everything ...
src/Hospital.hs
diff --git a/testsuite/tests/driver/T13914/T13914.stdout b/testsuite/tests/driver/T13914/T13914.stdout
index d443ed47b9..6453a0011c 100644
--- a/testsuite/tests/driver/T13914/T13914.stdout
+++ b/testsuite/tests/driver/T13914/T13914.stdout
@@ -1,16 +1,16 @@
Without -fignore-asserts
-[1 of 1] Compiling Main ( main.hs, main.o )
-Linking main ...
+[1 of 2] Compiling Main ( main.hs, main.o )
+[2 of 2] Linking main
main: Assertion failed
CallStack (from HasCallStack):
assert, called at main.hs:3:8 in main:Main
With -fignore-asserts
-[1 of 1] Compiling Main ( main.hs, main.o ) [Optimisation flags changed]
-Linking main ...
+[1 of 2] Compiling Main ( main.hs, main.o ) [Optimisation flags changed]
+[2 of 2] Linking main [Objects changed]
OK
Without -fignore-asserts
-[1 of 1] Compiling Main ( main.hs, main.o ) [Optimisation flags changed]
-Linking main ...
+[1 of 2] Compiling Main ( main.hs, main.o ) [Optimisation flags changed]
+[2 of 2] Linking main [Objects changed]
main: Assertion failed
CallStack (from HasCallStack):
assert, called at main.hs:3:8 in main:Main
diff --git a/testsuite/tests/driver/T16608/T16608_1.stdout b/testsuite/tests/driver/T16608/T16608_1.stdout
index f925d67b8c..ce5a336950 100644
--- a/testsuite/tests/driver/T16608/T16608_1.stdout
+++ b/testsuite/tests/driver/T16608/T16608_1.stdout
@@ -1,7 +1,7 @@
-[1 of 2] Compiling MyInteger ( MyInteger.hs, MyInteger.o )
-[2 of 2] Compiling Main ( T16608_1.hs, T16608_1.o )
-Linking T16608_1 ...
+[1 of 3] Compiling MyInteger ( MyInteger.hs, MyInteger.o )
+[2 of 3] Compiling Main ( T16608_1.hs, T16608_1.o )
+[3 of 3] Linking T16608_1
41
-[1 of 2] Compiling MyInteger ( MyInteger.hs, MyInteger.o ) [Source file changed]
-Linking T16608_1 ...
+[1 of 3] Compiling MyInteger ( MyInteger.hs, MyInteger.o ) [Source file changed]
+[3 of 3] Linking T16608_1 [Objects changed]
42
diff --git a/testsuite/tests/driver/T16608/T16608_2.stdout b/testsuite/tests/driver/T16608/T16608_2.stdout
index af2de7e698..8935c0bb3f 100644
--- a/testsuite/tests/driver/T16608/T16608_2.stdout
+++ b/testsuite/tests/driver/T16608/T16608_2.stdout
@@ -1,7 +1,7 @@
-[1 of 2] Compiling MyInteger ( MyInteger.hs, MyInteger.o )
-[2 of 2] Compiling Main ( T16608_2.hs, T16608_2.o )
-Linking T16608_2 ...
+[1 of 3] Compiling MyInteger ( MyInteger.hs, MyInteger.o )
+[2 of 3] Compiling Main ( T16608_2.hs, T16608_2.o )
+[3 of 3] Linking T16608_2
41
-[1 of 2] Compiling MyInteger ( MyInteger.hs, MyInteger.o ) [Source file changed]
-Linking T16608_2 ...
+[1 of 3] Compiling MyInteger ( MyInteger.hs, MyInteger.o ) [Source file changed]
+[3 of 3] Linking T16608_2 [Objects changed]
42
diff --git a/testsuite/tests/driver/T17481.stdout b/testsuite/tests/driver/T17481.stdout
index 885dac3986..204b0ee2af 100644
--- a/testsuite/tests/driver/T17481.stdout
+++ b/testsuite/tests/driver/T17481.stdout
@@ -1,14 +1,14 @@
Main.hs is now:
main = putStrLn "Hello from A"
Compiling and running Main.hs:
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main
Hello from A
Main.hs is now:
main = putStrLn "Hello from B"
Compiling and running Main.hs:
-[1 of 1] Compiling Main ( Main.hs, Main.o ) [Source file changed]
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o ) [Source file changed]
+[2 of 2] Linking Main [Objects changed]
Hello from B
Touching Main.hs
Compiling and running Main.hs:
diff --git a/testsuite/tests/driver/T17586/T17586.stdout b/testsuite/tests/driver/T17586/T17586.stdout
index d0bb37090e..e541917636 100644
--- a/testsuite/tests/driver/T17586/T17586.stdout
+++ b/testsuite/tests/driver/T17586/T17586.stdout
@@ -1,6 +1,6 @@
-[1 of 1] Compiling Main ( T17586.hs, T17586.o )
-Linking T17586 ...
+[1 of 2] Compiling Main ( T17586.hs, T17586.o )
+[2 of 2] Linking T17586
hello world
-[1 of 1] Compiling Main ( T17586.hs, T17586.o ) [Flags changed]
-Linking T17586 ...
+[1 of 2] Compiling Main ( T17586.hs, T17586.o ) [Flags changed]
+[2 of 2] Linking T17586 [Objects changed]
hello world
diff --git a/testsuite/tests/driver/T20300/T20300.stderr b/testsuite/tests/driver/T20300/T20300.stderr
index 1a93d8d7ba..37b55fd9c1 100644
--- a/testsuite/tests/driver/T20300/T20300.stderr
+++ b/testsuite/tests/driver/T20300/T20300.stderr
@@ -1,4 +1,4 @@
[1 of 4] Compiling T[boot] ( T.hs-boot, nothing )
[2 of 4] Compiling S ( S.hs, S.o, S.dyn_o )
-[3 of 4] Compiling T ( T.hs, T.o, T.dyn_o )
+[3 of 4] Compiling T ( T.hs, nothing )
[4 of 4] Compiling Top ( Top.hs, nothing )
diff --git a/testsuite/tests/driver/T20316.stdout b/testsuite/tests/driver/T20316.stdout
index 280a3c80e7..f46d4f0715 100644
--- a/testsuite/tests/driver/T20316.stdout
+++ b/testsuite/tests/driver/T20316.stdout
@@ -1,4 +1,4 @@
-[1 of 1] Compiling Main ( T20316.hs, nothing )
+[1 of 2] Compiling Main ( T20316.hs, nothing )
*** non-module.dump-timings ***
initializing unit database:
Chasing dependencies:
diff --git a/testsuite/tests/driver/T20459.stderr b/testsuite/tests/driver/T20459.stderr
index 63ae634930..f37ef0be3e 100644
--- a/testsuite/tests/driver/T20459.stderr
+++ b/testsuite/tests/driver/T20459.stderr
@@ -1,2 +1,2 @@
-Module imports form a cycle:
+Module graph contains a cycle:
module ‘T20459A’ (./T20459A.hs) imports itself
diff --git a/testsuite/tests/driver/T437/T437.stdout b/testsuite/tests/driver/T437/T437.stdout
index 2057b5df86..3dd0b5cc3b 100644
--- a/testsuite/tests/driver/T437/T437.stdout
+++ b/testsuite/tests/driver/T437/T437.stdout
@@ -1,10 +1,10 @@
-[1 of 2] Compiling Test2 ( Test2.hs, Test2.o )
-[2 of 2] Compiling Test ( Test.hs, Test.o )
-Linking Test ...
-[1 of 1] Compiling Test2 ( Test2.hs, Test2.o ) [Flags changed]
-Linking Test2 ...
+[1 of 3] Compiling Test2 ( Test2.hs, Test2.o )
+[2 of 3] Compiling Test ( Test.hs, Test.o )
+[3 of 3] Linking Test
+[1 of 2] Compiling Test2 ( Test2.hs, Test2.o ) [Flags changed]
+[2 of 2] Linking Test2
"Test2.doit"
"Test2.main"
-[1 of 1] Compiling Test2 ( Test2.hs, Test2.o ) [Flags changed]
-Linking Test2 ...
+[1 of 2] Compiling Test2 ( Test2.hs, Test2.o ) [Flags changed]
+[2 of 2] Linking Test2 [Objects changed]
"Test2.doit"
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 4af15b7640..907002fcf7 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -302,3 +302,4 @@ test('T20459', normal, multimod_compile_fail,
test('T20200loop', extra_files(['T20200loop']), multimod_compile,
['Datatypes', '-iT20200loop -O -v0'])
test('T20316', normal, makefile_test, [])
+test('MultiRootsErr', normal, multimod_compile_fail, ['MultiRootsErr', 'MultiRootsErr'])
diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeA.stdout b/testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeA.stdout
index d80c899cb1..76ad05bb37 100644
--- a/testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeA.stdout
+++ b/testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeA.stdout
@@ -1,6 +1,6 @@
-[1 of 3] Compiling A ( A.hs, A.o, A.dyn_o )
-[2 of 3] Compiling B ( B.hs, B.o, B.dyn_o )
-[3 of 3] Compiling Main ( C.hs, C.o, C.dyn_o )
-Linking C ...
-[2 of 3] Compiling B ( B.hs, B.o, B.dyn_o ) [Missing dynamic interface file]
-Linking C ...
+[1 of 4] Compiling A ( A.hs, A.o, A.dyn_o )
+[2 of 4] Compiling B ( B.hs, B.o, B.dyn_o )
+[3 of 4] Compiling Main ( C.hs, C.o, C.dyn_o )
+[4 of 4] Linking C
+[2 of 4] Compiling B ( B.hs, B.o, B.dyn_o ) [Missing dynamic interface file]
+[4 of 4] Linking C [Objects changed]
diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeB.stdout b/testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeB.stdout
index 56caf28582..1e2de97295 100644
--- a/testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeB.stdout
+++ b/testsuite/tests/driver/dynamicToo/dynamicToo001/dynamicToo001MakeB.stdout
@@ -1,3 +1,3 @@
-[2 of 3] Compiling B ( B.hs, B.o, B.dyn_o ) [Mismatched dynamic interface file]
-[3 of 3] Compiling Main ( C.hs, C.o, C.dyn_o )
-Linking C ...
+[2 of 4] Compiling B ( B.hs, B.o, B.dyn_o ) [Mismatched dynamic interface file]
+[3 of 4] Compiling Main ( C.hs, C.o, C.dyn_o )
+[4 of 4] Linking C
diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo006/dynamicToo006.stdout b/testsuite/tests/driver/dynamicToo/dynamicToo006/dynamicToo006.stdout
index 5c33cb2e7a..243efe5829 100644
--- a/testsuite/tests/driver/dynamicToo/dynamicToo006/dynamicToo006.stdout
+++ b/testsuite/tests/driver/dynamicToo/dynamicToo006/dynamicToo006.stdout
@@ -1,2 +1,2 @@
-[1 of 1] Compiling Main ( Main.hs, Main.o, Main.dyn_o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o, Main.dyn_o )
+[2 of 2] Linking Main
diff --git a/testsuite/tests/driver/multipleHomeUnits/MHU_OptionsGHC.hs b/testsuite/tests/driver/multipleHomeUnits/MHU_OptionsGHC.hs
new file mode 100644
index 0000000000..9163054cab
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/MHU_OptionsGHC.hs
@@ -0,0 +1,5 @@
+{-# OPTIONS_GHC -working-dir=a #-}
+{-# OPTIONS_GHC -hidden-module=A #-}
+{-# OPTIONS_GHC -reexported-module=A #-}
+{-# OPTIONS_GHC -this-package-name=pp #-}
+module Main where
diff --git a/testsuite/tests/driver/multipleHomeUnits/MHU_OptionsGHC.stderr b/testsuite/tests/driver/multipleHomeUnits/MHU_OptionsGHC.stderr
new file mode 100644
index 0000000000..70de257142
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/MHU_OptionsGHC.stderr
@@ -0,0 +1,12 @@
+
+MHU_OptionsGHC.hs:1:17: error:
+ Unknown flag in {-# OPTIONS_GHC #-} pragma: -working-dir=a
+
+MHU_OptionsGHC.hs:2:17: error:
+ Unknown flag in {-# OPTIONS_GHC #-} pragma: -hidden-module=A
+
+MHU_OptionsGHC.hs:3:17: error:
+ Unknown flag in {-# OPTIONS_GHC #-} pragma: -reexported-module=A
+
+MHU_OptionsGHC.hs:4:17: error:
+ Unknown flag in {-# OPTIONS_GHC #-} pragma: -this-package-name=pp
diff --git a/testsuite/tests/driver/multipleHomeUnits/Makefile b/testsuite/tests/driver/multipleHomeUnits/Makefile
new file mode 100644
index 0000000000..d244bc6834
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/Makefile
@@ -0,0 +1,33 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+EXECTUABLE_C = c/C$(exeext)
+EXECTUABLE_D = d/D$(exeext)
+CLEAN_FILES = a/A.o a/A.hi a/A.hie b/B.o b/B.hi b/B.hie c/C.o c/C.hi c/C.hie d/C.o d/C.hi d/C.hie $(EXECTUABLE_C) $(EXECTUABLE_D)
+
+clean:
+ $(RM) $(CLEAN_FILES)
+
+multipleHomeUnits_callstack: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) -unit @unitCallstack -v0
+ ! ./callstack/Main
+
+multipleHomeUnits002: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -unit @unitC -unit @unitD
+ ./$(EXECTUABLE_C)
+ ./$(EXECTUABLE_D)
+
+multipleHomeUnits003: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -unit @unitA -unit @unitB -unit @unitC -unit @unitD
+ ./$(EXECTUABLE_C)
+ ./$(EXECTUABLE_D)
+
+multipleHomeUnits004_recomp: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -unit @unitB -unit @unitE
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -unit @unitB -unit @unitE
+
+multipleHomeUnitsModuleVisibility: clean
+ ! '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -unit @unitMV -unit @unitMV-import
+
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/a/A.hs b/testsuite/tests/driver/multipleHomeUnits/a/A.hs
new file mode 100644
index 0000000000..883fd3f17c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/a/A.hs
@@ -0,0 +1,3 @@
+module A where
+
+foo = ()
diff --git a/testsuite/tests/driver/multipleHomeUnits/all.T b/testsuite/tests/driver/multipleHomeUnits/all.T
new file mode 100644
index 0000000000..c2bbf0f368
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/all.T
@@ -0,0 +1,57 @@
+test('multipleHomeUnits_single1', [extra_files([ 'a/', 'unitA'])], multiunit_compile, [['unitA'], '-fhide-source-paths'])
+test('multipleHomeUnits_single2', [extra_files([ 'b/', 'unitB'])], multiunit_compile, [['unitB'], '-fhide-source-paths'])
+test('multipleHomeUnits_single3', [extra_files([ 'c/', 'unitC'])], multiunit_compile, [['unitC'], '-fhide-source-paths'])
+test('multipleHomeUnits_single4', [extra_files([ 'd/', 'unitD'])], multiunit_compile, [['unitD'], '-fhide-source-paths'])
+test('multipleHomeUnits_single5', [extra_files([ 'th/', 'unitTH'])], multiunit_compile, [['unitTH'], '-fhide-source-paths'])
+test('multipleHomeUnits_cpp', [extra_files([ 'cpp-includes/', 'unitCPPIncludes'])], multiunit_compile, [['unitCPPIncludes'], '-fhide-source-paths'])
+test('multipleHomeUnits_cfile', [extra_files([ 'c-file/', 'unitCFile'])], multiunit_compile, [['unitCFile'], '-fhide-source-paths'])
+test('multipleHomeUnits_callstack', [extra_files([ 'callstack/', 'unitCallstack'])], makefile_test, [])
+
+test('multipleHomeUnits_cpp2', [extra_files([ 'cpp-includes/', 'cpp-import/', 'unitCPPImport', 'unitCPPIncludes'])], multiunit_compile, [['unitCPPImport', 'unitCPPIncludes'], '-fhide-source-paths'])
+
+test('multiGHCi', [extra_files(['a/', 'b/', 'unitA', 'unitB', 'multiGHCi.script'])
+ , extra_run_opts('-unit @unitA -unit @unitB')], ghci_script, ['multiGHCi.script'])
+
+test('multipleHomeUnits001',
+ [ extra_files(
+ [ 'a/', 'b/'
+ , 'unitA', 'unitB'])
+ ], multiunit_compile, [['unitA', 'unitB'], '-fhide-source-paths'])
+
+test('multipleHomeUnits002',
+ [ extra_files(
+ [ 'c/', 'd/'
+ , 'unitC', 'unitD'])
+ ], makefile_test, [])
+
+test('multipleHomeUnits003',
+ [ extra_files(
+ [ 'a/', 'b/', 'c/', 'd/'
+ , 'unitA', 'unitB', 'unitC', 'unitD'])
+ ], makefile_test, [])
+
+test('multipleHomeUnits004',
+ [ extra_files(
+ [ 'b/', 'e/'
+ , 'unitB', 'unitE'])
+ ], multiunit_compile, [['unitB', 'unitE'], '-fhide-source-paths'])
+
+test('multipleHomeUnits004_recomp',
+ [ extra_files(
+ [ 'b/', 'e/'
+ , 'unitB', 'unitE'])
+ ], makefile_test, [])
+
+test('multipleHomeUnitsModuleVisibility',
+ [ extra_files(
+ [ 'module-visibility/', 'module-visibility-import/'
+ , 'unitMV', 'unitMV-import'])
+ ], makefile_test, [])
+
+test('multipleHomeUnitsPackageImports',
+ [ extra_files(
+ [ 'b/', 'b2/', 'package-imports/'
+ , 'unitB', 'unitB2', 'unitPI'])
+ ], multiunit_compile, [['unitB', 'unitB2', 'unitPI'], '-fhide-source-paths'])
+
+test('MHU_OptionsGHC', normal, compile_fail, [''])
diff --git a/testsuite/tests/driver/multipleHomeUnits/b/B.hs b/testsuite/tests/driver/multipleHomeUnits/b/B.hs
new file mode 100644
index 0000000000..1bf85fa974
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/b/B.hs
@@ -0,0 +1,8 @@
+module B where
+
+foo = ()
+
+b = foo
+
+data B = B deriving Show
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/b2/B.hs b/testsuite/tests/driver/multipleHomeUnits/b2/B.hs
new file mode 100644
index 0000000000..1bf85fa974
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/b2/B.hs
@@ -0,0 +1,8 @@
+module B where
+
+foo = ()
+
+b = foo
+
+data B = B deriving Show
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/c-file/C.hs b/testsuite/tests/driver/multipleHomeUnits/c-file/C.hs
new file mode 100644
index 0000000000..5ced57fc56
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/c-file/C.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE CPP #-}
+#include "header1.h"
+module C where
+
+foo = A
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/c-file/c.c b/testsuite/tests/driver/multipleHomeUnits/c-file/c.c
new file mode 100644
index 0000000000..e220cb91da
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/c-file/c.c
@@ -0,0 +1,5 @@
+#include "header2.h"
+int foo() {
+ return(B);
+}
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/c-file/include/header1.h b/testsuite/tests/driver/multipleHomeUnits/c-file/include/header1.h
new file mode 100644
index 0000000000..ab2a05dbbf
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/c-file/include/header1.h
@@ -0,0 +1 @@
+#define A 1
diff --git a/testsuite/tests/driver/multipleHomeUnits/c-file/include/header2.h b/testsuite/tests/driver/multipleHomeUnits/c-file/include/header2.h
new file mode 100644
index 0000000000..edd392bc2a
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/c-file/include/header2.h
@@ -0,0 +1 @@
+#define B 2
diff --git a/testsuite/tests/driver/multipleHomeUnits/c/C.hs b/testsuite/tests/driver/multipleHomeUnits/c/C.hs
new file mode 100644
index 0000000000..b9fdcc8ab7
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/c/C.hs
@@ -0,0 +1,3 @@
+module Main where
+
+main = putStrLn "unit C compiled successfully"
diff --git a/testsuite/tests/driver/multipleHomeUnits/callstack/Main.hs b/testsuite/tests/driver/multipleHomeUnits/callstack/Main.hs
new file mode 100644
index 0000000000..7117e65aaa
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/callstack/Main.hs
@@ -0,0 +1,4 @@
+module Main where
+
+-- Callstack should not mention the subdirectory
+main = error "test"
diff --git a/testsuite/tests/driver/multipleHomeUnits/cpp-import/M.hs b/testsuite/tests/driver/multipleHomeUnits/cpp-import/M.hs
new file mode 100644
index 0000000000..aabfc85f90
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/cpp-import/M.hs
@@ -0,0 +1,3 @@
+module M where
+
+import CPPIncludes_Down
diff --git a/testsuite/tests/driver/multipleHomeUnits/cpp-includes/CPPIncludes.hs b/testsuite/tests/driver/multipleHomeUnits/cpp-includes/CPPIncludes.hs
new file mode 100644
index 0000000000..0e8539f738
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/cpp-includes/CPPIncludes.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE CPP #-}
+#include "header1.h"
+module CPPIncludes where
+
+-- This module is only discovered by downsweep and hits a different code path
+-- to the path which gets mod summaries for the targets
+import CPPIncludes_Down
+
+foo = A
+
+qux = B
diff --git a/testsuite/tests/driver/multipleHomeUnits/cpp-includes/CPPIncludes_Down.hs b/testsuite/tests/driver/multipleHomeUnits/cpp-includes/CPPIncludes_Down.hs
new file mode 100644
index 0000000000..91c232d0c6
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/cpp-includes/CPPIncludes_Down.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE CPP #-}
+#include "header1.h"
+module CPPIncludes_Down where
+
+goo = A
+
+gux = B
diff --git a/testsuite/tests/driver/multipleHomeUnits/cpp-includes/include/header1.h b/testsuite/tests/driver/multipleHomeUnits/cpp-includes/include/header1.h
new file mode 100644
index 0000000000..ab2a05dbbf
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/cpp-includes/include/header1.h
@@ -0,0 +1 @@
+#define A 1
diff --git a/testsuite/tests/driver/multipleHomeUnits/cpp-includes/include/header2.h b/testsuite/tests/driver/multipleHomeUnits/cpp-includes/include/header2.h
new file mode 100644
index 0000000000..edd392bc2a
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/cpp-includes/include/header2.h
@@ -0,0 +1 @@
+#define B 2
diff --git a/testsuite/tests/driver/multipleHomeUnits/d/C.hs b/testsuite/tests/driver/multipleHomeUnits/d/C.hs
new file mode 100644
index 0000000000..04171f50ab
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/d/C.hs
@@ -0,0 +1,3 @@
+module Main where
+
+main = putStrLn "unit D compiled successfully"
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/Makefile b/testsuite/tests/driver/multipleHomeUnits/different-db/Makefile
new file mode 100644
index 0000000000..c12f6cab34
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/Makefile
@@ -0,0 +1,38 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP=../Setup -v0
+
+different-db: clean
+ $(MAKE) -s --no-print-directory clean
+ '$(GHC_PKG)' init tmp.d
+ '$(GHC_PKG)' init tmp1.d
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
+ # Put p into tmp.d
+ cd p && $(SETUP) clean
+ cd p && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --ipid=p-0.1.0.0 --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
+ cd p && $(SETUP) build
+ cd p && $(SETUP) register --inplace
+ # Put p1 into tmp1.d
+ cd p1 && $(SETUP) clean
+ cd p1 && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --ipid=p1-0.1.0.0 --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp1.d
+ cd p1 && $(SETUP) build
+ cd p1 && $(SETUP) register --inplace
+ # This should work
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP -unit @unitQ
+ # So should this
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP1 -unit @unitR
+ # So should this
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP -unit @unitQ -unit @unitR -unit @unitP1
+ # So should this?
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitQ -unit @unitR
+
+
+ifeq "$(CLEANUP)" "1"
+ $(MAKE) -s --no-print-directory clean
+endif
+
+clean :
+ $(RM) -r tmp*.d inst-* *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext)
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/all.T b/testsuite/tests/driver/multipleHomeUnits/different-db/all.T
new file mode 100644
index 0000000000..5661d6a017
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/all.T
@@ -0,0 +1,9 @@
+if config.cleanup:
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = 'CLEANUP=0'
+
+test('different-db',
+ extra_files(['p/', 'q/', 'r/', 'p1/', 'unitP', 'unitQ', 'unitR', 'unitP1', 'Setup.hs']),
+ run_command,
+ ['$MAKE -s --no-print-directory different-db ' + cleanup])
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/different-db.stdout b/testsuite/tests/driver/multipleHomeUnits/different-db/different-db.stdout
new file mode 100644
index 0000000000..6d8e683223
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/different-db.stdout
@@ -0,0 +1,10 @@
+[1 of 2] Compiling P[p-0.1.0.0]
+[2 of 2] Compiling Q[q-0.1.0.0]
+[1 of 2] Compiling P[p1-0.1.0.0]
+[2 of 2] Compiling R[r-0.1.0.0]
+[1 of 4] Compiling P[p-0.1.0.0]
+[2 of 4] Compiling P[p1-0.1.0.0]
+[3 of 4] Compiling Q[q-0.1.0.0]
+[4 of 4] Compiling R[r-0.1.0.0]
+[1 of 2] Compiling Q[q-0.1.0.0]
+[2 of 2] Compiling R[r-0.1.0.0]
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/p/P.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/p/P.hs
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/p/P.hs
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/p/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/p/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/p/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/p/p.cabal b/testsuite/tests/driver/multipleHomeUnits/different-db/p/p.cabal
new file mode 100644
index 0000000000..b0113ee1f1
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/p/p.cabal
@@ -0,0 +1,11 @@
+name: p
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: P
+ build-depends: base
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/p1/P.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/p1/P.hs
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/p1/P.hs
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/p1/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/p1/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/p1/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/p1/p1.cabal b/testsuite/tests/driver/multipleHomeUnits/different-db/p1/p1.cabal
new file mode 100644
index 0000000000..62094863b1
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/p1/p1.cabal
@@ -0,0 +1,11 @@
+name: p1
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: P
+ build-depends: base
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/q/Q.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/q/Q.hs
new file mode 100644
index 0000000000..8c7bcdc87b
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/q/Q.hs
@@ -0,0 +1,2 @@
+module Q where
+import P
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/q/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/q/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/q/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/q/q.cabal b/testsuite/tests/driver/multipleHomeUnits/different-db/q/q.cabal
new file mode 100644
index 0000000000..874f392569
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/q/q.cabal
@@ -0,0 +1,11 @@
+name: q
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: Q
+ build-depends: base, p
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/r/R.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/r/R.hs
new file mode 100644
index 0000000000..d0701f9647
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/r/R.hs
@@ -0,0 +1,2 @@
+module R where
+import P
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/r/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/different-db/r/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/r/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/r/r.cabal b/testsuite/tests/driver/multipleHomeUnits/different-db/r/r.cabal
new file mode 100644
index 0000000000..b2e8b1c92f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/r/r.cabal
@@ -0,0 +1,11 @@
+name: r
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: R
+ build-depends: base, p1
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/unitP b/testsuite/tests/driver/multipleHomeUnits/different-db/unitP
new file mode 100644
index 0000000000..7b3b088b7e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/unitP
@@ -0,0 +1 @@
+-working-dir p P -i -i. -package-db ../tmp.d -this-unit-id p-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/unitP1 b/testsuite/tests/driver/multipleHomeUnits/different-db/unitP1
new file mode 100644
index 0000000000..2aaa451ea4
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/unitP1
@@ -0,0 +1 @@
+-working-dir p1 P -i -i. -package-db ../tmp.d -this-unit-id p1-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/unitQ b/testsuite/tests/driver/multipleHomeUnits/different-db/unitQ
new file mode 100644
index 0000000000..dcd9ae059a
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/unitQ
@@ -0,0 +1 @@
+-working-dir q Q -i -i. -package-db ../tmp.d -this-unit-id q-0.1.0.0 -package-id p-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/different-db/unitR b/testsuite/tests/driver/multipleHomeUnits/different-db/unitR
new file mode 100644
index 0000000000..5317759b65
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/different-db/unitR
@@ -0,0 +1 @@
+-working-dir r R -i -i. -package-db ../tmp1.d -this-unit-id r-0.1.0.0 -package-id p1-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/e/E.hs b/testsuite/tests/driver/multipleHomeUnits/e/E.hs
new file mode 100644
index 0000000000..8728a5f758
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/e/E.hs
@@ -0,0 +1,10 @@
+module E where
+
+-- Depends on another home unit B
+import B
+-- Depends on a package
+import Control.Applicative
+
+e = b
+
+e' = show B
diff --git a/testsuite/tests/driver/multipleHomeUnits/hi-dir/Makefile b/testsuite/tests/driver/multipleHomeUnits/hi-dir/Makefile
new file mode 100644
index 0000000000..82606c1d70
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/hi-dir/Makefile
@@ -0,0 +1,12 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+checkExists = [ -d $1 ] || echo $1 missing
+checkNotExists = [ ! -d $1 ] || echo $1 not missing
+
+mhu-hidir:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -unit @unitP1 -v0
+ $(call checkNotExists,dist)
+ $(call checkExists, p1/dist)
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/hi-dir/all.T b/testsuite/tests/driver/multipleHomeUnits/hi-dir/all.T
new file mode 100644
index 0000000000..0dcb2fb607
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/hi-dir/all.T
@@ -0,0 +1,6 @@
+# This test checks that getRootSummary doesn't cross package boundaries.
+test('multipleHomeUnits_hidir'
+ , [extra_files([ 'p1/', 'unitP1'])
+ ]
+ , makefile_test
+ , ['mhu-hidir'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/hi-dir/p1/Main.hs b/testsuite/tests/driver/multipleHomeUnits/hi-dir/p1/Main.hs
new file mode 100644
index 0000000000..de106fe48f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/hi-dir/p1/Main.hs
@@ -0,0 +1,3 @@
+module Main where
+
+main = return ()
diff --git a/testsuite/tests/driver/multipleHomeUnits/hi-dir/unitP1 b/testsuite/tests/driver/multipleHomeUnits/hi-dir/unitP1
new file mode 100644
index 0000000000..54fc79a25c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/hi-dir/unitP1
@@ -0,0 +1 @@
+-working-dir p1 Main -this-unit-id p1-0 -this-package-name p1 -hidir dist
diff --git a/testsuite/tests/driver/multipleHomeUnits/instance-vis/all.T b/testsuite/tests/driver/multipleHomeUnits/instance-vis/all.T
new file mode 100644
index 0000000000..81737c1f9c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/all.T
@@ -0,0 +1 @@
+test('multipleHomeUnits_instance-vis', [extra_files([ 'p1/', 'p2', 'q', 'unitP1', 'unitP2', 'unitQ'])], multiunit_compile, [['unitP1', 'unitP2', 'unitQ'], '-fhide-source-paths'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/instance-vis/multipleHomeUnits_instance-vis.stderr b/testsuite/tests/driver/multipleHomeUnits/instance-vis/multipleHomeUnits_instance-vis.stderr
new file mode 100644
index 0000000000..89b10089dd
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/multipleHomeUnits_instance-vis.stderr
@@ -0,0 +1,3 @@
+[1 of 3] Compiling P[p1-0]
+[2 of 3] Compiling P[p2-0]
+[3 of 3] Compiling Q[q-0]
diff --git a/testsuite/tests/driver/multipleHomeUnits/instance-vis/p1/P.hs b/testsuite/tests/driver/multipleHomeUnits/instance-vis/p1/P.hs
new file mode 100644
index 0000000000..bb4fc0ff7d
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/p1/P.hs
@@ -0,0 +1,7 @@
+module P where
+
+class Test x where
+ test :: x -> x
+
+data P = P
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/instance-vis/p2/P.hs b/testsuite/tests/driver/multipleHomeUnits/instance-vis/p2/P.hs
new file mode 100644
index 0000000000..155d965f67
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/p2/P.hs
@@ -0,0 +1,11 @@
+-- The same as the module in p1, but doesn't contain an instance
+module P where
+
+class Test x where
+ test :: x -> x
+
+data P = P
+
+instance Test P where
+ test = id
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/instance-vis/q/Q.hs b/testsuite/tests/driver/multipleHomeUnits/instance-vis/q/Q.hs
new file mode 100644
index 0000000000..950585bf38
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/q/Q.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE PackageImports #-}
+module Q where
+
+import "p2" P
+
+q = test P
diff --git a/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitP1 b/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitP1
new file mode 100644
index 0000000000..785cdd963d
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitP1
@@ -0,0 +1 @@
+-working-dir p1 P -this-unit-id p1-0 -this-package-name p1
diff --git a/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitP2 b/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitP2
new file mode 100644
index 0000000000..26d789c44f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitP2
@@ -0,0 +1 @@
+-working-dir p2 P -this-unit-id p2-0 -this-package-name p2
diff --git a/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitQ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitQ
new file mode 100644
index 0000000000..7c7422014c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/instance-vis/unitQ
@@ -0,0 +1 @@
+-working-dir q Q -this-unit-id q-0 -this-package-name q -package-id p1-0 -package-id p2-0
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/Makefile b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/Makefile
new file mode 100644
index 0000000000..ff67f37808
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/Makefile
@@ -0,0 +1,41 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP=../Setup -v0
+
+mhu-closure: clean
+ $(MAKE) -s --no-print-directory clean
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
+ cd p && $(SETUP) clean
+ cd p && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --ipid=p-0.1.0.0 --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
+ cd p && $(SETUP) build
+ cd p && $(SETUP) register --inplace
+ cd q && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --ipid=q-0.1.0.0 --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
+ cd q && $(SETUP) build
+ cd q && $(SETUP) register --inplace
+ cd r && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --ipid=r-0.1.0.0 --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d
+ cd r && $(SETUP) build
+ cd r && $(SETUP) register --inplace
+ # This should work
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP
+ # So should this
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP -unit @unitQ
+ # So should this
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP -unit @unitQ -unit @unitR
+ # This should error with a closure message
+ ! '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP -unit @unitR
+ # This should work, even though r1 is not in the package db
+ '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP -unit @unitQ -unit @unitR1
+ # This should fail, even though r1 is not in the package db
+ ! '$(TEST_HC)' $(TEST_HC_OPTS) -fhide-source-paths -fforce-recomp -unit @unitP -unit @unitR1
+
+
+ifeq "$(CLEANUP)" "1"
+ $(MAKE) -s --no-print-directory clean
+endif
+
+clean :
+ $(RM) -r tmp*.d inst-* *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext)
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/all.T b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/all.T
new file mode 100644
index 0000000000..16fb06efa9
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/all.T
@@ -0,0 +1,9 @@
+if config.cleanup:
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = 'CLEANUP=0'
+
+test('mhu-closure',
+ extra_files(['p/', 'q/', 'r/', 'r1/', 'unitP', 'unitQ', 'unitR', 'unitR1', 'Setup.hs']),
+ run_command,
+ ['$MAKE -s --no-print-directory mhu-closure ' + cleanup])
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stderr b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stderr
new file mode 100644
index 0000000000..115d141070
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stderr
@@ -0,0 +1,10 @@
+
+<command line>: error:
+ Home units are not closed.
+ It is necessary to also load the following units:
+ - q-0.1.0.0
+
+<command line>: error:
+ Home units are not closed.
+ It is necessary to also load the following units:
+ - q-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stdout b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stdout
new file mode 100644
index 0000000000..0afbe831dc
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/mhu-closure.stdout
@@ -0,0 +1,9 @@
+[1 of 1] Compiling P
+[1 of 2] Compiling P[p-0.1.0.0]
+[2 of 2] Compiling Q[q-0.1.0.0]
+[1 of 3] Compiling P[p-0.1.0.0]
+[2 of 3] Compiling Q[q-0.1.0.0]
+[3 of 3] Compiling R[r-0.1.0.0]
+[1 of 3] Compiling P[p-0.1.0.0]
+[2 of 3] Compiling Q[q-0.1.0.0]
+[3 of 3] Compiling R[r1-0.1.0.0]
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/P.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/P.hs
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/P.hs
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/p.cabal b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/p.cabal
new file mode 100644
index 0000000000..b0113ee1f1
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/p/p.cabal
@@ -0,0 +1,11 @@
+name: p
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: P
+ build-depends: base
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/Q.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/Q.hs
new file mode 100644
index 0000000000..8c7bcdc87b
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/Q.hs
@@ -0,0 +1,2 @@
+module Q where
+import P
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/q.cabal b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/q.cabal
new file mode 100644
index 0000000000..874f392569
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/q/q.cabal
@@ -0,0 +1,11 @@
+name: q
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: Q
+ build-depends: base, p
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/R.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/R.hs
new file mode 100644
index 0000000000..01f057a907
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/R.hs
@@ -0,0 +1,2 @@
+module R where
+import Q
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/r.cabal b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/r.cabal
new file mode 100644
index 0000000000..2a9e09cab0
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r/r.cabal
@@ -0,0 +1,11 @@
+name: r
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: R
+ build-depends: base, q
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/R.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/R.hs
new file mode 100644
index 0000000000..01f057a907
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/R.hs
@@ -0,0 +1,2 @@
+module R where
+import Q
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/Setup.hs b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/r1.cabal b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/r1.cabal
new file mode 100644
index 0000000000..b87a73276e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/r1/r1.cabal
@@ -0,0 +1,11 @@
+name: r1
+version: 0.1.0.0
+author: Edward Z. Yang
+maintainer: ezyang@cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.10
+
+library
+ exposed-modules: R
+ build-depends: base, q
+ default-language: Haskell2010
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitP b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitP
new file mode 100644
index 0000000000..7b3b088b7e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitP
@@ -0,0 +1 @@
+-working-dir p P -i -i. -package-db ../tmp.d -this-unit-id p-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitQ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitQ
new file mode 100644
index 0000000000..dcd9ae059a
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitQ
@@ -0,0 +1 @@
+-working-dir q Q -i -i. -package-db ../tmp.d -this-unit-id q-0.1.0.0 -package-id p-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitR b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitR
new file mode 100644
index 0000000000..2535bd7d14
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitR
@@ -0,0 +1 @@
+-working-dir r R -i -i. -package-db ../tmp.d -this-unit-id r-0.1.0.0 -package-id q-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitR1 b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitR1
new file mode 100644
index 0000000000..9bb366c78e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/mhu-closure/unitR1
@@ -0,0 +1 @@
+-working-dir r1 R -i -i. -package-db ../tmp.d -this-unit-id r1-0.1.0.0 -package-id q-0.1.0.0
diff --git a/testsuite/tests/driver/multipleHomeUnits/module-visibility-import/MV.hs b/testsuite/tests/driver/multipleHomeUnits/module-visibility-import/MV.hs
new file mode 100644
index 0000000000..9fcfb91652
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/module-visibility-import/MV.hs
@@ -0,0 +1,5 @@
+module MV where
+
+import MV1
+-- Should fail as MV2 is not visible externally.
+import MV2
diff --git a/testsuite/tests/driver/multipleHomeUnits/module-visibility/MV1.hs b/testsuite/tests/driver/multipleHomeUnits/module-visibility/MV1.hs
new file mode 100644
index 0000000000..904bfa5b96
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/module-visibility/MV1.hs
@@ -0,0 +1 @@
+module MV1 where
diff --git a/testsuite/tests/driver/multipleHomeUnits/module-visibility/MV2.hs b/testsuite/tests/driver/multipleHomeUnits/module-visibility/MV2.hs
new file mode 100644
index 0000000000..7b8be20a5a
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/module-visibility/MV2.hs
@@ -0,0 +1 @@
+module MV2 where
diff --git a/testsuite/tests/driver/multipleHomeUnits/multiGHCi.script b/testsuite/tests/driver/multipleHomeUnits/multiGHCi.script
new file mode 100644
index 0000000000..f4fd0056d5
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multiGHCi.script
@@ -0,0 +1,2 @@
+:r
+:l abc
diff --git a/testsuite/tests/driver/multipleHomeUnits/multiGHCi.stderr b/testsuite/tests/driver/multipleHomeUnits/multiGHCi.stderr
new file mode 100644
index 0000000000..5829562213
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multiGHCi.stderr
@@ -0,0 +1 @@
+Command is not supported (yet) in multi-mode
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits001.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits001.stderr
new file mode 100644
index 0000000000..6d018258a0
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits001.stderr
@@ -0,0 +1,2 @@
+[1 of 2] Compiling A[a]
+[2 of 2] Compiling B[b]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits001.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits001.stdout
new file mode 100644
index 0000000000..f3121c04e6
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits001.stdout
@@ -0,0 +1,2 @@
+[1 of 2] Compiling A ( a/A.hs, a/A.o )[a]
+[2 of 2] Compiling B ( b/B.hs, b/B.o )[b]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits002.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits002.stdout
new file mode 100644
index 0000000000..5c1736d41e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits002.stdout
@@ -0,0 +1,6 @@
+[1 of 4] Compiling Main[c]
+[2 of 4] Compiling Main[d]
+[3 of 4] Linking ./c/C[c]
+[4 of 4] Linking ./d/D[d]
+unit C compiled successfully
+unit D compiled successfully
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits003.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits003.stdout
new file mode 100644
index 0000000000..8369f9246e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits003.stdout
@@ -0,0 +1,8 @@
+[1 of 6] Compiling A[a]
+[2 of 6] Compiling B[b]
+[3 of 6] Compiling Main[c]
+[4 of 6] Compiling Main[d]
+[5 of 6] Linking ./c/C[c]
+[6 of 6] Linking ./d/D[d]
+unit C compiled successfully
+unit D compiled successfully
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004.stderr
new file mode 100644
index 0000000000..ea843cb688
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004.stderr
@@ -0,0 +1,2 @@
+[1 of 2] Compiling B[b]
+[2 of 2] Compiling E[e]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004.stdout
new file mode 100644
index 0000000000..6168f3a0d2
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004.stdout
@@ -0,0 +1,2 @@
+[1 of 2] Compiling B ( b/B.hs, b/B.o )[b]
+[2 of 2] Compiling E ( e/E.hs, e/E.o )[e]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004_recomp.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004_recomp.stdout
new file mode 100644
index 0000000000..ea843cb688
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits004_recomp.stdout
@@ -0,0 +1,2 @@
+[1 of 2] Compiling B[b]
+[2 of 2] Compiling E[e]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stderr
new file mode 100644
index 0000000000..b1cd097d13
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stderr
@@ -0,0 +1,5 @@
+
+module-visibility-import/MV.hs:5:1: error:
+ Could not load module ‘MV2’
+ it is a hidden module in the package ‘mv’
+ Use -v (or `:set -v` in ghci) to see a list of the files searched for.
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stdout
new file mode 100644
index 0000000000..3120a98467
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stdout
@@ -0,0 +1,3 @@
+[1 of 3] Compiling MV1[mv]
+[2 of 3] Compiling MV[mvi]
+[3 of 3] Compiling MV2[mv]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsPackageImports.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsPackageImports.stderr
new file mode 100644
index 0000000000..9b05b03e0c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsPackageImports.stderr
@@ -0,0 +1,3 @@
+[1 of 3] Compiling B[b]
+[2 of 3] Compiling B[b2]
+[3 of 3] Compiling P[p]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsPackageImports.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsPackageImports.stdout
new file mode 100644
index 0000000000..5f37c20671
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsPackageImports.stdout
@@ -0,0 +1,3 @@
+[1 of 3] Compiling B ( b/B.hs, b/B.o )[b]
+[2 of 3] Compiling B ( b2/B.hs, b2/B.o )[b2]
+[3 of 3] Compiling P ( package-imports/P.hs, package-imports/P.o )[p]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_callstack.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_callstack.stderr
new file mode 100644
index 0000000000..0d7d75b1ee
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_callstack.stderr
@@ -0,0 +1,3 @@
+Main: test
+CallStack (from HasCallStack):
+ error, called at callstack/./Main.hs:4:8 in main:Main
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cfile.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cfile.stderr
new file mode 100644
index 0000000000..e6c27f93f2
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cfile.stderr
@@ -0,0 +1 @@
+[1 of 1] Compiling C
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cpp.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cpp.stderr
new file mode 100644
index 0000000000..01e308dcdb
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cpp.stderr
@@ -0,0 +1,2 @@
+[1 of 2] Compiling CPPIncludes_Down
+[2 of 2] Compiling CPPIncludes
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cpp2.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cpp2.stderr
new file mode 100644
index 0000000000..158f3ed0cb
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_cpp2.stderr
@@ -0,0 +1,3 @@
+[1 of 3] Compiling CPPIncludes_Down[cpp]
+[2 of 3] Compiling CPPIncludes[cpp]
+[3 of 3] Compiling M[cpp-import]
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single1.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single1.stderr
new file mode 100644
index 0000000000..2c01f0ed7d
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single1.stderr
@@ -0,0 +1 @@
+[1 of 1] Compiling A
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single1.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single1.stdout
new file mode 100644
index 0000000000..eb2bcb2e30
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single1.stdout
@@ -0,0 +1 @@
+[1 of 1] Compiling A ( a/A.hs, a/A.o )
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single2.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single2.stderr
new file mode 100644
index 0000000000..cbfbd65e52
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single2.stderr
@@ -0,0 +1 @@
+[1 of 1] Compiling B
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single2.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single2.stdout
new file mode 100644
index 0000000000..e048444c9c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single2.stdout
@@ -0,0 +1 @@
+[1 of 1] Compiling B ( b/B.hs, b/B.o )
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single3.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single3.stderr
new file mode 100644
index 0000000000..e964210090
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single3.stderr
@@ -0,0 +1,2 @@
+[1 of 2] Compiling Main
+[2 of 2] Linking ./c/C
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single3.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single3.stdout
new file mode 100644
index 0000000000..fcb27f53a8
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single3.stdout
@@ -0,0 +1,3 @@
+[1 of 2] Compiling Main ( c/C.hs, c/C.o )
+[2 of 2] Linking ./c/C
+unit C compiled successfully
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single4.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single4.stderr
new file mode 100644
index 0000000000..834eb4c2c9
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single4.stderr
@@ -0,0 +1,2 @@
+[1 of 2] Compiling Main
+[2 of 2] Linking ./d/D
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single4.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single4.stdout
new file mode 100644
index 0000000000..b6f255ae82
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single4.stdout
@@ -0,0 +1,3 @@
+[1 of 2] Compiling Main ( d/C.hs, d/C.o )
+[2 of 2] Linking ./d/D
+unit D compiled successfully
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single5.stderr b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single5.stderr
new file mode 100644
index 0000000000..02e1312bf0
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single5.stderr
@@ -0,0 +1 @@
+[1 of 1] Compiling TH
diff --git a/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single5.stdout b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single5.stdout
new file mode 100644
index 0000000000..f0e62c8a55
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_single5.stdout
@@ -0,0 +1 @@
+[1 of 1] Compiling TH ( th/TH.hs, th/TH.o, th/TH.dyn_o )
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-dir/Makefile b/testsuite/tests/driver/multipleHomeUnits/o-dir/Makefile
new file mode 100644
index 0000000000..3389ecbe36
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-dir/Makefile
@@ -0,0 +1,12 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+checkExists = [ -d $1 ] || echo $1 missing
+checkNotExists = [ ! -d $1 ] || echo $1 not missing
+
+mhu-odir:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -unit @unitP1 -v0
+ $(call checkNotExists,dist)
+ $(call checkExists, p1/dist)
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-dir/all.T b/testsuite/tests/driver/multipleHomeUnits/o-dir/all.T
new file mode 100644
index 0000000000..9e3d92dedc
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-dir/all.T
@@ -0,0 +1,6 @@
+# This test checks that getRootSummary doesn't cross package boundaries.
+test('multipleHomeUnits_odir'
+ , [extra_files([ 'p1/', 'unitP1'])
+ ]
+ , makefile_test
+ , ['mhu-odir'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-dir/p1/Main.hs b/testsuite/tests/driver/multipleHomeUnits/o-dir/p1/Main.hs
new file mode 100644
index 0000000000..de106fe48f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-dir/p1/Main.hs
@@ -0,0 +1,3 @@
+module Main where
+
+main = return ()
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-dir/unitP1 b/testsuite/tests/driver/multipleHomeUnits/o-dir/unitP1
new file mode 100644
index 0000000000..6fd7f37bf5
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-dir/unitP1
@@ -0,0 +1 @@
+-working-dir p1 Main -this-unit-id p1-0 -this-package-name p1 -odir dist
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-files/Makefile b/testsuite/tests/driver/multipleHomeUnits/o-files/Makefile
new file mode 100644
index 0000000000..5d1c975f05
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-files/Makefile
@@ -0,0 +1,7 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+setup:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c p1/hello.c
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-files/all.T b/testsuite/tests/driver/multipleHomeUnits/o-files/all.T
new file mode 100644
index 0000000000..0133545ea9
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-files/all.T
@@ -0,0 +1,6 @@
+# This test checks that getRootSummary doesn't cross package boundaries.
+test('multipleHomeUnits_o-files'
+ , [extra_files([ 'p1/', 'unitP1'])
+ , pre_cmd('$MAKE -s --no-print-directory setup')]
+ , multiunit_compile
+ , [['unitP1'], '-fhide-source-paths'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-files/multipleHomeUnits_o-files.stderr b/testsuite/tests/driver/multipleHomeUnits/o-files/multipleHomeUnits_o-files.stderr
new file mode 100644
index 0000000000..9310e7f32a
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-files/multipleHomeUnits_o-files.stderr
@@ -0,0 +1,2 @@
+[1 of 2] Compiling Main
+[2 of 2] Linking p1/./Main
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-files/p1/Main.hs b/testsuite/tests/driver/multipleHomeUnits/o-files/p1/Main.hs
new file mode 100644
index 0000000000..de106fe48f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-files/p1/Main.hs
@@ -0,0 +1,3 @@
+module Main where
+
+main = return ()
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-files/p1/hello.c b/testsuite/tests/driver/multipleHomeUnits/o-files/p1/hello.c
new file mode 100644
index 0000000000..98119643a7
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-files/p1/hello.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int foo()
+{
+ return 0;
+}
diff --git a/testsuite/tests/driver/multipleHomeUnits/o-files/unitP1 b/testsuite/tests/driver/multipleHomeUnits/o-files/unitP1
new file mode 100644
index 0000000000..2f65369383
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/o-files/unitP1
@@ -0,0 +1 @@
+-working-dir p1 Main -this-unit-id p1-0 -this-package-name p1 hello.o
diff --git a/testsuite/tests/driver/multipleHomeUnits/package-imports/P.hs b/testsuite/tests/driver/multipleHomeUnits/package-imports/P.hs
new file mode 100644
index 0000000000..1f73f9804b
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/package-imports/P.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE PackageImports #-}
+module P where
+
+import "b" B
diff --git a/testsuite/tests/driver/multipleHomeUnits/pi-roots/all.T b/testsuite/tests/driver/multipleHomeUnits/pi-roots/all.T
new file mode 100644
index 0000000000..4c188955c1
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/pi-roots/all.T
@@ -0,0 +1,2 @@
+# This test checks that getRootSummary doesn't cross package boundaries.
+test('multipleHomeUnits_pi_duplicate', [extra_files([ 'p1/', 'p2', 'unitP1', 'unitP2'])], multiunit_compile, [['unitP1', 'unitP2'], '-fhide-source-paths'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/pi-roots/multipleHomeUnits_pi_duplicate.stderr b/testsuite/tests/driver/multipleHomeUnits/pi-roots/multipleHomeUnits_pi_duplicate.stderr
new file mode 100644
index 0000000000..7c57f70a9e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/pi-roots/multipleHomeUnits_pi_duplicate.stderr
@@ -0,0 +1,3 @@
+[1 of 3] Compiling P[p1-0]
+[2 of 3] Compiling P[p2-0]
+[3 of 3] Compiling Q[p2-0]
diff --git a/testsuite/tests/driver/multipleHomeUnits/pi-roots/p1/P.hs b/testsuite/tests/driver/multipleHomeUnits/pi-roots/p1/P.hs
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/pi-roots/p1/P.hs
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/driver/multipleHomeUnits/pi-roots/p2/P.hs b/testsuite/tests/driver/multipleHomeUnits/pi-roots/p2/P.hs
new file mode 100644
index 0000000000..a007978103
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/pi-roots/p2/P.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE PackageImports #-}
+module P where
+
+import "p1" P
diff --git a/testsuite/tests/driver/multipleHomeUnits/pi-roots/p2/Q.hs b/testsuite/tests/driver/multipleHomeUnits/pi-roots/p2/Q.hs
new file mode 100644
index 0000000000..bfca0886ea
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/pi-roots/p2/Q.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE PackageImports #-}
+module Q where
+
+import "this" P
diff --git a/testsuite/tests/driver/multipleHomeUnits/pi-roots/unitP1 b/testsuite/tests/driver/multipleHomeUnits/pi-roots/unitP1
new file mode 100644
index 0000000000..785cdd963d
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/pi-roots/unitP1
@@ -0,0 +1 @@
+-working-dir p1 P -this-unit-id p1-0 -this-package-name p1
diff --git a/testsuite/tests/driver/multipleHomeUnits/pi-roots/unitP2 b/testsuite/tests/driver/multipleHomeUnits/pi-roots/unitP2
new file mode 100644
index 0000000000..8f6966eee4
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/pi-roots/unitP2
@@ -0,0 +1 @@
+-working-dir p2 P Q -this-unit-id p2-0 -this-package-name p2 -package-id p1-0
diff --git a/testsuite/tests/driver/multipleHomeUnits/reexport/all.T b/testsuite/tests/driver/multipleHomeUnits/reexport/all.T
new file mode 100644
index 0000000000..9faa9e7a51
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/reexport/all.T
@@ -0,0 +1,2 @@
+# This test checks that getRootSummary doesn't cross package boundaries.
+test('multipleHomeUnits_reexport', [extra_files([ 'p1/', 'p2/', 'unitP1', 'unitP2'])], multiunit_compile, [['unitP1', 'unitP2'], '-v0 -fhide-source-paths'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/reexport/p1/P.hs b/testsuite/tests/driver/multipleHomeUnits/reexport/p1/P.hs
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/reexport/p1/P.hs
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/driver/multipleHomeUnits/reexport/p2/Q.hs b/testsuite/tests/driver/multipleHomeUnits/reexport/p2/Q.hs
new file mode 100644
index 0000000000..5d66f6fe48
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/reexport/p2/Q.hs
@@ -0,0 +1,3 @@
+module Q where
+
+import Data.Text
diff --git a/testsuite/tests/driver/multipleHomeUnits/reexport/unitP1 b/testsuite/tests/driver/multipleHomeUnits/reexport/unitP1
new file mode 100644
index 0000000000..59036e4a55
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/reexport/unitP1
@@ -0,0 +1 @@
+-working-dir p1 P -this-unit-id p1-0 -package text -this-package-name p1 -reexported-module Data.Text
diff --git a/testsuite/tests/driver/multipleHomeUnits/reexport/unitP2 b/testsuite/tests/driver/multipleHomeUnits/reexport/unitP2
new file mode 100644
index 0000000000..aac500965e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/reexport/unitP2
@@ -0,0 +1 @@
+-working-dir p2 Q -this-unit-id p2-0 -this-package-name p2 -hide-all-packages -package-id p1-0 -package base
diff --git a/testsuite/tests/driver/multipleHomeUnits/self-import/Makefile b/testsuite/tests/driver/multipleHomeUnits/self-import/Makefile
new file mode 100644
index 0000000000..ca859a602c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/self-import/Makefile
@@ -0,0 +1,9 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+multipleHomeUnits_self-import:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -unit @unitP1 -unit @unitP2 -v0
+ # This should do nothing
+ '$(TEST_HC)' $(TEST_HC_OPTS) -unit @unitP1 -unit @unitP2
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/self-import/all.T b/testsuite/tests/driver/multipleHomeUnits/self-import/all.T
new file mode 100644
index 0000000000..a772a39083
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/self-import/all.T
@@ -0,0 +1,4 @@
+# This tests that recompilation logic works if you import a module with the same
+# name
+test('multipleHomeUnits_self-import', [extra_files([ 'p1/', 'p2/', 'unitP1', 'unitP2'])], makefile_test, [])
+
diff --git a/testsuite/tests/driver/multipleHomeUnits/self-import/p1/P.hs b/testsuite/tests/driver/multipleHomeUnits/self-import/p1/P.hs
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/self-import/p1/P.hs
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/driver/multipleHomeUnits/self-import/p2/P.hs b/testsuite/tests/driver/multipleHomeUnits/self-import/p2/P.hs
new file mode 100644
index 0000000000..a007978103
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/self-import/p2/P.hs
@@ -0,0 +1,4 @@
+{-# LANGUAGE PackageImports #-}
+module P where
+
+import "p1" P
diff --git a/testsuite/tests/driver/multipleHomeUnits/self-import/unitP1 b/testsuite/tests/driver/multipleHomeUnits/self-import/unitP1
new file mode 100644
index 0000000000..785cdd963d
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/self-import/unitP1
@@ -0,0 +1 @@
+-working-dir p1 P -this-unit-id p1-0 -this-package-name p1
diff --git a/testsuite/tests/driver/multipleHomeUnits/self-import/unitP2 b/testsuite/tests/driver/multipleHomeUnits/self-import/unitP2
new file mode 100644
index 0000000000..64d62d01e2
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/self-import/unitP2
@@ -0,0 +1 @@
+-working-dir p2 P -this-unit-id p2-0 -this-package-name p2 -package-id p1-0
diff --git a/testsuite/tests/driver/multipleHomeUnits/target-file-path/all.T b/testsuite/tests/driver/multipleHomeUnits/target-file-path/all.T
new file mode 100644
index 0000000000..74d9baf953
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/target-file-path/all.T
@@ -0,0 +1,6 @@
+# This test checks that getRootSummary doesn't cross package boundaries.
+test('multipleHomeUnits_target-file-path'
+ , [extra_files([ 'p1/', 'unitP1'])
+ ]
+ , multiunit_compile
+ , [['unitP1'], '-fhide-source-paths'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/target-file-path/multipleHomeUnits_target-file-path.stderr b/testsuite/tests/driver/multipleHomeUnits/target-file-path/multipleHomeUnits_target-file-path.stderr
new file mode 100644
index 0000000000..345d8d960f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/target-file-path/multipleHomeUnits_target-file-path.stderr
@@ -0,0 +1,2 @@
+[1 of 2] Compiling Main
+[2 of 2] Linking p1/Main
diff --git a/testsuite/tests/driver/multipleHomeUnits/target-file-path/p1/Main.hs b/testsuite/tests/driver/multipleHomeUnits/target-file-path/p1/Main.hs
new file mode 100644
index 0000000000..de106fe48f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/target-file-path/p1/Main.hs
@@ -0,0 +1,3 @@
+module Main where
+
+main = return ()
diff --git a/testsuite/tests/driver/multipleHomeUnits/target-file-path/unitP1 b/testsuite/tests/driver/multipleHomeUnits/target-file-path/unitP1
new file mode 100644
index 0000000000..b221fb65c2
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/target-file-path/unitP1
@@ -0,0 +1 @@
+-working-dir p1 Main.hs -this-unit-id p1-0 -this-package-name p1
diff --git a/testsuite/tests/driver/multipleHomeUnits/th-deps/all.T b/testsuite/tests/driver/multipleHomeUnits/th-deps/all.T
new file mode 100644
index 0000000000..4e89f8b296
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th-deps/all.T
@@ -0,0 +1 @@
+test('multipleHomeUnits_th-deps', [extra_files([ 'p1/', 'p2', 'q', 'unitP1', 'unitP2', 'unitQ'])], multiunit_compile, [['unitP1', 'unitP2', 'unitQ'], '-fhide-source-paths'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/th-deps/multipleHomeUnits_th-deps.stderr b/testsuite/tests/driver/multipleHomeUnits/th-deps/multipleHomeUnits_th-deps.stderr
new file mode 100644
index 0000000000..90fe8f8f3b
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th-deps/multipleHomeUnits_th-deps.stderr
@@ -0,0 +1,4 @@
+[1 of 3] Compiling P[p1-0]
+[2 of 3] Compiling P[p2-0]
+[3 of 3] Compiling Q[q-0]
+2
diff --git a/testsuite/tests/driver/multipleHomeUnits/th-deps/p1/P.hs b/testsuite/tests/driver/multipleHomeUnits/th-deps/p1/P.hs
new file mode 100644
index 0000000000..8a802e691f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th-deps/p1/P.hs
@@ -0,0 +1,3 @@
+module P where
+
+p = 1
diff --git a/testsuite/tests/driver/multipleHomeUnits/th-deps/p2/P.hs b/testsuite/tests/driver/multipleHomeUnits/th-deps/p2/P.hs
new file mode 100644
index 0000000000..13c0fbabec
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th-deps/p2/P.hs
@@ -0,0 +1,4 @@
+-- The same as the module in p1, but doesn't contain an instance
+module P where
+
+p = 2
diff --git a/testsuite/tests/driver/multipleHomeUnits/th-deps/q/Q.hs b/testsuite/tests/driver/multipleHomeUnits/th-deps/q/Q.hs
new file mode 100644
index 0000000000..2ede07e858
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th-deps/q/Q.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE PackageImports #-}
+{-# LANGUAGE TemplateHaskell #-}
+module Q where
+
+import "p2" P
+import Control.Monad.IO.Class
+import System.IO
+
+q = $(liftIO (print p >> hFlush stdout) >> [| () |])
diff --git a/testsuite/tests/driver/multipleHomeUnits/th-deps/unitP1 b/testsuite/tests/driver/multipleHomeUnits/th-deps/unitP1
new file mode 100644
index 0000000000..785cdd963d
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th-deps/unitP1
@@ -0,0 +1 @@
+-working-dir p1 P -this-unit-id p1-0 -this-package-name p1
diff --git a/testsuite/tests/driver/multipleHomeUnits/th-deps/unitP2 b/testsuite/tests/driver/multipleHomeUnits/th-deps/unitP2
new file mode 100644
index 0000000000..26d789c44f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th-deps/unitP2
@@ -0,0 +1 @@
+-working-dir p2 P -this-unit-id p2-0 -this-package-name p2
diff --git a/testsuite/tests/driver/multipleHomeUnits/th-deps/unitQ b/testsuite/tests/driver/multipleHomeUnits/th-deps/unitQ
new file mode 100644
index 0000000000..7c7422014c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th-deps/unitQ
@@ -0,0 +1 @@
+-working-dir q Q -this-unit-id q-0 -this-package-name q -package-id p1-0 -package-id p2-0
diff --git a/testsuite/tests/driver/multipleHomeUnits/th/TH.hs b/testsuite/tests/driver/multipleHomeUnits/th/TH.hs
new file mode 100644
index 0000000000..12bf9fcaf7
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th/TH.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE TemplateHaskell #-}
+module TH where
+
+import Language.Haskell.TH.Syntax
+import System.Directory
+import System.FilePath
+
+th = $(makeRelativeToProject "data" >>= runIO . readFile >> [| () |])
diff --git a/testsuite/tests/driver/multipleHomeUnits/th/data b/testsuite/tests/driver/multipleHomeUnits/th/data
new file mode 100644
index 0000000000..1269488f7f
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/th/data
@@ -0,0 +1 @@
+data
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-clash/A.hs b/testsuite/tests/driver/multipleHomeUnits/unit-clash/A.hs
new file mode 100644
index 0000000000..d843c00b78
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-clash/A.hs
@@ -0,0 +1 @@
+module A where
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-clash/B.hs b/testsuite/tests/driver/multipleHomeUnits/unit-clash/B.hs
new file mode 100644
index 0000000000..c759bc2d13
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-clash/B.hs
@@ -0,0 +1 @@
+module B where
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-clash/all.T b/testsuite/tests/driver/multipleHomeUnits/unit-clash/all.T
new file mode 100644
index 0000000000..b993ad940a
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-clash/all.T
@@ -0,0 +1,2 @@
+# This test checks for clashing home unit ids
+test('multipleHomeUnits_unit-clash', [extra_files([ 'A.hs', 'B.hs', 'unitA', 'unitB'])], multiunit_compile_fail, [['unitA', 'unitB'], '-fhide-source-paths'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-clash/multipleHomeUnits_unit-clash.stderr b/testsuite/tests/driver/multipleHomeUnits/unit-clash/multipleHomeUnits_unit-clash.stderr
new file mode 100644
index 0000000000..eb67b49d70
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-clash/multipleHomeUnits_unit-clash.stderr
@@ -0,0 +1,3 @@
+<command line>: Multiple units with the same unit-id:
+ - main defined in @unitB
+ - main defined in @unitA
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-clash/unitA b/testsuite/tests/driver/multipleHomeUnits/unit-clash/unitA
new file mode 100644
index 0000000000..f70f10e4db
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-clash/unitA
@@ -0,0 +1 @@
+A
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-clash/unitB b/testsuite/tests/driver/multipleHomeUnits/unit-clash/unitB
new file mode 100644
index 0000000000..223b7836fb
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-clash/unitB
@@ -0,0 +1 @@
+B
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-cycles/all.T b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/all.T
new file mode 100644
index 0000000000..9d867e0254
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/all.T
@@ -0,0 +1,2 @@
+# This test checks that cycles between units are not allowed.
+test('multipleHomeUnits_unit-cycles', [extra_files([ 'p1/', 'p2/', 'unitP1', 'unitP2'])], multiunit_compile_fail, [['unitP1', 'unitP2'], '-fhide-source-paths'])
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-cycles/multipleHomeUnits_unit-cycles.stderr b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/multipleHomeUnits_unit-cycles.stderr
new file mode 100644
index 0000000000..8984264b40
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/multipleHomeUnits_unit-cycles.stderr
@@ -0,0 +1,3 @@
+<command line>: Units form a dependency cycle:
+ - p1-0 depends on
+ - p2-0
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-cycles/p1/P.hs b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/p1/P.hs
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/p1/P.hs
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-cycles/p2/P.hs b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/p2/P.hs
new file mode 100644
index 0000000000..fc4877ad85
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/p2/P.hs
@@ -0,0 +1 @@
+module P where
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-cycles/unitP1 b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/unitP1
new file mode 100644
index 0000000000..df9b3b72af
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/unitP1
@@ -0,0 +1 @@
+-working-dir p1 P -this-unit-id p1-0 -this-package-name p1 -package-id p2-0
diff --git a/testsuite/tests/driver/multipleHomeUnits/unit-cycles/unitP2 b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/unitP2
new file mode 100644
index 0000000000..64d62d01e2
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unit-cycles/unitP2
@@ -0,0 +1 @@
+-working-dir p2 P -this-unit-id p2-0 -this-package-name p2 -package-id p1-0
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitA b/testsuite/tests/driver/multipleHomeUnits/unitA
new file mode 100644
index 0000000000..e895fcde79
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitA
@@ -0,0 +1 @@
+-i -i./a A -this-unit-id a
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitB b/testsuite/tests/driver/multipleHomeUnits/unitB
new file mode 100644
index 0000000000..2dc46fd64e
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitB
@@ -0,0 +1 @@
+-i -i./b B -this-unit-id b -this-package-name b
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitB2 b/testsuite/tests/driver/multipleHomeUnits/unitB2
new file mode 100644
index 0000000000..a0ef2f8e7c
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitB2
@@ -0,0 +1 @@
+-i -i. -working-dir=b2 B -this-unit-id b2 -this-package-name b2
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitC b/testsuite/tests/driver/multipleHomeUnits/unitC
new file mode 100644
index 0000000000..b0397e814b
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitC
@@ -0,0 +1 @@
+-i c/C.hs -o ./c/C -this-unit-id c
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitCFile b/testsuite/tests/driver/multipleHomeUnits/unitCFile
new file mode 100644
index 0000000000..751d981fd2
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitCFile
@@ -0,0 +1 @@
+-working-dir c-file C c-file/c.c -Iinclude
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitCPPImport b/testsuite/tests/driver/multipleHomeUnits/unitCPPImport
new file mode 100644
index 0000000000..3bdd7a0123
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitCPPImport
@@ -0,0 +1 @@
+-i -i. -working-dir=cpp-import M -this-unit-id cpp-import -package-id cpp
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitCPPIncludes b/testsuite/tests/driver/multipleHomeUnits/unitCPPIncludes
new file mode 100644
index 0000000000..4f23e974a1
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitCPPIncludes
@@ -0,0 +1 @@
+-i -i. -working-dir=cpp-includes CPPIncludes -this-unit-id cpp -Iinclude -optP-include -optPinclude/header2.h
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitCallstack b/testsuite/tests/driver/multipleHomeUnits/unitCallstack
new file mode 100644
index 0000000000..fe8223bba0
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitCallstack
@@ -0,0 +1 @@
+-working-dir callstack Main
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitD b/testsuite/tests/driver/multipleHomeUnits/unitD
new file mode 100644
index 0000000000..e7c3387599
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitD
@@ -0,0 +1 @@
+-i d/C.hs -o ./d/D -this-unit-id d
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitE b/testsuite/tests/driver/multipleHomeUnits/unitE
new file mode 100644
index 0000000000..2a85ab3618
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitE
@@ -0,0 +1 @@
+-i -i./e E -this-unit-id e -package-id b
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitMV b/testsuite/tests/driver/multipleHomeUnits/unitMV
new file mode 100644
index 0000000000..bdbf58ba62
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitMV
@@ -0,0 +1 @@
+-i -i. -working-dir=module-visibility MV1 MV2 -this-unit-id mv -hidden-module MV2
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitMV-import b/testsuite/tests/driver/multipleHomeUnits/unitMV-import
new file mode 100644
index 0000000000..1873edb0a3
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitMV-import
@@ -0,0 +1 @@
+-i -i. -working-dir=module-visibility-import MV -this-unit-id mvi -package-id mv
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitPI b/testsuite/tests/driver/multipleHomeUnits/unitPI
new file mode 100644
index 0000000000..72469be015
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitPI
@@ -0,0 +1 @@
+-i -i. -working-dir=package-imports P -this-unit-id p -package-id b -package-id b2
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitTH b/testsuite/tests/driver/multipleHomeUnits/unitTH
new file mode 100644
index 0000000000..659dd4d6f4
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitTH
@@ -0,0 +1 @@
+-i -i. -working-dir=th TH -this-unit-id th -package filepath -package directory
diff --git a/testsuite/tests/driver/multipleHomeUnits/unitTH1 b/testsuite/tests/driver/multipleHomeUnits/unitTH1
new file mode 100644
index 0000000000..85f7005b62
--- /dev/null
+++ b/testsuite/tests/driver/multipleHomeUnits/unitTH1
@@ -0,0 +1 @@
+-i -i. -working-dir=th TH.hs -this-unit-id th -package filepath -package directory
diff --git a/testsuite/tests/driver/recomp007/recomp007.stdout b/testsuite/tests/driver/recomp007/recomp007.stdout
index 1160663b4d..c6b194ef17 100644
--- a/testsuite/tests/driver/recomp007/recomp007.stdout
+++ b/testsuite/tests/driver/recomp007/recomp007.stdout
@@ -1,6 +1,6 @@
"1.0"
Preprocessing executable 'test' for b-1.0..
Building executable 'test' for b-1.0..
-[1 of 2] Compiling B ( B.hs, dist/build/test/test-tmp/B.o ) [A package changed]
-Linking dist/build/test/test ...
+[1 of 3] Compiling B ( B.hs, dist/build/test/test-tmp/B.o ) [A package changed]
+[3 of 3] Linking dist/build/test/test [Objects changed]
"2.0"
diff --git a/testsuite/tests/driver/recomp011/recomp011.stdout b/testsuite/tests/driver/recomp011/recomp011.stdout
index d3e0b92508..c320549f54 100644
--- a/testsuite/tests/driver/recomp011/recomp011.stdout
+++ b/testsuite/tests/driver/recomp011/recomp011.stdout
@@ -1,10 +1,10 @@
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main
42
-[1 of 1] Compiling Main ( Main.hs, Main.o ) [B.hsinc changed]
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o ) [B.hsinc changed]
+[2 of 2] Linking Main [Objects changed]
43
-[1 of 1] Compiling Main ( Main.hs, Main.o ) [A.hsinc changed]
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o ) [A.hsinc changed]
+[2 of 2] Linking Main [Objects changed]
4343
4343
diff --git a/testsuite/tests/driver/recomp015/recomp015.stdout b/testsuite/tests/driver/recomp015/recomp015.stdout
index a7dbad203a..2de39b6c87 100644
--- a/testsuite/tests/driver/recomp015/recomp015.stdout
+++ b/testsuite/tests/driver/recomp015/recomp015.stdout
@@ -1,6 +1,6 @@
-[1 of 1] Compiling Main ( Generate.hs, Generate.o )
-Linking Generate ...
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Generate.hs, Generate.o )
+[2 of 2] Linking Generate
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main
Running main...
Running main...
diff --git a/testsuite/tests/driver/recomp019/recomp019.stdout b/testsuite/tests/driver/recomp019/recomp019.stdout
index 413dad2e0f..300fe27867 100644
--- a/testsuite/tests/driver/recomp019/recomp019.stdout
+++ b/testsuite/tests/driver/recomp019/recomp019.stdout
@@ -1,11 +1,11 @@
first run
-[1 of 3] Compiling B ( B.hs, B.o )
-[2 of 3] Compiling C ( C.hs, C.o )
-[3 of 3] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 4] Compiling B ( B.hs, B.o )
+[2 of 4] Compiling C ( C.hs, C.o )
+[3 of 4] Compiling Main ( Main.hs, Main.o )
+[4 of 4] Linking Main
5
[1 of 1] Compiling B ( B.hs, nothing ) [Source file changed]
second run
-[1 of 3] Compiling B ( B.hs, B.o ) [Missing object file]
-Linking Main ...
+[1 of 4] Compiling B ( B.hs, B.o ) [Missing object file]
+[4 of 4] Linking Main [Objects changed]
15
diff --git a/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout b/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout
index 86d6324225..ee1cbe982d 100644
--- a/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout
+++ b/testsuite/tests/driver/recompChangedPackage/recompChangedPackage.stdout
@@ -1,10 +1,10 @@
-[1 of 2] Compiling PLib ( PLib.hs, PLib.o )
-[2 of 2] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 3] Compiling PLib ( PLib.hs, PLib.o )
+[2 of 3] Compiling Main ( Main.hs, Main.o )
+[3 of 3] Linking Main
"q"
tmp.d
q-0.1.0.0
-[1 of 1] Compiling Main ( Main.hs, Main.o ) [PLib removed]
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o ) [PLib removed]
+[2 of 2] Linking Main [Objects changed]
empty
diff --git a/testsuite/tests/driver/retc001/retc001.stdout b/testsuite/tests/driver/retc001/retc001.stdout
index e5d374608e..a5bdd0597e 100644
--- a/testsuite/tests/driver/retc001/retc001.stdout
+++ b/testsuite/tests/driver/retc001/retc001.stdout
@@ -1,7 +1,7 @@
-[1 of 3] Compiling A ( A.hs, nothing )
-[2 of 3] Compiling B ( B.hs, nothing )
-[3 of 3] Compiling Main ( C.hs, nothing )
+[1 of 4] Compiling A ( A.hs, nothing )
+[2 of 4] Compiling B ( B.hs, nothing )
+[3 of 4] Compiling Main ( C.hs, nothing )
Middle
End
-[2 of 3] Compiling B ( B.hs, nothing ) [Source file changed]
-[3 of 3] Compiling Main ( C.hs, nothing ) [B changed]
+[2 of 4] Compiling B ( B.hs, nothing ) [Source file changed]
+[3 of 4] Compiling Main ( C.hs, nothing ) [B changed]
diff --git a/testsuite/tests/driver/should_fail/T10895.stderr b/testsuite/tests/driver/should_fail/T10895.stderr
index 3ae52a3ef7..ff8a380809 100644
--- a/testsuite/tests/driver/should_fail/T10895.stderr
+++ b/testsuite/tests/driver/should_fail/T10895.stderr
@@ -1,4 +1,4 @@
<no location info>: error:
- output was redirected with -o, but no output will be generated
-because there is no Main module.
+ Output was redirected with -o, but no output will be generated.
+ There is no module named ‘Main’.
diff --git a/testsuite/tests/driver/th-new-test/th-new-test.stdout b/testsuite/tests/driver/th-new-test/th-new-test.stdout
index 7f31ce608f..5de19bdd0a 100644
--- a/testsuite/tests/driver/th-new-test/th-new-test.stdout
+++ b/testsuite/tests/driver/th-new-test/th-new-test.stdout
@@ -1,17 +1,17 @@
-[1 of 5] Compiling B
-[2 of 5] Compiling A
-[3 of 5] Compiling D
-[4 of 5] Compiling C
-[5 of 5] Compiling Main
-Linking Main ...
-[1 of 5] Compiling B [Source file changed]
-[2 of 5] Compiling A [B[TH] changed]
-Linking Main ...
-[3 of 5] Compiling D [Source file changed]
-[4 of 5] Compiling C [D[TH] changed]
-Linking Main ...
-[1 of 5] Compiling B [Source file changed]
-[2 of 5] Compiling A [B[TH] changed]
-[3 of 5] Compiling D [Source file changed]
-[4 of 5] Compiling C [D[TH] changed]
-Linking Main ...
+[1 of 6] Compiling B
+[2 of 6] Compiling A
+[3 of 6] Compiling D
+[4 of 6] Compiling C
+[5 of 6] Compiling Main
+[6 of 6] Linking Main
+[1 of 6] Compiling B [Source file changed]
+[2 of 6] Compiling A [B[TH] changed]
+[6 of 6] Linking Main [Objects changed]
+[3 of 6] Compiling D [Source file changed]
+[4 of 6] Compiling C [D[TH] changed]
+[6 of 6] Linking Main [Objects changed]
+[1 of 6] Compiling B [Source file changed]
+[2 of 6] Compiling A [B[TH] changed]
+[3 of 6] Compiling D [Source file changed]
+[4 of 6] Compiling C [D[TH] changed]
+[6 of 6] Linking Main [Objects changed]
diff --git a/testsuite/tests/ghc-api/T10052/T10052.stdout b/testsuite/tests/ghc-api/T10052/T10052.stdout
index 1a909eb36f..2506dc338e 100644
--- a/testsuite/tests/ghc-api/T10052/T10052.stdout
+++ b/testsuite/tests/ghc-api/T10052/T10052.stdout
@@ -1 +1 @@
-[1 of 1] Compiling Main ( T10052-input.hs, interpreted )
+[1 of 2] Compiling Main ( T10052-input.hs, interpreted )
diff --git a/testsuite/tests/ghc-api/T7478/T7478.stdout b/testsuite/tests/ghc-api/T7478/T7478.stdout
index 372cf9bfa3..e2323ab013 100644
--- a/testsuite/tests/ghc-api/T7478/T7478.stdout
+++ b/testsuite/tests/ghc-api/T7478/T7478.stdout
@@ -1,8 +1,8 @@
----- 0 ------
-(0,"[1 of 2] Compiling B ( B.hs, B.o )")
-(0,"[2 of 2] Compiling Main ( A.hs, A.o )")
+(0,"[1 of 3] Compiling B ( B.hs, B.o )")
+(0,"[2 of 3] Compiling Main ( A.hs, A.o )")
----- 1 ------
-(1,"[2 of 2] Compiling Main ( A.hs, A.o )")
+(1,"[2 of 3] Compiling Main ( A.hs, A.o )")
----- 2 ------
-(2,"[1 of 1] Compiling Main ( C.hs, C.o )")
-(2,"Linking A ...")
+(2,"[1 of 2] Compiling Main ( C.hs, C.o )")
+(2,"[2 of 2] Linking C")
diff --git a/testsuite/tests/ghc-api/downsweep/OldModLocation.hs b/testsuite/tests/ghc-api/downsweep/OldModLocation.hs
index ca1740358f..e21063ef45 100644
--- a/testsuite/tests/ghc-api/downsweep/OldModLocation.hs
+++ b/testsuite/tests/ghc-api/downsweep/OldModLocation.hs
@@ -6,12 +6,13 @@ import GHC
import GHC.Driver.Make
import GHC.Driver.Session
import GHC.Driver.Env
-import GHC.Unit.Module.ModSummary (ExtendedModSummary(..))
+import GHC.Unit.Module.Graph
import GHC.Unit.Finder
import Control.Monad.IO.Class (liftIO)
import Data.List (sort, stripPrefix)
import Data.Either
+import Data.Maybe
import System.Environment
import System.Directory
@@ -48,18 +49,18 @@ main = do
_emss <- downsweep hsc_env [] [] False
- flushFinderCaches (hsc_FC hsc_env) (hsc_home_unit hsc_env)
+ flushFinderCaches (hsc_FC hsc_env) (hsc_unit_env hsc_env)
createDirectoryIfMissing False "mydir"
renameFile "B.hs" "mydir/B.hs"
- emss <- downsweep hsc_env [] [] False
+ (_, nodes) <- downsweep hsc_env [] [] False
-- If 'checkSummaryTimestamp' were to call 'addHomeModuleToFinder' with
-- (ms_location old_summary) like summariseFile used to instead of
-- using the 'location' parameter we'd end up using the old location of
-- the "B" module in this test. Make sure that doesn't happen.
- hPrint stderr $ sort (map (ml_hs_file . ms_location) (map emsModSummary (rights emss)))
+ hPrint stderr $ sort (map (ml_hs_file . ms_location) (mapMaybe moduleGraphNodeModSum nodes))
writeMod :: [String] -> IO ()
writeMod src@(head -> stripPrefix "module " -> Just (takeWhile (/=' ') -> mod))
diff --git a/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs b/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs
index 7a0a3ccf8d..50442bf3f2 100644
--- a/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs
+++ b/testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs
@@ -6,10 +6,10 @@
import GHC
import GHC.Driver.Make
import GHC.Driver.Session
-import GHC.Unit.Module.ModSummary (ExtendedModSummary(..))
import GHC.Utils.Outputable
import GHC.Utils.Exception (ExceptionMonad)
import GHC.Data.Bag
+import GHC.Unit.Module.Graph
import Control.Monad
import Control.Monad.Catch as MC (handle)
@@ -18,6 +18,7 @@ import Control.Exception
import Data.IORef
import Data.List (sort, find, stripPrefix, isPrefixOf, isSuffixOf)
import Data.Either
+import Data.Maybe
import System.Environment
import System.Exit
@@ -167,11 +168,9 @@ go label mods cnd =
setTargets [tgt]
hsc_env <- getSession
- emss <- liftIO $ downsweep hsc_env [] [] False
- -- liftIO $ hPutStrLn stderr $ showSDoc (hsc_dflags hsc_env) $ ppr $ rights emss
- -- liftIO $ hPrint stderr $ bagToList $ unionManyBags $ lefts emss
+ (_, nodes) <- liftIO $ downsweep hsc_env [] [] False
- it label $ cnd (map emsModSummary (rights emss))
+ it label $ cnd (mapMaybe moduleGraphNodeModSum nodes)
writeMod :: [String] -> IO ()
diff --git a/testsuite/tests/ghci/scripts/T18330.stdout b/testsuite/tests/ghci/scripts/T18330.stdout
index c020ae7dbb..c95aa0e11b 100644
--- a/testsuite/tests/ghci/scripts/T18330.stdout
+++ b/testsuite/tests/ghci/scripts/T18330.stdout
@@ -1,5 +1,6 @@
-GHCi, version 9.3.20210616: https://www.haskell.org/ghc/ :? for help
-ghci> [1 of 1] Compiling Main ( shell.hs, interpreted )
+GHCi, version 9.3.20211019: https://www.haskell.org/ghc/ :? for help
+ghci> [1 of 2] Compiling Main ( shell.hs, interpreted )
+[2 of 2] Linking shell
Ok, one module loaded.
ghci> ghci> [1 of 1] Compiling T18330 ( T18330.hs, interpreted )
Ok, one module loaded.
diff --git a/testsuite/tests/ghci/scripts/T20587.script b/testsuite/tests/ghci/scripts/T20587.script
new file mode 100644
index 0000000000..7e318d79ae
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T20587.script
@@ -0,0 +1,13 @@
+:l shell.hs
+:def shell (\s -> do shell s; return "")
+
+:set -v1 -i -i. -ib -fhide-source-paths
+
+:shell mkdir b
+:shell echo "module B where b = 0" > b/B.hs
+
+:l B
+
+:shell echo "module B where" > B.hs
+
+:reload
diff --git a/testsuite/tests/ghci/scripts/T20587.stdout b/testsuite/tests/ghci/scripts/T20587.stdout
new file mode 100644
index 0000000000..6ca6d9f15f
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T20587.stdout
@@ -0,0 +1,4 @@
+[1 of 1] Compiling B
+Ok, one module loaded.
+[1 of 1] Compiling B [Source file changed]
+Ok, one module loaded.
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index a5ca6d64d3..32e9cad7fc 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -350,3 +350,5 @@ test('T7388', normal, ghci_script, ['T7388.script'])
test('T20627', normal, ghci_script, ['T20627.script'])
test('T20473a', normal, ghci_script, ['T20473a.script'])
test('T20473b', normal, ghci_script, ['T20473b.script'])
+test('T20587', [extra_files(['../shell.hs'])], ghci_script,
+ ['T20587.script'])
diff --git a/testsuite/tests/ghci/scripts/ghci021.stderr b/testsuite/tests/ghci/scripts/ghci021.stderr
index ea7488174e..2e5a3d5a0e 100644
--- a/testsuite/tests/ghci/scripts/ghci021.stderr
+++ b/testsuite/tests/ghci/scripts/ghci021.stderr
@@ -1,2 +1,2 @@
-<no location info>: no such module: ‘ThisDoesNotExist’
+<no location info>: error: no such module: ‘main:ThisDoesNotExist’
diff --git a/testsuite/tests/hp2ps/T15904.stdout b/testsuite/tests/hp2ps/T15904.stdout
index e77005b2eb..5005beaba7 100644
--- a/testsuite/tests/hp2ps/T15904.stdout
+++ b/testsuite/tests/hp2ps/T15904.stdout
@@ -1,5 +1,5 @@
-[1 of 1] Compiling T15904 ( T15904.hs, T15904.o )
-Linking "T15904" ...
+[1 of 2] Compiling T15904 ( T15904.hs, T15904.o )
+[2 of 2] Linking "T15904"
{"e": 2.72, "pi": 3.14}
\
diff --git a/testsuite/tests/indexed-types/should_compile/impexp.stderr b/testsuite/tests/indexed-types/should_compile/impexp.stderr
index 7ebebe9e03..c57f611d6f 100644
--- a/testsuite/tests/indexed-types/should_compile/impexp.stderr
+++ b/testsuite/tests/indexed-types/should_compile/impexp.stderr
@@ -1,2 +1,2 @@
-[1 of 2] Compiling Exp ( Exp.hs, Exp.o )
-[2 of 2] Compiling Imp ( Imp.hs, Imp.o )
+[1 of 3] Compiling Exp ( Exp.hs, Exp.o )
+[2 of 3] Compiling Imp ( Imp.hs, Imp.o )
diff --git a/testsuite/tests/llvm/should_run/subsections_via_symbols/subsections_via_symbols.stdout b/testsuite/tests/llvm/should_run/subsections_via_symbols/subsections_via_symbols.stdout
index 548813e7a4..eac8528cdd 100644
--- a/testsuite/tests/llvm/should_run/subsections_via_symbols/subsections_via_symbols.stdout
+++ b/testsuite/tests/llvm/should_run/subsections_via_symbols/subsections_via_symbols.stdout
@@ -1,3 +1,3 @@
-[1 of 1] Compiling SymbolsViaSections ( SubsectionsViaSymbols.hs, SubsectionsViaSymbols.o )
-Linking subsections_via_symbols ...
+[1 of 2] Compiling SymbolsViaSections ( SubsectionsViaSymbols.hs, SubsectionsViaSymbols.o )
+[2 of 2] Linking subsections_via_symbols
..........
diff --git a/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr
index f2d5586103..086d951580 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr
+++ b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr
@@ -1,5 +1,5 @@
-[1 of 2] Compiling HasFieldFail01_A ( HasFieldFail01_A.hs, HasFieldFail01_A.o )
-[2 of 2] Compiling Main ( hasfieldfail01.hs, hasfieldfail01.o )
+[1 of 3] Compiling HasFieldFail01_A ( HasFieldFail01_A.hs, HasFieldFail01_A.o )
+[2 of 3] Compiling Main ( hasfieldfail01.hs, hasfieldfail01.o )
hasfieldfail01.hs:9:15: error:
• No instance for (HasField "foo" T Int)
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail04.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail04.stderr
index 6f5e7588f1..fe4b469e62 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail04.stderr
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail04.stderr
@@ -1,7 +1,7 @@
-[1 of 2] Compiling OverloadedRecFldsFail04_A ( OverloadedRecFldsFail04_A.hs, OverloadedRecFldsFail04_A.o )
-[2 of 2] Compiling Main ( overloadedrecfldsfail04.hs, overloadedrecfldsfail04.o )
+[1 of 3] Compiling OverloadedRecFldsFail04_A ( OverloadedRecFldsFail04_A.hs, OverloadedRecFldsFail04_A.o )
+[2 of 3] Compiling Main ( overloadedrecfldsfail04.hs, overloadedrecfldsfail04.o )
- overloadedrecfldsfail04.hs:9:6:
+overloadedrecfldsfail04.hs:9:6: error:
Ambiguous occurrence ‘I.x’
It could refer to
either the field ‘x’,
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr
index 254931a9bc..10e3b1ece8 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail06.stderr
@@ -1,4 +1,4 @@
-[1 of 2] Compiling OverloadedRecFldsFail06_A ( OverloadedRecFldsFail06_A.hs, OverloadedRecFldsFail06_A.o )
+[1 of 3] Compiling OverloadedRecFldsFail06_A ( OverloadedRecFldsFail06_A.hs, OverloadedRecFldsFail06_A.o )
OverloadedRecFldsFail06_A.hs:9:15: warning: [-Wunused-top-binds (in -Wextra, -Wunused-binds)]
Defined but not used: data constructor ‘MkUnused’
@@ -8,7 +8,7 @@ OverloadedRecFldsFail06_A.hs:9:42: warning: [-Wunused-top-binds (in -Wextra, -Wu
OverloadedRecFldsFail06_A.hs:9:59: warning: [-Wunused-top-binds (in -Wextra, -Wunused-binds)]
Defined but not used: ‘used_locally’
-[2 of 2] Compiling Main ( overloadedrecfldsfail06.hs, overloadedrecfldsfail06.o )
+[2 of 3] Compiling Main ( overloadedrecfldsfail06.hs, overloadedrecfldsfail06.o )
overloadedrecfldsfail06.hs:7:1: error: [-Wunused-imports (in -Wextra), -Werror=unused-imports]
The import of ‘Unused(unused), V(x), U(y), MkV, Unused’
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr
index 9be384b500..cf483418ce 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail10.stderr
@@ -1,7 +1,7 @@
-[1 of 4] Compiling OverloadedRecFldsFail10_A ( OverloadedRecFldsFail10_A.hs, OverloadedRecFldsFail10_A.o )
-[2 of 4] Compiling OverloadedRecFldsFail10_B ( OverloadedRecFldsFail10_B.hs, OverloadedRecFldsFail10_B.o )
-[3 of 4] Compiling OverloadedRecFldsFail10_C ( OverloadedRecFldsFail10_C.hs, OverloadedRecFldsFail10_C.o )
-[4 of 4] Compiling Main ( overloadedrecfldsfail10.hs, overloadedrecfldsfail10.o )
+[1 of 5] Compiling OverloadedRecFldsFail10_A ( OverloadedRecFldsFail10_A.hs, OverloadedRecFldsFail10_A.o )
+[2 of 5] Compiling OverloadedRecFldsFail10_B ( OverloadedRecFldsFail10_B.hs, OverloadedRecFldsFail10_B.o )
+[3 of 5] Compiling OverloadedRecFldsFail10_C ( OverloadedRecFldsFail10_C.hs, OverloadedRecFldsFail10_C.o )
+[4 of 5] Compiling Main ( overloadedrecfldsfail10.hs, overloadedrecfldsfail10.o )
overloadedrecfldsfail10.hs:6:20: error:
Conflicting exports for ‘foo’:
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr
index 687af43de1..a509f54beb 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail11.stderr
@@ -1,7 +1,7 @@
-[1 of 2] Compiling OverloadedRecFldsFail11_A ( OverloadedRecFldsFail11_A.hs, OverloadedRecFldsFail11_A.o )
-[2 of 2] Compiling Main ( overloadedrecfldsfail11.hs, overloadedrecfldsfail11.o )
+[1 of 3] Compiling OverloadedRecFldsFail11_A ( OverloadedRecFldsFail11_A.hs, OverloadedRecFldsFail11_A.o )
+[2 of 3] Compiling Main ( overloadedrecfldsfail11.hs, overloadedrecfldsfail11.o )
-overloadedrecfldsfail11.hs:5:15:
+overloadedrecfldsfail11.hs:5:15: error:
Ambiguous occurrence ‘foo’
It could refer to
either the field ‘foo’,
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.stderr
index b51fb80cca..62f9cd3e3c 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.stderr
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail12.stderr
@@ -1,7 +1,7 @@
-[1 of 2] Compiling OverloadedRecFldsFail12_A ( OverloadedRecFldsFail12_A.hs, OverloadedRecFldsFail12_A.o )
-[2 of 2] Compiling Main ( overloadedrecfldsfail12.hs, overloadedrecfldsfail12.o )
+[1 of 3] Compiling OverloadedRecFldsFail12_A ( OverloadedRecFldsFail12_A.hs, OverloadedRecFldsFail12_A.o )
+[2 of 3] Compiling Main ( overloadedrecfldsfail12.hs, overloadedrecfldsfail12.o )
- overloadedrecfldsfail12.hs:13:5:
+overloadedrecfldsfail12.hs:13:5: error:
Ambiguous occurrence ‘foo’
It could refer to
either the field ‘foo’,
@@ -9,7 +9,7 @@
(and originally defined at OverloadedRecFldsFail12_A.hs:5:16-18)
or the field ‘foo’, defined at overloadedrecfldsfail12.hs:6:16
- overloadedrecfldsfail12.hs:16:5:
+overloadedrecfldsfail12.hs:16:5: error:
Ambiguous occurrence ‘foo’
It could refer to
either the field ‘foo’,
diff --git a/testsuite/tests/parser/should_compile/T5243.stderr b/testsuite/tests/parser/should_compile/T5243.stderr
index 450e001237..5211871a2e 100644
--- a/testsuite/tests/parser/should_compile/T5243.stderr
+++ b/testsuite/tests/parser/should_compile/T5243.stderr
@@ -1,3 +1,3 @@
-[1 of 2] Compiling T5243A ( T5243A.hs, T5243A.o )
-[2 of 2] Compiling Main ( T5243.hs, T5243.o )
-Linking T5243 ...
+[1 of 3] Compiling T5243A ( T5243A.hs, T5243A.o )
+[2 of 3] Compiling Main ( T5243.hs, T5243.o )
+[3 of 3] Linking T5243
diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail6.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail6.stderr
index c53990475b..c9bb7f6647 100644
--- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail6.stderr
+++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail6.stderr
@@ -1,5 +1,5 @@
-[1 of 2] Compiling RecordDotSyntaxA ( RecordDotSyntaxA.hs, RecordDotSyntaxA.o )
- [2 of 2] Compiling Main ( RecordDotSyntaxFail6.hs, RecordDotSyntaxFail6.o )
+[1 of 3] Compiling RecordDotSyntaxA ( RecordDotSyntaxA.hs, RecordDotSyntaxA.o )
+[2 of 3] Compiling Main ( RecordDotSyntaxFail6.hs, RecordDotSyntaxFail6.o )
- RecordDotSyntaxFail6.hs:10:17:
+RecordDotSyntaxFail6.hs:10:17: error:
Fields cannot be qualified when OverloadedRecordUpdate is enabled
diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail7.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail7.stderr
index feee41589f..0b0cfcc03a 100644
--- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail7.stderr
+++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail7.stderr
@@ -1,4 +1,4 @@
-[1 of 2] Compiling RecordDotSyntaxA ( RecordDotSyntaxA.hs, RecordDotSyntaxA.o )
-[2 of 2] Compiling Main ( RecordDotSyntaxFail7.hs, RecordDotSyntaxFail7.o )
+[1 of 3] Compiling RecordDotSyntaxA ( RecordDotSyntaxA.hs, RecordDotSyntaxA.o )
+[2 of 3] Compiling Main ( RecordDotSyntaxFail7.hs, RecordDotSyntaxFail7.o )
-RecordDotSyntaxFail7.hs:9:16: parse error on input ‘A.foo’
+RecordDotSyntaxFail7.hs:9:16: error: parse error on input ‘A.foo’
diff --git a/testsuite/tests/perf/compiler/Makefile b/testsuite/tests/perf/compiler/Makefile
index 20f5704450..0011c70710 100644
--- a/testsuite/tests/perf/compiler/Makefile
+++ b/testsuite/tests/perf/compiler/Makefile
@@ -16,3 +16,15 @@ T11068:
MultiModulesRecomp:
./genMultiLayerModules
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 MultiLayerModules.hs
+
+MultiComponentModulesRecomp:
+ '$(PYTHON)' genMultiComp.py
+ TEST_HC='$(TEST_HC)' TEST_HC_OPTS='$(TEST_HC_OPTS)' ./run
+
+MultiLayerModulesTH_Make_Prep:
+ ./genMultiLayerModulesTH
+ "$(TEST_HC)" $(TEST_HC_OPTS) MultiLayerModulesPrep -dynamic-too -v0
+
+MultiLayerModulesTH_OneShot_Prep: MultiLayerModulesTH_Make_Prep
+ $(CP) MultiLayerModules.hs MultiLayerModulesTH_OneShot.hs
+
diff --git a/testsuite/tests/perf/compiler/MultiLayerModulesTH_Make.stderr b/testsuite/tests/perf/compiler/MultiLayerModulesTH_Make.stderr
new file mode 100644
index 0000000000..4a1b876638
--- /dev/null
+++ b/testsuite/tests/perf/compiler/MultiLayerModulesTH_Make.stderr
@@ -0,0 +1,8 @@
+
+MultiLayerModules.hs:334:8: error:
+ • Exception when trying to run compile-time code:
+ deliberate error
+CallStack (from HasCallStack):
+ error, called at MultiLayerModules.hs:334:10 in main:MultiLayerModules
+ Code: (error "deliberate error")
+ • In the untyped splice: $(error "deliberate error")
diff --git a/testsuite/tests/perf/compiler/MultiLayerModulesTH_OneShot.stderr b/testsuite/tests/perf/compiler/MultiLayerModulesTH_OneShot.stderr
new file mode 100644
index 0000000000..a958aceeea
--- /dev/null
+++ b/testsuite/tests/perf/compiler/MultiLayerModulesTH_OneShot.stderr
@@ -0,0 +1,8 @@
+
+MultiLayerModulesTH_OneShot.hs:334:8: error:
+ • Exception when trying to run compile-time code:
+ deliberate error
+CallStack (from HasCallStack):
+ error, called at MultiLayerModulesTH_OneShot.hs:334:10 in main:MultiLayerModules
+ Code: (error "deliberate error")
+ • In the untyped splice: $(error "deliberate error")
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 2f52209d06..25672bf7e7 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -293,6 +293,29 @@ test('MultiLayerModulesRecomp',
multimod_compile,
['MultiLayerModules', '-v0'])
+
+# A performance test for calculating link dependencies in --make mode.
+test('MultiLayerModulesTH_Make',
+ [ collect_compiler_stats('bytes allocated',3),
+ pre_cmd('$MAKE -s --no-print-directory MultiLayerModulesTH_Make_Prep'),
+ extra_files(['genMultiLayerModulesTH']),
+ unless(have_dynamic(),skip),
+ compile_timeout_multiplier(5)
+ ],
+ multimod_compile_fail,
+ ['MultiLayerModules', '-v0'])
+
+# A performance test for calculating link dependencies in -c mode.
+test('MultiLayerModulesTH_OneShot',
+ [ collect_compiler_stats('bytes allocated',3),
+ pre_cmd('$MAKE -s --no-print-directory MultiLayerModulesTH_OneShot_Prep'),
+ extra_files(['genMultiLayerModulesTH']),
+ unless(have_dynamic(),skip),
+ compile_timeout_multiplier(5)
+ ],
+ compile_fail,
+ ['-v0'])
+
test('MultiLayerModulesDefsGhci',
[ collect_compiler_residency(15),
pre_cmd('./genMultiLayerModulesDefs'),
@@ -319,6 +342,24 @@ test('MultiLayerModulesNoCode',
ghci_script,
['MultiLayerModulesNoCode.script'])
+test('MultiComponentModulesRecomp',
+ [ collect_compiler_stats('bytes allocated', 2),
+ pre_cmd('$MAKE -s --no-print-directory MultiComponentModulesRecomp'),
+ extra_files(['genMultiComp.py']),
+ compile_timeout_multiplier(5)
+ ],
+ multiunit_compile,
+ [['unitp%d' % n for n in range(20)], '-fno-code -fwrite-interface -v0'])
+
+test('MultiComponentModules',
+ [ collect_compiler_stats('bytes allocated', 2),
+ pre_cmd('$PYTHON ./genMultiComp.py'),
+ extra_files(['genMultiComp.py']),
+ compile_timeout_multiplier(5)
+ ],
+ multiunit_compile,
+ [['unitp%d' % n for n in range(20)], '-fno-code -fwrite-interface -v0'])
+
test('ManyConstructors',
[ collect_compiler_stats('bytes allocated',2),
pre_cmd('./genManyConstructors'),
diff --git a/testsuite/tests/perf/compiler/genMultiComp.py b/testsuite/tests/perf/compiler/genMultiComp.py
new file mode 100755
index 0000000000..d069f77959
--- /dev/null
+++ b/testsuite/tests/perf/compiler/genMultiComp.py
@@ -0,0 +1,78 @@
+#! /usr/bin/env python
+
+# Generates a set of interdependent units for testing any obvious performance cliffs
+# with multiple component support.
+# The structure of each unit is:
+# * A Top module, which imports the rest of the modules in the unit
+# * A number of modules names Mod_<pid>_<mid>, each module imports all the top
+# modules beneath it, and all the modules in the current unit beneath it.
+
+import os
+import stat
+
+modules_per = 20
+packages = 20
+total = modules_per * packages
+
+def unit_dir(p):
+ return "p" + str(p)
+
+def unit_fname(p):
+ return "unitp" + str(p)
+
+def top_fname(p):
+ return "Top" + str(p)
+
+def mod_name(p, k):
+ return "Mod_%d_%d" % (p, k)
+
+def flatten(t):
+ return [item for sublist in t for item in sublist]
+
+def mk_unit_file(p):
+ fname = top_fname(p)
+ deps = flatten([["-package-id", unit_dir(k)] for k in range(p)])
+ opts = ["-working-dir", unit_dir(p), "-this-unit-id", unit_dir(p), fname] + deps
+ with open(unit_fname(p), 'w') as fout:
+ fout.write(' '.join(opts))
+
+def mk_top_mod(p):
+ pdir = unit_dir(p)
+ topfname = os.path.join(pdir, top_fname(p) + '.hs')
+ header = 'module %s where' % top_fname(p)
+ imports = ['import %s' % mod_name(p, m) for m in range(modules_per)]
+ with open(topfname, 'w') as fout:
+ fout.write(header + '\n')
+ fout.write('\n'.join(imports))
+
+def mk_mod(p, k):
+ pdir = unit_dir(p)
+ fname = os.path.join(pdir, mod_name(p, k) + '.hs')
+ header = 'module %s where' % mod_name(p,k)
+ imports1 = ['import ' + top_fname(pn) for pn in range(p)]
+ imports2 = ['import ' + mod_name(p, kn) for kn in range(k)]
+ with open(fname, 'w') as fout:
+ fout.write(header + '\n')
+ fout.write('\n'.join(imports1))
+ fout.write('\n')
+ fout.write('\n'.join(imports2))
+
+def mk_run():
+ all_units = flatten([['-unit', '@'+unit_fname(pn)] for pn in range(packages)])
+ with open('run', 'w') as fout:
+ fout.write("$TEST_HC $TEST_HC_OPTS -fno-code -fwrite-interface ")
+ fout.write(" ".join(all_units))
+
+ st = os.stat('run')
+ os.chmod('run', st.st_mode | stat.S_IEXEC)
+
+
+for p in range(packages):
+ os.mkdir(unit_dir(p))
+ mk_unit_file(p)
+ mk_top_mod(p)
+ for k in range(modules_per):
+ mk_mod(p, k)
+mk_run()
+
+
diff --git a/testsuite/tests/perf/compiler/genMultiLayerModulesTH b/testsuite/tests/perf/compiler/genMultiLayerModulesTH
new file mode 100755
index 0000000000..2781871fa6
--- /dev/null
+++ b/testsuite/tests/perf/compiler/genMultiLayerModulesTH
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+# Generate $DEPTH layers of modules with $WIDTH modules on each layer
+# Every module on layer N imports all the modules on layer N-1
+# MultiLayerModulesPrep.hs imports all the modules from the last layer, is used to
+# prepare all dependencies.
+# MultiLayerModules.hs imports all the modules from the last layer, and has NDEFS*WIDTH
+# top-level splices which stress some inefficient parts of link dependency calculation.
+# Lastly there is a splice which contains an error so that we don't benchmark code
+# generation as well.
+
+DEPTH=10
+WIDTH=30
+NDEFS=10
+for i in $(seq -w 1 $WIDTH); do
+ echo "module DummyLevel0M$i where" > DummyLevel0M$i.hs;
+done
+for l in $(seq 1 $DEPTH); do
+ for i in $(seq -w 1 $WIDTH); do
+ echo "module DummyLevel${l}M$i where" > DummyLevel${l}M$i.hs;
+ for j in $(seq -w 1 $WIDTH); do
+ echo "import DummyLevel$((l-1))M$j" >> DummyLevel${l}M$i.hs;
+ done
+ echo "def_${l}_${i} :: Int" >> DummyLevel${l}M$i.hs;
+ echo "def_${l}_${i} = ${l} * ${i}" >> DummyLevel${l}M${i}.hs;
+ done
+done
+# Gen the prep module, which can be compiled without running and TH splices
+# but forces the rest of the project to be built.
+echo "module MultiLayerModulesPrep where" > MultiLayerModulesPrep.hs
+for j in $(seq -w 1 $WIDTH); do
+ echo "import DummyLevel${DEPTH}M$j" >> MultiLayerModulesPrep.hs;
+done
+
+echo "{-# LANGUAGE TemplateHaskell #-}" > MultiLayerModules.hs
+echo "module MultiLayerModules where" >> MultiLayerModules.hs
+echo "import Language.Haskell.TH.Syntax" >> MultiLayerModules.hs
+for j in $(seq -w 1 $WIDTH); do
+ echo "import DummyLevel${DEPTH}M$j" >> MultiLayerModules.hs;
+done
+for j in $(seq -w 1 $WIDTH); do
+ for i in $(seq -w 1 $NDEFS); do
+ echo "defth_${j}_${i} = \$(lift def_${DEPTH}_${j})" >> MultiLayerModules.hs;
+ done
+done
+# Finally, a splice with an error so we stop before doing code generation
+# This
+echo "last = \$(error \"deliberate error\")" >> MultiLayerModules.hs
diff --git a/testsuite/tests/plugins/frontend01.stdout b/testsuite/tests/plugins/frontend01.stdout
index 234c91c10b..8f1c7691f5 100644
--- a/testsuite/tests/plugins/frontend01.stdout
+++ b/testsuite/tests/plugins/frontend01.stdout
@@ -1,4 +1,4 @@
["foo","bar"]
-[1 of 1] Compiling Main ( frontend01.hs, frontend01.o )
-Linking frontend01 ...
+[1 of 2] Compiling Main ( frontend01.hs, frontend01.o )
+[2 of 2] Linking frontend01
hello world
diff --git a/testsuite/tests/plugins/plugin-recomp-flags.stdout b/testsuite/tests/plugins/plugin-recomp-flags.stdout
index 342fa3e0f8..da1538dd07 100644
--- a/testsuite/tests/plugins/plugin-recomp-flags.stdout
+++ b/testsuite/tests/plugins/plugin-recomp-flags.stdout
@@ -1,4 +1,4 @@
-[1 of 1] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o )
-Linking plugin-recomp-test ...
-[1 of 1] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o ) [Plugin fingerprint changed]
-Linking plugin-recomp-test ...
+[1 of 2] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o )
+[2 of 2] Linking plugin-recomp-test
+[1 of 2] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o ) [Plugin fingerprint changed]
+[2 of 2] Linking plugin-recomp-test [Objects changed]
diff --git a/testsuite/tests/plugins/plugin-recomp-impure.stdout b/testsuite/tests/plugins/plugin-recomp-impure.stdout
index 4a2c0aded6..8703e04dff 100644
--- a/testsuite/tests/plugins/plugin-recomp-impure.stdout
+++ b/testsuite/tests/plugins/plugin-recomp-impure.stdout
@@ -1,4 +1,4 @@
-[1 of 1] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o )
-Linking plugin-recomp-test ...
-[1 of 1] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o ) [Impure plugin forced recompilation]
-Linking plugin-recomp-test ...
+[1 of 2] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o )
+[2 of 2] Linking plugin-recomp-test
+[1 of 2] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o ) [Impure plugin forced recompilation]
+[2 of 2] Linking plugin-recomp-test [Objects changed]
diff --git a/testsuite/tests/plugins/plugin-recomp-pure.stdout b/testsuite/tests/plugins/plugin-recomp-pure.stdout
index a6828318a0..80f8d17697 100644
--- a/testsuite/tests/plugins/plugin-recomp-pure.stdout
+++ b/testsuite/tests/plugins/plugin-recomp-pure.stdout
@@ -1,2 +1,2 @@
-[1 of 1] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o )
-Linking plugin-recomp-test ...
+[1 of 2] Compiling Main ( plugin-recomp-test.hs, plugin-recomp-test.o )
+[2 of 2] Linking plugin-recomp-test
diff --git a/testsuite/tests/regalloc/regalloc_unit_tests.hs b/testsuite/tests/regalloc/regalloc_unit_tests.hs
index b005982d2d..8e9721ec2e 100644
--- a/testsuite/tests/regalloc/regalloc_unit_tests.hs
+++ b/testsuite/tests/regalloc/regalloc_unit_tests.hs
@@ -51,6 +51,8 @@ import GHC.Utils.Outputable
import GHC.Types.Basic
import GHC.Unit.Home
import GHC.Unit.Finder
+import GHC.Unit.Env
+import GHC.Unit.Home.ModInfo
import GHC.Driver.Config.Finder
import GHC.Data.Stream as Stream (collect, yield)
diff --git a/testsuite/tests/rts/T9405.stdout b/testsuite/tests/rts/T9405.stdout
index a62f1c2d1b..5bec5f7b4f 100644
--- a/testsuite/tests/rts/T9405.stdout
+++ b/testsuite/tests/rts/T9405.stdout
@@ -1,3 +1,3 @@
-[1 of 1] Compiling Main ( T9405.hs, T9405.o )
-Linking T9405 ...
+[1 of 2] Compiling Main ( T9405.hs, T9405.o )
+[2 of 2] Linking T9405
Ticky-Ticky
diff --git a/testsuite/tests/rts/linker/linker_unload.stdout b/testsuite/tests/rts/linker/linker_unload.stdout
index 84697b99ba..6ae361269f 100644
--- a/testsuite/tests/rts/linker/linker_unload.stdout
+++ b/testsuite/tests/rts/linker/linker_unload.stdout
@@ -1,3 +1,3 @@
-[1 of 1] Compiling LinkerUnload ( LinkerUnload.hs, LinkerUnload.o )
-Linking linker_unload ...
+[1 of 2] Compiling LinkerUnload ( LinkerUnload.hs, LinkerUnload.o )
+[2 of 2] Linking linker_unload
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 \ No newline at end of file
diff --git a/testsuite/tests/rts/linker/linker_unload_native.stdout b/testsuite/tests/rts/linker/linker_unload_native.stdout
index 6f6f0acf60..cfe18775cd 100644
--- a/testsuite/tests/rts/linker/linker_unload_native.stdout
+++ b/testsuite/tests/rts/linker/linker_unload_native.stdout
@@ -1,3 +1,3 @@
-[1 of 1] Compiling LinkerUnload ( LinkerUnload.hs, LinkerUnload.o )
-Linking linker_unload_native ...
+[1 of 2] Compiling LinkerUnload ( LinkerUnload.hs, LinkerUnload.o )
+[2 of 2] Linking linker_unload_native
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 \ No newline at end of file
diff --git a/testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.stdout b/testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.stdout
index 82f7a2f36d..29b878d591 100644
--- a/testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.stdout
+++ b/testsuite/tests/rts/linker/unload_multiple_objs/linker_unload_multiple_objs.stdout
@@ -1,2 +1,2 @@
-[1 of 1] Compiling LinkerUnload ( LinkerUnload.hs, LinkerUnload.o )
-Linking linker_unload_multiple_objs ...
+[1 of 2] Compiling LinkerUnload ( LinkerUnload.hs, LinkerUnload.o )
+[2 of 2] Linking linker_unload_multiple_objs
diff --git a/testsuite/tests/safeHaskell/check/Check04.stderr b/testsuite/tests/safeHaskell/check/Check04.stderr
index ec3bdb1585..78d206a936 100644
--- a/testsuite/tests/safeHaskell/check/Check04.stderr
+++ b/testsuite/tests/safeHaskell/check/Check04.stderr
@@ -1,2 +1,2 @@
-[4 of 4] Compiling Main ( Check04.hs, Check04.o )
-Linking Check04 ...
+[4 of 5] Compiling Main ( Check04.hs, Check04.o )
+[5 of 5] Linking Check04
diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr
index 00181efaed..33cb566987 100644
--- a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr
+++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr
@@ -1,4 +1,4 @@
-[2 of 2] Compiling Main ( ImpSafe03.hs, ImpSafe03.o )
+[2 of 3] Compiling Main ( ImpSafe03.hs, ImpSafe03.o )
<no location info>: error:
- The package (bytestring-0.10.8.1) is required to be trusted but it isn't!
+ The package (bytestring-0.11.1.0) is required to be trusted but it isn't!
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang10.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang10.stderr
index 26f04624af..d058bb2599 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang10.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang10.stderr
@@ -1,6 +1,6 @@
-[1 of 3] Compiling SafeLang10_A ( SafeLang10_A.hs, SafeLang10_A.o )
-[2 of 3] Compiling SafeLang10_B ( SafeLang10_B.hs, SafeLang10_B.o )
-[3 of 3] Compiling Main ( SafeLang10.hs, SafeLang10.o )
+[1 of 4] Compiling SafeLang10_A ( SafeLang10_A.hs, SafeLang10_A.o )
+[2 of 4] Compiling SafeLang10_B ( SafeLang10_B.hs, SafeLang10_B.o )
+[3 of 4] Compiling Main ( SafeLang10.hs, SafeLang10.o )
SafeLang10.hs:9:13: error:
• Unsafe overlapping instances for Pos [Int]
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr
index 33bf7ce3fe..2239f73d8f 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang12.stderr
@@ -4,9 +4,9 @@ SafeLang12.hs:3:14: warning:
SafeLang12_B.hs:3:14: warning:
-XTemplateHaskell is not allowed in Safe Haskell; ignoring -XTemplateHaskell
-[1 of 3] Compiling SafeLang12_A ( SafeLang12_A.hs, SafeLang12_A.o )
-[2 of 3] Compiling SafeLang12_B ( SafeLang12_B.hs, SafeLang12_B.o )
-[3 of 3] Compiling Main ( SafeLang12.hs, SafeLang12.o )
+[1 of 4] Compiling SafeLang12_A ( SafeLang12_A.hs, SafeLang12_A.o )
+[2 of 4] Compiling SafeLang12_B ( SafeLang12_B.hs, SafeLang12_B.o )
+[3 of 4] Compiling Main ( SafeLang12.hs, SafeLang12.o )
SafeLang12.hs:1:1: error:
Top-level splices are not permitted without TemplateHaskell
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang17.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang17.stderr
index 1aab52a646..111d0fd19c 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang17.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang17.stderr
@@ -1,6 +1,6 @@
-[1 of 3] Compiling SafeLang17_A ( SafeLang17_A.hs, SafeLang17_A.o )
-[2 of 3] Compiling SafeLang17_B ( SafeLang17_B.hs, SafeLang17_B.o )
-[3 of 3] Compiling Main ( SafeLang17.hs, SafeLang17.o )
+[1 of 4] Compiling SafeLang17_A ( SafeLang17_A.hs, SafeLang17_A.o )
+[2 of 4] Compiling SafeLang17_B ( SafeLang17_B.hs, SafeLang17_B.o )
+[3 of 4] Compiling Main ( SafeLang17.hs, SafeLang17.o )
SafeLang17.hs:9:13: error:
• Unsafe overlapping instances for Pos [Int]
diff --git a/testsuite/tests/tcplugins/TcPlugin_RewritePerf.stderr b/testsuite/tests/tcplugins/TcPlugin_RewritePerf.stderr
index 1600c377f6..1213844c57 100644
--- a/testsuite/tests/tcplugins/TcPlugin_RewritePerf.stderr
+++ b/testsuite/tests/tcplugins/TcPlugin_RewritePerf.stderr
@@ -1,6 +1,6 @@
-[1 of 3] Compiling RewritePerfDefs ( RewritePerfDefs.hs, RewritePerfDefs.o )
-[2 of 3] Compiling RewritePerfPlugin ( RewritePerfPlugin.hs, RewritePerfPlugin.o )
-[3 of 3] Compiling Main ( TcPlugin_RewritePerf.hs, TcPlugin_RewritePerf.o )
+[1 of 4] Compiling RewritePerfDefs ( RewritePerfDefs.hs, RewritePerfDefs.o )
+[2 of 4] Compiling RewritePerfPlugin ( RewritePerfPlugin.hs, RewritePerfPlugin.o )
+[3 of 4] Compiling Main ( TcPlugin_RewritePerf.hs, TcPlugin_RewritePerf.o )
TcPlugin_RewritePerf.hs:25:8: error:
• No instance for (Show
diff --git a/testsuite/tests/th/TH_linker/path_with_commas.stdout b/testsuite/tests/th/TH_linker/path_with_commas.stdout
index 0621c2410a..9559dcdc64 100644
--- a/testsuite/tests/th/TH_linker/path_with_commas.stdout
+++ b/testsuite/tests/th/TH_linker/path_with_commas.stdout
@@ -1,4 +1,4 @@
Reading package info from "test.pkg" ... done.
-[1 of 1] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[1 of 2] Compiling Main ( Main.hs, Main.o )
+[2 of 2] Linking Main
hello
diff --git a/testsuite/tests/typecheck/should_fail/T13068.stderr b/testsuite/tests/typecheck/should_fail/T13068.stderr
index 6ecf1871c6..d78e402f76 100644
--- a/testsuite/tests/typecheck/should_fail/T13068.stderr
+++ b/testsuite/tests/typecheck/should_fail/T13068.stderr
@@ -1,5 +1,5 @@
-[1 of 4] Compiling T13068[boot] ( T13068.hs-boot, T13068.o-boot )
-[2 of 4] Compiling T13068a ( T13068a.hs, T13068a.o )
+[1 of 5] Compiling T13068[boot] ( T13068.hs-boot, T13068.o-boot )
+[2 of 5] Compiling T13068a ( T13068a.hs, T13068a.o )
T13068a.hs:3:10: error:
• Cannot define instance for abstract class ‘C’
diff --git a/testsuite/tests/typecheck/should_fail/T6018fail.stderr b/testsuite/tests/typecheck/should_fail/T6018fail.stderr
index 78a92e7d1b..ed1a8c3de2 100644
--- a/testsuite/tests/typecheck/should_fail/T6018fail.stderr
+++ b/testsuite/tests/typecheck/should_fail/T6018fail.stderr
@@ -1,8 +1,8 @@
-[1 of 5] Compiling T6018Afail ( T6018Afail.hs, T6018Afail.o )
-[2 of 5] Compiling T6018Bfail ( T6018Bfail.hs, T6018Bfail.o )
-[3 of 5] Compiling T6018Cfail ( T6018Cfail.hs, T6018Cfail.o )
-[4 of 5] Compiling T6018Dfail ( T6018Dfail.hs, T6018Dfail.o )
-[5 of 5] Compiling T6018fail ( T6018fail.hs, T6018fail.o )
+[1 of 6] Compiling T6018Afail ( T6018Afail.hs, T6018Afail.o )
+[2 of 6] Compiling T6018Bfail ( T6018Bfail.hs, T6018Bfail.o )
+[3 of 6] Compiling T6018Cfail ( T6018Cfail.hs, T6018Cfail.o )
+[4 of 6] Compiling T6018Dfail ( T6018Dfail.hs, T6018Dfail.o )
+[5 of 6] Compiling T6018fail ( T6018fail.hs, T6018fail.o )
T6018fail.hs:15:15: error:
Type family equation right-hand sides overlap; this violates
diff --git a/testsuite/tests/unboxedsums/module/sum_mod.stdout b/testsuite/tests/unboxedsums/module/sum_mod.stdout
index 615266b7f6..bf322a1137 100644
--- a/testsuite/tests/unboxedsums/module/sum_mod.stdout
+++ b/testsuite/tests/unboxedsums/module/sum_mod.stdout
@@ -1,3 +1,3 @@
-[2 of 2] Compiling Main ( Main.hs, Main.o )
-Linking Main ...
+[2 of 3] Compiling Main ( Main.hs, Main.o )
+[3 of 3] Linking Main
123
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr
index c77fbc4300..383b6df7bd 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr
@@ -1,6 +1,7 @@
<no location info>: warning: [-Wmissing-home-modules]
- Modules are not listed in command line but needed for compilation: M1
-[1 of 2] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 2] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-Linking src-exe/Main ...
+ Modules are not listed in command line but needed for compilation:
+ M1
+[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 3] Linking src-exe/Main
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr
index c77fbc4300..383b6df7bd 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr
@@ -1,6 +1,7 @@
<no location info>: warning: [-Wmissing-home-modules]
- Modules are not listed in command line but needed for compilation: M1
-[1 of 2] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 2] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-Linking src-exe/Main ...
+ Modules are not listed in command line but needed for compilation:
+ M1
+[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 3] Linking src-exe/Main
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727c.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727c.stderr
index 0b9ac0ebf2..c9c968ddf3 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727c.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727c.stderr
@@ -1,3 +1,3 @@
-[1 of 2] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 2] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-Linking src-exe/Main ...
+[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 3] Linking src-exe/Main
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727d.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727d.stderr
index 0b9ac0ebf2..c9c968ddf3 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727d.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727d.stderr
@@ -1,3 +1,3 @@
-[1 of 2] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 2] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-Linking src-exe/Main ...
+[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 3] Linking src-exe/Main
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727e.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727e.stderr
index 0b9ac0ebf2..c9c968ddf3 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727e.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727e.stderr
@@ -1,3 +1,3 @@
-[1 of 2] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 2] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-Linking src-exe/Main ...
+[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 3] Linking src-exe/Main
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr
index 20a42baeb9..9d084b94f6 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr
@@ -1,8 +1,8 @@
<no location info>: warning: [-Wmissing-home-modules]
- Modules are not listed in command line but needed for compilation: M1
- Main
-[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-[3 of 3] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
-Linking src-exe/AltMain ...
+ Modules are not listed in command line but needed for compilation:
+ M1 Main
+[1 of 4] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 4] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 4] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
+[4 of 4] Linking src-exe/AltMain
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr
index 20a42baeb9..9d084b94f6 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr
@@ -1,8 +1,8 @@
<no location info>: warning: [-Wmissing-home-modules]
- Modules are not listed in command line but needed for compilation: M1
- Main
-[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-[3 of 3] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
-Linking src-exe/AltMain ...
+ Modules are not listed in command line but needed for compilation:
+ M1 Main
+[1 of 4] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 4] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 4] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
+[4 of 4] Linking src-exe/AltMain
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr
index a29f764a47..b627f7eaf5 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr
@@ -1,7 +1,8 @@
<no location info>: warning: [-Wmissing-home-modules]
- Modules are not listed in command line but needed for compilation: M1
-[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-[3 of 3] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
-Linking src-exe/AltMain ...
+ Modules are not listed in command line but needed for compilation:
+ M1
+[1 of 4] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 4] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 4] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
+[4 of 4] Linking src-exe/AltMain
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr
index a29f764a47..b627f7eaf5 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr
@@ -1,7 +1,8 @@
<no location info>: warning: [-Wmissing-home-modules]
- Modules are not listed in command line but needed for compilation: M1
-[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-[3 of 3] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
-Linking src-exe/AltMain ...
+ Modules are not listed in command line but needed for compilation:
+ M1
+[1 of 4] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 4] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 4] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
+[4 of 4] Linking src-exe/AltMain
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr
index e85f778a56..685860db43 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr
@@ -1,7 +1,8 @@
<no location info>: warning: [-Wmissing-home-modules]
- Modules are not listed in command line but needed for compilation: Main
-[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-[3 of 3] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
-Linking src-exe/AltMain ...
+ Modules are not listed in command line but needed for compilation:
+ Main
+[1 of 4] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 4] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 4] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
+[4 of 4] Linking src-exe/AltMain
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727k.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727k.stderr
index c648d9b593..3cfcf4bcac 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727k.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727k.stderr
@@ -1,4 +1,4 @@
-[1 of 3] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
-[2 of 3] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
-[3 of 3] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
-Linking src-exe/AltMain ...
+[1 of 4] Compiling M1 ( src-lib/M1.hs, src-lib/M1.o )
+[2 of 4] Compiling Main ( src-exe/Main.hs, src-exe/Main.o )
+[3 of 4] Compiling AltMain ( src-exe/AltMain.hs, src-exe/AltMain.o )
+[4 of 4] Linking src-exe/AltMain
diff --git a/testsuite/tests/warnings/should_compile/UnusedPackages.stderr b/testsuite/tests/warnings/should_compile/UnusedPackages.stderr
index ba6a76207f..11f87e6de4 100644
--- a/testsuite/tests/warnings/should_compile/UnusedPackages.stderr
+++ b/testsuite/tests/warnings/should_compile/UnusedPackages.stderr
@@ -5,5 +5,5 @@
- ghc
- process
- bytestring
-[1 of 1] Compiling Main ( UnusedPackages.hs, UnusedPackages.o )
-Linking UnusedPackages ...
+[1 of 2] Compiling Main ( UnusedPackages.hs, UnusedPackages.o )
+[2 of 2] Linking UnusedPackages