aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2017-07-09 00:49:24 +0200
committerDaniel Gröber <dxld@darkboxed.org>2017-07-09 00:49:24 +0200
commitde151994d105698a80da2b48bc9f007ee6965163 (patch)
tree3517ea6edeb6dc3b4a298a24a1e8a2e52694401e
parentc17a519c3c3f07d483708d0ef9e1ed63d93033ea (diff)
spec: Allow Cabal HEAD to fail to compile
-rw-r--r--tests/Spec.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/Spec.hs b/tests/Spec.hs
index 48be9b7..831c283 100644
--- a/tests/Spec.hs
+++ b/tests/Spec.hs
@@ -125,14 +125,19 @@ data HEAD = HEAD deriving (Eq, Show)
compilePrivatePkgDb :: Either HEAD Version -> IO (Either ExitCode FilePath)
compilePrivatePkgDb (Left HEAD) = do
_ <- rawSystem "rm" [ "-r", "/tmp/.ghc-mod" ]
- (db, commit) <- installCabalHEAD defaultOptions { verbose = True } `E.catch`
- \(SomeException ex) ->
- error $ "Installing cabal HEAD failed: " ++ show ex
- compileWithPkg "." (Just db) (Left commit)
+ res <- (Right <$> installCabalHEAD defaultOptions { verbose = True })
+ `E.catch` \(SomeException ex) -> return $ Left $
+ "ERROR: Installing cabal HEAD failed: " ++ show ex
+ case res of
+ Left err -> do
+ hPutStrLn stderr err
+ return $ Left $ ExitFailure 1
+ Right (db, commit) ->
+ compileWithPkg "." (Just db) (Left commit)
compilePrivatePkgDb (Right cabalVer) = do
_ <- rawSystem "rm" [ "-r", "/tmp/.ghc-mod" ]
db <- installCabal defaultOptions { verbose = True } cabalVer `E.catch`
- \(SomeException _) ->
+ \(SomeException _) -> do
errorInstallCabal cabalVer "dist"
compileWithPkg "." (Just db) (Right cabalVer)