Commit 0b463457 authored by ttuegel's avatar ttuegel
Browse files

fix HPC tests with GHC 7.10

Starting with version 7.10, GHC puts the module interface (.mix) files
for each project in a subdirectory of -hpcdir named for the package
key. We must adjust the search path accordingly when checking for the
.mix file.
parent cbd9d53b
...@@ -10,11 +10,16 @@ import Test.Framework (testGroup) ...@@ -10,11 +10,16 @@ import Test.Framework (testGroup)
import Test.Framework.Providers.HUnit (hUnitTestToTests) import Test.Framework.Providers.HUnit (hUnitTestToTests)
import Test.HUnit hiding ( path ) import Test.HUnit hiding ( path )
import Distribution.Compiler (CompilerFlavor(..), CompilerId(..))
import Distribution.PackageDescription (package)
import Distribution.Simple.Compiler (compilerId)
import Distribution.Simple.Configure (getPersistBuildConfig) import Distribution.Simple.Configure (getPersistBuildConfig)
import Distribution.Simple.LocalBuildInfo (compiler, localPkgDescr, pkgKey)
import Distribution.Simple.Hpc import Distribution.Simple.Hpc
import Distribution.Simple.Program.Builtin (hpcProgram) import Distribution.Simple.Program.Builtin (hpcProgram)
import Distribution.Simple.Program.Db import Distribution.Simple.Program.Db
( emptyProgramDb, configureProgram, requireProgramVersion ) ( emptyProgramDb, configureProgram, requireProgramVersion )
import Distribution.Text (display)
import qualified Distribution.Verbosity as Verbosity import qualified Distribution.Verbosity as Verbosity
import Distribution.Version (Version(..), orLaterVersion) import Distribution.Version (Version(..), orLaterVersion)
...@@ -70,16 +75,20 @@ checkTestWithHpc :: FilePath -> String -> [String] -> Test ...@@ -70,16 +75,20 @@ checkTestWithHpc :: FilePath -> String -> [String] -> Test
checkTestWithHpc ghcPath name extraOpts = TestCase $ do checkTestWithHpc ghcPath name extraOpts = TestCase $ do
isCorrectVersion <- correctHpcVersion isCorrectVersion <- correctHpcVersion
when isCorrectVersion $ do when isCorrectVersion $ do
let distPref' = dir </> "dist-" ++ name
buildAndTest ghcPath name [] ("--enable-coverage" : extraOpts) buildAndTest ghcPath name [] ("--enable-coverage" : extraOpts)
lbi <- getPersistBuildConfig (dir </> "dist-" ++ name) lbi <- getPersistBuildConfig distPref'
let way = guessWay lbi let way = guessWay lbi
CompilerId comp version = compilerId (compiler lbi)
subdir
| comp == GHC && version >= Version [7, 10] [] =
display (pkgKey lbi)
| otherwise = display (package $ localPkgDescr lbi)
mapM_ shouldExist mapM_ shouldExist
[ mixDir (dir </> "dist-" ++ name) way "my-0.1" [ mixDir distPref' way "my-0.1" </> subdir </> "Foo.mix"
</> "my-0.1" </> "Foo.mix" , mixDir distPref' way "test-Foo" </> "Main.mix"
, mixDir (dir </> "dist-" ++ name) way "test-Foo" </> "Main.mix" , tixFilePath distPref' way "test-Foo"
, tixFilePath (dir </> "dist-" ++ name) way "test-Foo" , htmlDir distPref' way "test-Foo" </> "hpc_index.html"
, htmlDir (dir </> "dist-" ++ name) way "test-Foo"
</> "hpc_index.html"
] ]
-- | Ensures that even if -fhpc is manually provided no .tix file is output. -- | Ensures that even if -fhpc is manually provided no .tix file is output.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment