[commit: Cabal] master: Restore graceful failure upon invoking "cabal test" before "cabal build". (39571ab)

Ian Lynagh igloo at earth.li
Wed Jul 27 20:59:18 CEST 2011


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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/39571ab05c84b1186643da82f32600e24a34d419

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

commit 39571ab05c84b1186643da82f32600e24a34d419
Author: Thomas Tuegel <ttuegel at gmail.com>
Date:   Tue Jul 19 00:22:18 2011 +0000

    Restore graceful failure upon invoking "cabal test" before "cabal build".

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

 cabal/Distribution/Simple/Test.hs |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/cabal/Distribution/Simple/Test.hs b/cabal/Distribution/Simple/Test.hs
index 3476e44..a13a27d 100644
--- a/cabal/Distribution/Simple/Test.hs
+++ b/cabal/Distribution/Simple/Test.hs
@@ -183,6 +183,11 @@ testController flags pkg_descr lbi suite preTest cmd postTest logNamer = do
     bracket (openCabalTemp testLogDir) deleteIfExists $ \tempLog ->
         bracket (openCabalTemp testLogDir) deleteIfExists $ \tempInput -> do
 
+            -- Check that the test executable exists.
+            exists <- doesFileExist cmd
+            unless exists $ die $ "Error: Could not find test program \"" ++ cmd
+                                  ++ "\". Did you build the package first?"
+
             -- Remove old .tix files if appropriate.
             unless (fromFlag $ testKeepTix flags) $ do
                 let tDir = tixDir distPref $ PD.testName suite





More information about the Cvs-libraries mailing list