Commit e702bfd2 authored by tibbe's avatar tibbe
Browse files

Build executable benchmarks

Benchmarks are treated just like test suites in that a dummy
Executable is created and built.
parent 4f5ab192
......@@ -69,7 +69,8 @@ import Distribution.Simple.Compiler
( CompilerFlavor(..), compilerFlavor, PackageDB(..) )
import Distribution.PackageDescription
( PackageDescription(..), BuildInfo(..), Library(..), Executable(..)
, TestSuite(..), TestSuiteInterface(..) )
, TestSuite(..), TestSuiteInterface(..), Benchmark(..)
, BenchmarkInterface(..) )
import qualified Distribution.InstalledPackageInfo as IPI
import qualified Distribution.ModuleName as ModuleName
......@@ -231,6 +232,26 @@ build pkg_descr lbi flags suffixes = do
TestSuiteUnsupported tt -> die $ "No support for building test suite "
++ "type " ++ display tt
CBench bm -> do
case benchmarkInterface bm of
BenchmarkExeV10 _ f -> do
let bi = benchmarkBuildInfo bm
exe = Executable
{ exeName = benchmarkName bm
, modulePath = f
, buildInfo = bi
}
progs' = addInternalBuildTools pkg_descr lbi bi (withPrograms lbi)
lbi' = lbi {
withPrograms = progs',
withPackageDB = withPackageDB lbi ++ [internalPackageDB]
}
pre comp lbi'
info verbosity $ "Building benchmark " ++ benchmarkName bm ++ "..."
buildExe verbosity pkg_descr lbi' exe clbi
BenchmarkUnsupported tt -> die $ "No support for building benchmark "
++ "type " ++ display tt
-- | Initialize a new package db file for libraries defined
-- internally to the package.
createInternalPackageDB :: FilePath -> IO PackageDB
......
......@@ -207,6 +207,9 @@ allComponentsBy pkg_descr f =
++ [ f (CTest tst) | tst <- testSuites pkg_descr
, buildable (testBuildInfo tst)
, testEnabled tst ]
++ [ f (CBench bm) | bm <- benchmarks pkg_descr
, buildable (benchmarkBuildInfo bm)
, benchmarkEnabled bm ]
-- |If the package description has a library section, call the given
-- function with the library build info as argument. Extended version of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment