diff options
| author | Dmitri Shuralyov <dmitshur@golang.org> | 2024-12-01 17:22:19 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-12-02 18:59:26 +0000 |
| commit | 3374abeb50bbf31b7f4d2c7986d08384d673447d (patch) | |
| tree | 3687f67c3f39de6cde359f098af1c4939451dfaa /src/testing | |
| parent | e5489a34ca2c31608821d3ac4ec07892fb6a2272 (diff) | |
| download | go-3374abeb50bbf31b7f4d2c7986d08384d673447d.tar.xz | |
testing: consider -N suffix after benchmark name optional
A "-N" suffix is left out when GOMAXPROCS is 1.
Also match at least 1 space (\s+ instead of \s*), remove trailing '.*'
(it's a no-op), and make the test error message style more consistent
while here.
For #61515.
Fixes #70627.
Change-Id: Id0a17478ac31e2934a663dd0d3b1b37f24974989
Cq-Include-Trybots: luci.golang.try:gotip-plan9-386
Reviewed-on: https://go-review.googlesource.com/c/go/+/632655
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/testing')
| -rw-r--r-- | src/testing/testing_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/testing/testing_test.go b/src/testing/testing_test.go index 1e32a1e615..797728c7a8 100644 --- a/src/testing/testing_test.go +++ b/src/testing/testing_test.go @@ -990,9 +990,9 @@ func TestBenchmarkBLoopIterationCorrect(t *testing.T) { t.Errorf("got %d loop rampup; want %d", c, want) } - re := regexp.MustCompile(`BenchmarkBLoopPrint-[0-9]+\s*2\s*[0-9]+\s*ns/op.*`) + re := regexp.MustCompile(`BenchmarkBLoopPrint(-[0-9]+)?\s+2\s+[0-9]+\s+ns/op`) if !re.Match(out) { - t.Errorf("Missing benchmark output") + t.Error("missing benchmark output") } } |
