From 49dca6e8963a8fcd4e30d76d65068e9fa76a4a8d Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sat, 2 Dec 2017 14:52:57 +0100 Subject: ghc-session: Make tests fail on warnings --- tests/GhcSession.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs index bbd6bfb..0deefca 100644 --- a/tests/GhcSession.hs +++ b/tests/GhcSession.hs @@ -88,9 +88,10 @@ test dir = do let qe = mkQueryEnv dir (dir "dist") cs <- runQuery qe $ components $ (,,) <$> entrypoints <.> ghcOptions forM cs $ \(ep, opts, cn) -> do - let sopts = intercalate " " $ map formatArg $ "ghc" : opts + let opts' = "-Werror" : opts + let sopts = intercalate " " $ map formatArg $ "ghc" : opts' putStrLn $ "\n" ++ show cn ++ ": " ++ sopts - compileModule ep opts + compileModule ep opts' where formatArg x | "-" `isPrefixOf` x = "\n "++x @@ -109,6 +110,8 @@ compileModule ep opts = do runGhc (Just libdir) $ do + handleSourceError (\e -> GHC.printException e >> return False) $ do + dflags0 <- getSessionDynFlags let dflags1 = dflags0 { ghcMode = CompManager -- cgit v1.2.3