[commit: Cabal] master: Don't prefix test output with ">>>". (d47f089)

Ian Lynagh igloo at earth.li
Tue Jul 19 15:25:48 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d47f08981f8292441dd363a39a5442c5ea0bac3b

>---------------------------------------------------------------

commit d47f08981f8292441dd363a39a5442c5ea0bac3b
Author: Thomas Tuegel <ttuegel at gmail.com>
Date:   Fri Jul 8 03:50:07 2011 +0000

    Don't prefix test output with ">>>".
    Ticket #848. Removing the prefix brings "cabal test" in line with other cabal
    commands, which do not prefix their output, either. Prior to this patch, the
    summary notices which appear before and after each test suite were written to
    the temporary log file along with the stdio from the test executable; this would
    lead to duplicate notices when the contents of the temporary log file are read
    onto the console. After this patch, the summary notices are never written to the
    temporary log file, only to the console and the final log file (which is never
    read by Cabal), removing the confusing duplicate notices.

>---------------------------------------------------------------

 cabal/Distribution/Simple/Test.hs |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/cabal/Distribution/Simple/Test.hs b/cabal/Distribution/Simple/Test.hs
index ad2c1a9..6cba127 100644
--- a/cabal/Distribution/Simple/Test.hs
+++ b/cabal/Distribution/Simple/Test.hs
@@ -194,9 +194,8 @@ testController flags pkg_descr lbi suite preTest cmd postTest logNamer = do
             unless (fromFlag $ testKeepTix flags)
                 $ mapM_ deleteIfExists tixFiles
 
-            -- Write summary notices indicating start of test suite
+            -- Write summary notice to console indicating start of test suite
             notice verbosity $ summarizeSuiteStart $ PD.testName suite
-            appendFile tempLog $ summarizeSuiteStart $ PD.testName suite
 
             -- Prepare standard input for test executable
             appendFile tempInput $ preTest tempInput
@@ -218,21 +217,24 @@ testController flags pkg_descr lbi suite preTest cmd postTest logNamer = do
             let finalLogName = testLogDir </> logNamer suiteLog
                 suiteLog' = suiteLog { logFile = finalLogName }
 
-            -- Write summary notice to log file indicating end of test suite
-            appendFile tempLog $ summarizeSuiteFinish suiteLog'
+            -- Write summary notice to log file indicating start of test suite
+            appendFile (logFile suiteLog') $ summarizeSuiteStart $ PD.testName suite
 
             -- Append contents of temporary log file to the final human-
             -- readable log file
             readFile tempLog >>= appendFile (logFile suiteLog')
 
+            -- Write end-of-suite summary notice to log file
+            appendFile (logFile suiteLog') $ summarizeSuiteFinish suiteLog'
+
             -- Show the contents of the human-readable log file on the terminal
             -- if there is a failure and/or detailed output is requested
             let details = fromFlag $ testShowDetails flags
                 whenPrinting = when $ (details > Never)
                     && (not (suitePassed suiteLog) || details == Always)
                     && verbosity >= normal
-            whenPrinting $ readFile (logFile suiteLog') >>=
-                putStr . unlines . map (">>> " ++) . lines
+            whenPrinting $ readFile tempLog >>=
+                putStr . unlines . lines
 
             -- Write summary notice to terminal indicating end of test suite
             notice verbosity $ summarizeSuiteFinish suiteLog'





More information about the Cvs-libraries mailing list