Commit f35f0659 authored by tibbe's avatar tibbe
Browse files

Test suite: reuse compiled Setup.hs to speed up tests

parent ff2b174b
......@@ -28,6 +28,7 @@ import PackageTests.BuildDeps.SameDepsAllRound.Check
import PackageTests.BuildDeps.TargetSpecificDeps1.Check
import PackageTests.BuildDeps.TargetSpecificDeps2.Check
import PackageTests.BuildDeps.TargetSpecificDeps3.Check
import PackageTests.PackageTester (compileSetup)
import PackageTests.PathsModule.Executable.Check
import PackageTests.PathsModule.Library.Check
import PackageTests.PreProcess.Check
......@@ -97,5 +98,7 @@ main = do
putStrLn $ "Cabal test suite - testing cabal version " ++
display cabalVersion
setCurrentDirectory "tests"
-- Create a shared Setup executable to speed up Simple tests
compileSetup "."
defaultMain (tests cabalVersion)
import Distribution.Simple
main = defaultMain
import Distribution.Simple
main = defaultMain
import Distribution.Simple
main = defaultMain
......@@ -15,7 +15,8 @@ module PackageTests.PackageTester (
assertTestSucceeded,
assertInstallSucceeded,
assertOutputContains,
assertOutputDoesNotContain
assertOutputDoesNotContain,
compileSetup
) where
import qualified Control.Exception.Extensible as E
......@@ -134,12 +135,11 @@ cabal_bench spec extraArgs = do
record spec r
return r
-- | Returns the command that was issued, the return code, and hte output text
cabal :: PackageSpec -> [String] -> IO (String, ExitCode, String)
cabal spec cabalArgs = do
compileSetup :: FilePath -> IO ()
compileSetup packageDir = do
wd <- getCurrentDirectory
ghc <- getGHC
r <- run (Just $ directory spec) ghc
r <- run (Just $ packageDir) ghc
[ "--make"
-- HPC causes trouble -- see #1012
-- , "-fhpc"
......@@ -147,7 +147,18 @@ cabal spec cabalArgs = do
, "Setup.hs"
]
requireSuccess r
run (Just $ directory spec) (wd </> directory spec </> "Setup") cabalArgs
-- | Returns the command that was issued, the return code, and hte output text
cabal :: PackageSpec -> [String] -> IO (String, ExitCode, String)
cabal spec cabalArgs = do
customSetup <- doesFileExist (directory spec </> "Setup.hs")
wd <- getCurrentDirectory
if customSetup
then do
compileSetup (directory spec)
run (Just $ directory spec) (wd </> directory spec </> "Setup") cabalArgs
else do
run (Just $ directory spec) (wd </> "Setup") cabalArgs
-- | Returns the command that was issued, the return code, and hte output text
run :: Maybe FilePath -> String -> [String] -> IO (String, ExitCode, String)
......
import Distribution.Simple
main = defaultMain
Supports Markdown
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