]> Cypherpunks repositories - gostls13.git/commitdiff
testing: consider -N suffix after benchmark name optional
authorDmitri Shuralyov <dmitshur@golang.org>
Sun, 1 Dec 2024 22:22:19 +0000 (17:22 -0500)
committerGopher Robot <gobot@golang.org>
Mon, 2 Dec 2024 18:59:26 +0000 (18:59 +0000)
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>
src/testing/testing_test.go

index 1e32a1e61586ba8ee047d0c7616e82ed0bafd175..797728c7a89b0af2bf387815604cba9b260a150e 100644 (file)
@@ -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")
        }
 }