From: Dmitri Shuralyov Date: Sun, 1 Dec 2024 22:22:19 +0000 (-0500) Subject: testing: consider -N suffix after benchmark name optional X-Git-Tag: go1.24rc1~51 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3374abeb50bbf31b7f4d2c7986d08384d673447d;p=gostls13.git 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Auto-Submit: Dmitri Shuralyov Reviewed-by: Cherry Mui --- 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") } }