From 5b6aaba1ce869b3744f5f44bf218ef521bbd7940 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Mon, 24 Feb 2014 21:08:37 +0400 Subject: [PATCH] testing: improve diagnosis of a potential misuse of RunParallel LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/68230045 --- src/pkg/testing/benchmark.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pkg/testing/benchmark.go b/src/pkg/testing/benchmark.go index 06b5b603e3..1fbf5c8615 100644 --- a/src/pkg/testing/benchmark.go +++ b/src/pkg/testing/benchmark.go @@ -417,8 +417,8 @@ func (b *B) RunParallel(body func(*PB)) { }() } wg.Wait() - if n == 0 { - b.Fatal("RunParallel body did not not call PB.Next") + if n <= uint64(b.N) && !b.Failed() { + b.Fatal("RunParallel: body exited without pb.Next() == false") } }