Skip to content

Commit

Permalink
Merge pull request #5004 from 23Skidoo/disable-per-component
Browse files Browse the repository at this point in the history
Disable per-component build when program coverage enabled
  • Loading branch information
23Skidoo committed Jan 7, 2018
2 parents 4b9cc71 + b12fd31 commit c63860c
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 124 deletions.
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.

0 comments on commit c63860c

Please sign in to comment.