diff options
| author | Russ Cox <rsc@golang.org> | 2017-06-16 14:46:24 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2017-06-20 14:19:05 +0000 |
| commit | a2a3ace51aa0600765d44a71f47fd830fa6217c5 (patch) | |
| tree | a26628d8938b71fcd9132f9f10a6c6d7931059d6 /src/testing/sub_test.go | |
| parent | be855e3f28507dd3e34eb4699c84493eeaae68db (diff) | |
| download | go-a2a3ace51aa0600765d44a71f47fd830fa6217c5.tar.xz | |
testing: harmonize handling of prefix-matched benchmarks
If you have BenchmarkX1 with sub-benchmark Y
and you have BenchmarkX2 with no sub-benchmarks,
then
go test -bench=X/Y
runs BenchmarkX1 once with b.N=1 (to find out about Y)
and then not again, because it has sub-benchmarks,
but arguably also because we're interested in Y.
In contrast, it runs BenchmarkX2 in full, even though clearly
that is not relevant to the match X/Y. We do have to run X2
once with b.N=1 to probe for having X2/Y, but we should not
run it with larger b.N.
Fixes #20589.
Change-Id: Ib86907e844f34dcaac6cd05757f57db1019201d0
Reviewed-on: https://go-review.googlesource.com/46031
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Diffstat (limited to 'src/testing/sub_test.go')
| -rw-r--r-- | src/testing/sub_test.go | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/testing/sub_test.go b/src/testing/sub_test.go index ab145b5bf4..af2d39c5be 100644 --- a/src/testing/sub_test.go +++ b/src/testing/sub_test.go @@ -7,7 +7,6 @@ package testing import ( "bytes" "fmt" - "os" "regexp" "runtime" "strings" @@ -602,7 +601,6 @@ func TestBenchmark(t *T) { res := Benchmark(func(b *B) { for i := 0; i < 5; i++ { b.Run("", func(b *B) { - fmt.Fprintf(os.Stderr, "b.N: %v\n", b.N) for i := 0; i < b.N; i++ { time.Sleep(time.Millisecond) } |
