From de151994d105698a80da2b48bc9f007ee6965163 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sun, 9 Jul 2017 00:49:24 +0200 Subject: spec: Allow Cabal HEAD to fail to compile --- tests/Spec.hs | 15 ++++++++++----- 1 file 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) -- cgit v1.2.3