[commit: Cabal] master: Remove log files before running tests by default. (7e8dfac)

Ian Lynagh igloo at earth.li
Wed Apr 27 03:23:08 CEST 2011


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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/7e8dfac4a172d403a9f116316ee44f3ca2d003c5

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

commit 7e8dfac4a172d403a9f116316ee44f3ca2d003c5
Author: Thomas Tuegel <ttuegel at gmail.com>
Date:   Thu Mar 3 04:18:40 2011 +0000

    Remove log files before running tests by default.

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

 Distribution/Simple/Test.hs |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Distribution/Simple/Test.hs b/Distribution/Simple/Test.hs
index 92be30e..468ac15 100644
--- a/Distribution/Simple/Test.hs
+++ b/Distribution/Simple/Test.hs
@@ -77,12 +77,12 @@ import Distribution.Verbosity ( normal, Verbosity )
 import Distribution.System ( buildPlatform, Platform )
 
 import Control.Exception ( bracket )
-import Control.Monad ( when, liftM, unless )
+import Control.Monad ( when, liftM, unless, filterM )
 import Data.Char ( toUpper )
 import Data.Monoid ( mempty )
 import System.Directory
     ( createDirectoryIfMissing, doesFileExist, getCurrentDirectory
-    , removeFile )
+    , removeFile, getDirectoryContents )
 import System.Environment ( getEnvironment )
 import System.Exit ( ExitCode(..), exitFailure, exitSuccess, exitWith )
 import System.FilePath ( (</>), (<.>) )
@@ -327,6 +327,11 @@ test pkg_descr lbi flags = do
 
     createDirectoryIfMissing True testLogDir
 
+    -- Delete ordinary files from test log directory.
+    getDirectoryContents testLogDir
+        >>= filterM doesFileExist . map (testLogDir </>)
+        >>= mapM_ removeFile
+
     let totalSuites = length testsToRun
     notice verbosity $ "Running " ++ show totalSuites ++ " test suites..."
     suites <- mapM doTest testsToRun





More information about the Cvs-libraries mailing list