diff options
| author | Junyang Shao <shaojunyang@google.com> | 2024-11-14 07:34:51 +0800 |
|---|---|---|
| committer | Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-11-20 23:19:48 +0000 |
| commit | 558f5372fc524e69ade3ab3fe36b1913a4095398 (patch) | |
| tree | b95143bb0a6d8db5e4811626afb2b26575dbf8df /src/testing/benchmark_test.go | |
| parent | 60299c251364c6f4a830721e4953230260d118a0 (diff) | |
| download | go-558f5372fc524e69ade3ab3fe36b1913a4095398.tar.xz | |
cmd/compile,testing: implement one-time rampup logic for testing.B.Loop
testing.B.Loop now does its own loop scheduling without interaction with b.N.
b.N will be updated to the actual iterations b.Loop controls when b.Loop returns false.
This CL also added tests for fixed iteration count (benchtime=100x case).
This CL also ensured that b.Loop() is inlined.
For #61515
Change-Id: Ia15f4462f4830ef4ec51327520ff59910eb4bb58
Reviewed-on: https://go-review.googlesource.com/c/go/+/627755
Reviewed-by: Michael Pratt <mpratt@google.com>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/testing/benchmark_test.go')
| -rw-r--r-- | src/testing/benchmark_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/testing/benchmark_test.go b/src/testing/benchmark_test.go index b5ad213fb3..01bb695726 100644 --- a/src/testing/benchmark_test.go +++ b/src/testing/benchmark_test.go @@ -141,6 +141,9 @@ func TestLoopEqualsRangeOverBN(t *testing.T) { if nIterated != nInfered { t.Fatalf("Iteration of the two different benchmark loop flavor differs, got %d iterations want %d", nIterated, nInfered) } + if nIterated == 0 { + t.Fatalf("Iteration count zero") + } } func ExampleB_RunParallel() { |
