On Tue, Oct 25, 2011 at 3:29 PM, Bas van Dijk <v.dijk.bas@gmail.com> wrote:
On 25 October 2011 23:52, Johan Tibell <johan.tibell@gmail.com> wrote:
>> * It would be cool to have a 'cabal bench' command that builds and
>> executes the benchmarks.
>
> There already is one, I just haven't documented it yet. It works just like
> 'cabal test'. Example:
>     cabal configure --enable-benchmarks
>     cabal build
>     cabal bench

Weird, I get a:

$ cabal bench
cabal: unrecognised command: bench (try --help)

and I'm running the latest cabal-install from HEAD:

$ cabal --version
cabal-install version 0.11.3
using version 1.11.3 of the Cabal library

Weird indeed. If you use Setup.hs directly it work:

$ ghc -O Setup.hs -fforce-recomp -package-conf ~/src/cabal/Cabal/dist/package.conf.inplace 
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )
Linking Setup ...
$ ./Setup configure --user --enable-benchmarks
Configuring foo-1.0...
$ ./Setup build
Building foo-1.0...
Preprocessing executable 'foo' for foo-1.0...
[1 of 1] Compiling Main             ( bench-foo.hs, dist/build/foo/foo-tmp/Main.o )
Linking dist/build/foo/foo ...
Preprocessing benchmark 'bench-foo' for foo-1.0...
[1 of 1] Compiling Main             ( bench-foo.hs, dist/build/bench-foo/bench-foo-tmp/Main.o )
Linking dist/build/bench-foo/bench-foo ...
$ ./Setup bench
Running 1 benchmarks...
Benchmark bench-foo: RUNNING...
fib 20 took 0.000667s
Benchmark bench-foo: FINISH