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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/9fb5426ba5ac5a83f8d6526488b21b0539f7dad4

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

commit 9fb5426ba5ac5a83f8d6526488b21b0539f7dad4
Author: Johan Tibell <[email protected]>
Date:   Thu Oct 13 23:28:47 2011 +0000

    Fail gracefully if 'cabal bench' is run before 'cabal build'

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

 Cabal/Distribution/Simple/Bench.hs |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Cabal/Distribution/Simple/Bench.hs 
b/Cabal/Distribution/Simple/Bench.hs
index 0d390a1..f34c888 100644
--- a/Cabal/Distribution/Simple/Bench.hs
+++ b/Cabal/Distribution/Simple/Bench.hs
@@ -61,6 +61,7 @@ import Distribution.Text
 
 import Control.Monad ( when, unless )
 import System.Exit ( ExitCode(..), exitFailure, exitWith )
+import System.Directory ( doesFileExist )
 import System.FilePath ( (</>), (<.>) )
 
 -- | Perform the \"@.\/setup bench@\" action.
@@ -87,6 +88,12 @@ bench args pkg_descr lbi flags = do
                       options = map (benchOption pkg_descr lbi bm) $
                                 benchmarkOptions flags
                       name = PD.benchmarkName bm
+                  -- Check that the benchmark executable exists.
+                  exists <- doesFileExist cmd
+                  unless exists $ die $
+                      "Error: Could not find benchmark program \""
+                      ++ cmd ++ "\". Did you build the package first?"
+
                   notice verbosity $ startMessage name
                   -- This will redirect the child process
                   -- stdout/stderr to the parent process.



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to