aboutsummaryrefslogtreecommitdiff
path: root/src/testing/benchmark.go
diff options
context:
space:
mode:
authorBryan Mills <bcmills@google.com>2023-05-24 17:16:33 +0000
committerGopher Robot <gobot@golang.org>2023-05-24 17:35:45 +0000
commitbfdd3bf3a5bce39fefe388a19f75dfd9a484ea21 (patch)
tree321dd48bd7ec4bc9a1e86aee55be64c0143320e2 /src/testing/benchmark.go
parent067dd573b2deba45a02383139bd2885321b2f71d (diff)
downloadgo-bfdd3bf3a5bce39fefe388a19f75dfd9a484ea21.tar.xz
Revert "testing: only report subtest races once"
This reverts CL 494057. Reason for revert: test is failing on -race builders. Fixes #60393. Change-Id: If98238a12673aec597cf69aeead7bdf4782b4524 Reviewed-on: https://go-review.googlesource.com/c/go/+/497996 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/testing/benchmark.go')
-rw-r--r--src/testing/benchmark.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/testing/benchmark.go b/src/testing/benchmark.go
index a856312f8f..be9b87f80b 100644
--- a/src/testing/benchmark.go
+++ b/src/testing/benchmark.go
@@ -7,6 +7,7 @@ package testing
import (
"flag"
"fmt"
+ "internal/race"
"internal/sysinfo"
"io"
"math"
@@ -184,6 +185,7 @@ func (b *B) runN(n int) {
// Try to get a comparable environment for each run
// by clearing garbage from previous runs.
runtime.GC()
+ b.raceErrors = -race.Errors()
b.N = n
b.parallelism = 1
b.ResetTimer()
@@ -192,7 +194,8 @@ func (b *B) runN(n int) {
b.StopTimer()
b.previousN = n
b.previousDuration = b.duration
- if fetchRaceErrors() > 0 {
+ b.raceErrors += race.Errors()
+ if b.raceErrors > 0 {
b.Errorf("race detected during execution of benchmark")
}
}