maybench 0.2.3.1 → 0.2.4
raw patch · 2 files changed
+20/−6 lines, 2 filesdep +Cabal
Dependencies added: Cabal
Files
- darcs-benchmark/DarcsBenchmark.hs +17/−4
- maybench.cabal +3/−2
darcs-benchmark/DarcsBenchmark.hs view
@@ -8,14 +8,17 @@ import Data.List (isInfixOf) import Data.Maybe (listToMaybe) import Data.Time.Clock (getCurrentTime,diffUTCTime)-import System.FilePath ((</>),isAbsolute)+import Distribution.Version (showVersion)+import System.FilePath ((</>),isRelative) import System.Directory (createDirectory, setCurrentDirectory, removeDirectoryRecursive,- doesFileExist, doesDirectoryExist, findExecutable,+ doesFileExist, doesDirectoryExist, getTemporaryDirectory, getCurrentDirectory )+import System.Exit(exitWith,ExitCode(ExitSuccess)) import System.IO (hPutStrLn,stderr) import System.Environment (getArgs) import System.Console.GetOpt +import qualified Paths_maybench import Test.Maybench (run) import Test.Maybench.Command (Command(..), CommandModifier(..), CommandModifierClass, modifyCmd, (<@>), updateCmdInput, addArgs)@@ -154,7 +157,7 @@ -- | Split a string in two at and dropping @delim@ breakOn :: Char -- ^ delim -> String -> (String, String)-breakOn c = second (drop 1) . break (== c)+breakOn c = second tail . break (== c) -- get -- URL@@ -256,6 +259,7 @@ <$> (run $ darcs_show_repo <@> RepoDir repo) data Flag = DarcsFlag [String]+ | VersionFlag | RepoFlag String | InteractiveFlag | HelpFlag deriving (Eq)@@ -267,6 +271,7 @@ options :: [OptDescr Flag] options = [Option ['h','?'] ["help"] (NoArg HelpFlag) "show this help message",+ Option ['v'] ["version"] (NoArg VersionFlag) "show maybench version", Option ['i'] ["interactive"] (NoArg InteractiveFlag) "use the interactive mode of darcs", Option ['r'] ["repo"] (ReqArg RepoFlag "URL") "run on a specific repository", Option [] ["darcs"] (ReqArg darcsList "CMD1,CMD2,...") "set the darcs commands to use"]@@ -281,6 +286,10 @@ "If you pass in no arguments, maybench will run its own set of standard\n" ++ "darcs benchmarks." +version :: IO ()+version = do putStrLn $ me ++ " " ++ showVersion Paths_maybench.version+ exitWith ExitSuccess+ me :: String me = "darcs-benchmark" @@ -324,9 +333,13 @@ (o,n,[]) -> return (o,n) (_,_,errs) -> usage errs when (HelpFlag `elem` opts) $ usage []+ when (VersionFlag `elem` opts) $ version+ cwd <- getCurrentDirectory+ let mkAbsolute p = if isRelative p then cwd </> p else p -- let mUrl = listToMaybe [ f | RepoFlag f <- opts ]- dCmds = replaceNil "darcs" $ concat [ f | DarcsFlag f <- opts ]+ dCmds = replaceNil "darcs" $ map mkAbsolute+ $ concat [ f | DarcsFlag f <- opts ] conf dcmd = BenchConf { benchUrlRepo = undefined , benchCounts = undefined , interactive = InteractiveFlag `elem` opts
maybench.cabal view
@@ -1,5 +1,5 @@ Name: maybench-Version: 0.2.3.1+Version: 0.2.4 License: BSD3 License-file: LICENSE Author: Maybench developers@@ -50,7 +50,8 @@ Executable darcs-benchmark Hs-Source-Dirs: ., darcs-benchmark- build-depends: benchpress >= 0.2.2 && < 0.2.3+ build-depends: benchpress >= 0.2.2 && < 0.2.3,+ Cabal >= 1.2 && < 1.5 if flag(splitBase) build-depends: base >= 3, process, directory, time, mtl, filepath