diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2017-07-09 00:49:24 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2017-07-09 00:49:24 +0200 |
commit | de151994d105698a80da2b48bc9f007ee6965163 (patch) | |
tree | 3517ea6edeb6dc3b4a298a24a1e8a2e52694401e /tests | |
parent | c17a519c3c3f07d483708d0ef9e1ed63d93033ea (diff) |
spec: Allow Cabal HEAD to fail to compile
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Spec.hs | 15 |
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) |