• Caio Marcelo de Oliveira Filho's avatar
    testing: make failure in benchmark cause non-zero exit status · 3cb870d4
    Caio Marcelo de Oliveira Filho authored
    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/19889Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    3cb870d4
benchmark.go 13.4 KB