]> Cypherpunks repositories - gostls13.git/commitdiff
testing: diagnose a potential misuse of RunParallel
authorDmitriy Vyukov <dvyukov@google.com>
Mon, 24 Feb 2014 16:32:28 +0000 (20:32 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Mon, 24 Feb 2014 16:32:28 +0000 (20:32 +0400)
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/68030043

src/pkg/testing/benchmark.go

index e6f3c6d7903214c776d08afa983a56b7252e520d..06b5b603e3948bedce1f9f7db1f72ad84d84a9fb 100644 (file)
@@ -417,6 +417,9 @@ func (b *B) RunParallel(body func(*PB)) {
                }()
        }
        wg.Wait()
+       if n == 0 {
+               b.Fatal("RunParallel body did not not call PB.Next")
+       }
 }
 
 // SetParallelism sets the number of goroutines used by RunParallel to p*GOMAXPROCS.