Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable per-component build when program coverage enabled #5004

Merged
merged 4 commits into from
Jan 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion cabal-install/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
where
-- You are eligible to per-component build if this list is empty
why_not_per_component g
= cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag
= cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag ++ cuz_coverage
where
cuz reason = [text reason]
-- We have to disable per-component for now with
Expand Down Expand Up @@ -1256,6 +1256,12 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
| fromFlagOrDefault True (projectConfigPerComponent sharedPackageConfig)
= []
| otherwise = cuz "you passed --disable-per-component"
-- Enabling program coverage introduces odd runtime dependencies
-- between components.
cuz_coverage
| fromFlagOrDefault False (packageConfigCoverage localPackagesConfig)
= cuz "program coverage is enabled"
| otherwise = []

-- | Sometimes a package may make use of features which are only
-- supported in per-package mode. If this is the case, we should
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import qualified Control.Exception as E (IOException, catch)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Reader (ask)
import Data.Maybe (catMaybes)

import qualified Distribution.Verbosity as Verbosity

import Test.Cabal.Prelude

main = cabalTest $ do
skipIf =<< isOSX -- TODO: re-enable this once the macOS Travis
-- issues are resolved, see discussion in #4902.

hasShared <- hasSharedLibraries
hasProfiled <- hasProfiledLibraries
hpcOk <- correctHpcVersion

forM_ (choose4 [True, False]) $ \(libProf, exeProf, exeDyn, shared) ->
do
let
opts = catMaybes
[ enable libProf "library-profiling"
, enable exeProf "profiling"
, enable exeDyn "executable-dynamic"
, enable shared "shared"
]
where
enable cond flag
| cond = Just $ "--enable-" ++ flag
| otherwise = Nothing
args = "test-Short" : "--enable-coverage" : opts
recordMode DoNotRecord $ do
let
skip =
not hpcOk
|| (not hasShared && (exeDyn || shared))
|| (not hasProfiled && (libProf || exeProf))
unless skip $ cabal "new-test" args
where
choose4 :: [a] -> [(a, a, a, a)]
choose4 xs = liftM4 (,,,) xs xs xs xs

-- | Checks for a suitable HPC version for testing.
correctHpcVersion :: TestM Bool
correctHpcVersion = do
let verbosity = Verbosity.normal
verRange = orLaterVersion (mkVersion [0,7])
progDB <- testProgramDb `fmap` ask
liftIO $ (requireProgramVersion verbosity hpcProgram verRange progDB
>> return True) `catchIO` (\_ -> return False)
where
-- Distribution.Compat.Exception is hidden.
catchIO :: IO a -> (E.IOException -> IO a) -> IO a
catchIO = E.catch

This file was deleted.

Empty file.
18 changes: 0 additions & 18 deletions cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/setup.out

This file was deleted.

This file was deleted.