[commit: Cabal] master: Fail gracefully if 'cabal bench' is run before 'cabal build' (9fb5426)
Ian Lynagh
igloo at earth.li
Tue Oct 25 23:31:08 CEST 2011
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 <johan.tibell at gmail.com>
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.
More information about the Cvs-libraries
mailing list