[commit: Cabal] master: Fail gracefully when running "setup test" before "setup build". (418c6a1)

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


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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/418c6a1fdfd7c9cd8b98179b409c5060a3d2d2a8

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

commit 418c6a1fdfd7c9cd8b98179b409c5060a3d2d2a8
Author: Thomas Tuegel <ttuegel at gmail.com>
Date:   Thu Mar 3 16:46:11 2011 +0000

    Fail gracefully when running "setup test" before "setup 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 9ee670b..ad2c1a9 100644
--- a/cabal/Distribution/Simple/Test.hs
+++ b/cabal/Distribution/Simple/Test.hs
@@ -181,6 +181,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?"
+
             -- Create directory for HPC files.
             createDirectoryIfMissing True $ tixDir distPref suite
 





More information about the Cvs-libraries mailing list