From bfdd3bf3a5bce39fefe388a19f75dfd9a484ea21 Mon Sep 17 00:00:00 2001 From: Bryan Mills Date: Wed, 24 May 2023 17:16:33 +0000 Subject: 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 Auto-Submit: Bryan Mills Reviewed-by: Ian Lance Taylor Run-TryBot: Bryan Mills --- src/testing/benchmark.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/testing/benchmark.go') 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") } } -- cgit v1.3