-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5004 from 23Skidoo/disable-per-component
Disable per-component build when program coverage enabled
- Loading branch information
Showing
6 changed files
with
62 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
98 changes: 0 additions & 98 deletions
98
cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/setup-with-hpc.multitest.hs
This file was deleted.
Oops, something went wrong.
Empty file.
18 changes: 0 additions & 18 deletions
18
cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/setup.out
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/setup.test.hs
This file was deleted.
Oops, something went wrong.