Commit c721e851 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov

Merge pull request #1728 from 23Skidoo/install-enable-test

'install --enable-tests' shouldn't actually run tests.
parents d9286320 c28fc177
......@@ -1222,7 +1222,7 @@ installUnpackedPackage
-> IO BuildResult
installUnpackedPackage verbosity buildLimit installLock numJobs
scriptOptions miscOptions
configFlags installConfigFlags haddockFlags
configFlags installFlags haddockFlags
compid platform pkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary
......@@ -1298,12 +1298,13 @@ installUnpackedPackage verbosity buildLimit installLock numJobs
buildDistPref = configDistPref configFlags,
buildVerbosity = toFlag verbosity'
}
shouldHaddock = fromFlag (installDocumentation installConfigFlags)
shouldHaddock = fromFlag (installDocumentation installFlags)
haddockFlags' _ = haddockFlags {
haddockVerbosity = toFlag verbosity',
haddockDistPref = configDistPref configFlags
}
testsEnabled = fromFlag (configTests configFlags)
&& fromFlagOrDefault False (installRunTests installFlags)
testFlags _ = Cabal.emptyTestFlags {
Cabal.testDistPref = configDistPref configFlags
}
......
......@@ -933,7 +933,8 @@ data InstallFlags = InstallFlags {
installBuildReports :: Flag ReportLevel,
installSymlinkBinDir :: Flag FilePath,
installOneShot :: Flag Bool,
installNumJobs :: Flag (Maybe Int)
installNumJobs :: Flag (Maybe Int),
installRunTests :: Flag Bool
}
defaultInstallFlags :: InstallFlags
......@@ -957,7 +958,8 @@ defaultInstallFlags = InstallFlags {
installBuildReports = Flag NoReports,
installSymlinkBinDir = mempty,
installOneShot = Flag False,
installNumJobs = mempty
installNumJobs = mempty,
installRunTests = mempty
}
where
docIndexFile = toPathTemplate ("$datadir" </> "doc" </> "index.html")
......@@ -1136,6 +1138,11 @@ installOptions showOrParseArgs =
installOneShot (\v flags -> flags { installOneShot = v })
(yesNoOpt showOrParseArgs)
, option [] ["run-tests"]
"Run package test suites during installation."
installRunTests (\v flags -> flags { installRunTests = v })
trueArg
, optionNumJobs
installNumJobs (\v flags -> flags { installNumJobs = v })
......@@ -1170,7 +1177,8 @@ instance Monoid InstallFlags where
installBuildReports = mempty,
installSymlinkBinDir = mempty,
installOneShot = mempty,
installNumJobs = mempty
installNumJobs = mempty,
installRunTests = mempty
}
mappend a b = InstallFlags {
installDocumentation = combine installDocumentation,
......@@ -1192,7 +1200,8 @@ instance Monoid InstallFlags where
installBuildReports = combine installBuildReports,
installSymlinkBinDir = combine installSymlinkBinDir,
installOneShot = combine installOneShot,
installNumJobs = combine installNumJobs
installNumJobs = combine installNumJobs,
installRunTests = combine installRunTests
}
where combine field = field a `mappend` field b
......
......@@ -630,7 +630,8 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
let sandboxDistPref = case useSandbox of
NoSandbox -> NoFlag
UseSandbox sandboxDir -> Flag $ sandboxBuildDir sandboxDir
configFlags' = savedConfigureFlags config `mappend` configFlags
configFlags' = maybeForceTests installFlags' $
savedConfigureFlags config `mappend` configFlags
configExFlags' = defaultConfigExFlags `mappend`
savedConfigureExFlags config `mappend` configExFlags
installFlags' = defaultInstallFlags `mappend`
......@@ -674,6 +675,13 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags)
installFlags' haddockFlags'
targets
where
-- '--run-tests' implies '--enable-tests'.
maybeForceTests installFlags' configFlags' =
if fromFlagOrDefault False (installRunTests installFlags')
then configFlags' { configTests = toFlag True }
else configFlags'
testAction :: (TestFlags, BuildFlags, BuildExFlags) -> [String] -> GlobalFlags
-> IO ()
testAction (testFlags, buildFlags, buildExFlags) extraArgs globalFlags = do
......
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