]> Cypherpunks repositories - gostls13.git/commit
testing: make failure in benchmark cause non-zero exit status
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 26 Feb 2016 19:36:50 +0000 (16:36 -0300)
committerIan Lance Taylor <iant@golang.org>
Sun, 28 Feb 2016 05:19:05 +0000 (05:19 +0000)
commit3cb870d47b5611465c46c6a6512b7f059584c66f
treeadbbaab3b6020f63dcce4e23d276e4fdfecacb3d
parentc8ef0df06cbab367ab943825ab0677e03d019c3d
testing: make failure in benchmark cause non-zero exit status

Moves the implementation of RunBenchmarks to a non-exported function
that returns whether the execution was OK, and uses that to identify
failure in benchmarks.The exported function is kept for compatibility.

Like before, benchmarks will only be executed if tests and examples
pass. The PASS message will not be printed if there was a failure in
a benchmark.

Example output

BenchmarkThatCallsFatal-8 --- FAIL: BenchmarkThatCallsFatal-8
x_test.go:6: called by benchmark
FAIL
exit status 1
FAIL _/.../src/cmd/go/testdata/src/benchfatal 0.009s

Fixes #14307.

Change-Id: I6f3ddadc7da8a250763168cc099ae8b325a79602
Reviewed-on: https://go-review.googlesource.com/19889
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/go_test.go
src/cmd/go/testdata/src/benchfatal/x_test.go [new file with mode: 0644]
src/testing/benchmark.go
src/testing/testing.go