Commit d9c48250 authored by Andreas Klebinger's avatar Andreas Klebinger

Output stderr if test fails

parent 8bde86ae
......@@ -21,6 +21,7 @@ import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import System.Info hiding (compilerVersion)
import System.Exit
import qualified System.IO as IO
import Options.Applicative
-- Shake - build system
......@@ -126,7 +127,7 @@ main = do
{ shakeThreads = threads
, shakeFiles = output ++ "/"
, shakeReport = [output ++ "/shake_report.html"]
, shakeStaunch = False
, shakeStaunch = True
, shakeVerbosity = Development.Shake.Loud
}
......@@ -512,12 +513,17 @@ runTest nofib@Build{..} runMode resultsTsv = do
let doRun :: Int -> Action ()
doRun n = do
let rtsStatsOut = executable <.> "stats" <.> show n
(Exit c, Stderr err, Stdout out) <-
(Exit c, Stderr (err :: BSL.ByteString), Stdout out) <-
cmd (Cwd $ src_dir) (EchoStdout False) (StdinBS stdin)
(getWrapperArgs runMode $ n)
executable args "+RTS" rts_args "--machine-readable" ("-t"++rtsStatsOut)
unless (c == ExitSuccess) $ do
fail $ "Benchmark failed:" ++ src_dir ++ " exit code:" ++ show c
liftIO $ IO.hPutStrLn IO.stderr $ "Unexpect exit code:" ++ show c
unless (BSL.null err) $ liftIO $ do
BSL.hPutStr IO.stderr $ BSL.pack "Stderr output:\n"
BSL.hPutStrLn IO.stderr $ err
fail $ "Benchmark failed:" ++ src_dir
-- We simply drop '\r' from both expected and actual output when comparing
-- them. This avoids windows line ending issues.
......@@ -528,7 +534,7 @@ runTest nofib@Build{..} runMode resultsTsv = do
case stdout of
-- There is an stdout file, compare actual and expected stdout.
Just stdout'
| (BSL.filter (not . isNewlineChar) out) /= (BSL.filter (not . isNewlineChar) (fromJust stdout)) -> do
| (BSL.filter (not . isNewlineChar) out) /= (BSL.filter (not . isNewlineChar) stdout') -> do
liftIO $ do
let actual_path = output </> src_dir </> "stdout.actual"
let expected_path = output </> src_dir </> "stdout.expected"
......@@ -537,7 +543,7 @@ runTest nofib@Build{..} runMode resultsTsv = do
putStrLn "Start of actual output:"
BSL.putStrLn $ BSL.take 800 out
putStrLn "Start of expected output:"
BSL.putStrLn $ BSL.take 800 (fromJust stdout)
BSL.putStrLn $ BSL.take 800 stdout'
putStrLn $ "Full expected/actual output written to " ++ (output </> src_dir)
fail $ "Benchmark failed:" ++ src_dir ++ " unexpected stdout:^"
-- No stdout file, ignore stdout
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment