]> Cypherpunks repositories - gostls13.git/commitdiff
testing: improve diagnosis of a potential misuse of RunParallel
authorDmitriy Vyukov <dvyukov@google.com>
Mon, 24 Feb 2014 17:08:37 +0000 (21:08 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Mon, 24 Feb 2014 17:08:37 +0000 (21:08 +0400)
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/68230045

src/pkg/testing/benchmark.go

index 06b5b603e3948bedce1f9f7db1f72ad84d84a9fb..1fbf5c8615f8c73a91a5d911da78877b3c8e985d 100644 (file)
@@ -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")
        }
 }