cli: fix benchmark build failure (fixes #423)

This commit is contained in:
Simon Michael 2016-10-27 07:00:06 -07:00
parent ae794be55d
commit 13a8f21dc5

View File

@ -24,10 +24,14 @@ main = do
-- withArgs ["--criterion"] $ do -- withArgs ["--criterion"] $ do
args <- getArgs args <- getArgs
if "--criterion" `elem` args if "--criterion" `elem` args
then withArgs [] benchWithCriterion then
else if "--quickbench" `elem` args withArgs [] benchWithCriterion
then benchWithQuickbench else
else benchWithTimeit -- if "--quickbench" `elem` args
-- then
-- benchWithQuickbench
-- else
benchWithTimeit
benchWithTimeit = do benchWithTimeit = do
getCurrentDirectory >>= printf "Benchmarking hledger in %s with timeit\n" getCurrentDirectory >>= printf "Benchmarking hledger in %s with timeit\n"
@ -57,13 +61,13 @@ benchWithCriterion = do
bench ("stats") $ nfIO $ stats opts j bench ("stats") $ nfIO $ stats opts j
] ]
benchWithQuickbench = do -- benchWithQuickbench = do
let whichcmd = if os == "mingw32" then "where" else "which" -- let whichcmd = if os == "mingw32" then "where" else "which"
exe <- init <$> readProcess whichcmd ["hledger"] "" -- exe <- init <$> readProcess whichcmd ["hledger"] ""
pwd <- getCurrentDirectory -- pwd <- getCurrentDirectory
printf "Benchmarking %s in %s with quickbench and shell\n" exe pwd -- printf "Benchmarking %s in %s with quickbench and shell\n" exe pwd
flip withArgs QuickBench.defaultMain [ -- flip withArgs QuickBench.defaultMain [
"-fbench/default.bench" -- "-fbench/default.bench"
,"-v" -- ,"-v"
,"hledger" -- ,"hledger"
] -- ]