Commit 63fc9dea authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

'install --enable-tests' shouldn't actually run tests.

Add a new flag '--run-tests' for running tests. Fixes #1647.
parent 899d874a
...@@ -1222,7 +1222,7 @@ installUnpackedPackage ...@@ -1222,7 +1222,7 @@ installUnpackedPackage
-> IO BuildResult -> IO BuildResult
installUnpackedPackage verbosity buildLimit installLock numJobs installUnpackedPackage verbosity buildLimit installLock numJobs
scriptOptions miscOptions scriptOptions miscOptions
configFlags installConfigFlags haddockFlags configFlags installFlags haddockFlags
compid platform pkg pkgoverride workingDir useLogFile = do compid platform pkg pkgoverride workingDir useLogFile = do
-- Override the .cabal file if necessary -- Override the .cabal file if necessary
...@@ -1298,12 +1298,13 @@ installUnpackedPackage verbosity buildLimit installLock numJobs ...@@ -1298,12 +1298,13 @@ installUnpackedPackage verbosity buildLimit installLock numJobs
buildDistPref = configDistPref configFlags, buildDistPref = configDistPref configFlags,
buildVerbosity = toFlag verbosity' buildVerbosity = toFlag verbosity'
} }
shouldHaddock = fromFlag (installDocumentation installConfigFlags) shouldHaddock = fromFlag (installDocumentation installFlags)
haddockFlags' _ = haddockFlags { haddockFlags' _ = haddockFlags {
haddockVerbosity = toFlag verbosity', haddockVerbosity = toFlag verbosity',
haddockDistPref = configDistPref configFlags haddockDistPref = configDistPref configFlags
} }
testsEnabled = fromFlag (configTests configFlags) testsEnabled = fromFlag (configTests configFlags)
&& fromFlagOrDefault False (installRunTests installFlags)
testFlags _ = Cabal.emptyTestFlags { testFlags _ = Cabal.emptyTestFlags {
Cabal.testDistPref = configDistPref configFlags Cabal.testDistPref = configDistPref configFlags
} }
......
...@@ -933,7 +933,8 @@ data InstallFlags = InstallFlags { ...@@ -933,7 +933,8 @@ data InstallFlags = InstallFlags {
installBuildReports :: Flag ReportLevel, installBuildReports :: Flag ReportLevel,
installSymlinkBinDir :: Flag FilePath, installSymlinkBinDir :: Flag FilePath,
installOneShot :: Flag Bool, installOneShot :: Flag Bool,
installNumJobs :: Flag (Maybe Int) installNumJobs :: Flag (Maybe Int),
installRunTests :: Flag Bool
} }
defaultInstallFlags :: InstallFlags defaultInstallFlags :: InstallFlags
...@@ -957,7 +958,8 @@ defaultInstallFlags = InstallFlags { ...@@ -957,7 +958,8 @@ defaultInstallFlags = InstallFlags {
installBuildReports = Flag NoReports, installBuildReports = Flag NoReports,
installSymlinkBinDir = mempty, installSymlinkBinDir = mempty,
installOneShot = Flag False, installOneShot = Flag False,
installNumJobs = mempty installNumJobs = mempty,
installRunTests = mempty
} }
where where
docIndexFile = toPathTemplate ("$datadir" </> "doc" </> "index.html") docIndexFile = toPathTemplate ("$datadir" </> "doc" </> "index.html")
...@@ -1136,6 +1138,11 @@ installOptions showOrParseArgs = ...@@ -1136,6 +1138,11 @@ installOptions showOrParseArgs =
installOneShot (\v flags -> flags { installOneShot = v }) installOneShot (\v flags -> flags { installOneShot = v })
(yesNoOpt showOrParseArgs) (yesNoOpt showOrParseArgs)
, option [] ["run-tests"]
"Run package test suites during installation."
installRunTests (\v flags -> flags { installRunTests = v })
trueArg
, optionNumJobs , optionNumJobs
installNumJobs (\v flags -> flags { installNumJobs = v }) installNumJobs (\v flags -> flags { installNumJobs = v })
...@@ -1170,7 +1177,8 @@ instance Monoid InstallFlags where ...@@ -1170,7 +1177,8 @@ instance Monoid InstallFlags where
installBuildReports = mempty, installBuildReports = mempty,
installSymlinkBinDir = mempty, installSymlinkBinDir = mempty,
installOneShot = mempty, installOneShot = mempty,
installNumJobs = mempty installNumJobs = mempty,
installRunTests = mempty
} }
mappend a b = InstallFlags { mappend a b = InstallFlags {
installDocumentation = combine installDocumentation, installDocumentation = combine installDocumentation,
...@@ -1192,7 +1200,8 @@ instance Monoid InstallFlags where ...@@ -1192,7 +1200,8 @@ instance Monoid InstallFlags where
installBuildReports = combine installBuildReports, installBuildReports = combine installBuildReports,
installSymlinkBinDir = combine installSymlinkBinDir, installSymlinkBinDir = combine installSymlinkBinDir,
installOneShot = combine installOneShot, installOneShot = combine installOneShot,
installNumJobs = combine installNumJobs installNumJobs = combine installNumJobs,
installRunTests = combine installRunTests
} }
where combine field = field a `mappend` field b where combine field = field a `mappend` field b
......
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