From 872ca73cadf589bd4adf76d0fac9b07c52ac75c8 Mon Sep 17 00:00:00 2001 From: Marcel van Lohuizen Date: Fri, 18 Mar 2016 16:41:51 +0100 Subject: [PATCH] runtime: don't assume b.N > 0 Change-Id: I2e26717f2563d7633ffd15f4adf63c3d0ee3403f Reviewed-on: https://go-review.googlesource.com/20856 Run-TryBot: Marcel van Lohuizen Reviewed-by: Russ Cox --- src/runtime/proc_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/proc_test.go b/src/runtime/proc_test.go index 7064b0edd8..fd12945be0 100644 --- a/src/runtime/proc_test.go +++ b/src/runtime/proc_test.go @@ -428,6 +428,9 @@ func TestPingPongHog(t *testing.T) { } func BenchmarkPingPongHog(b *testing.B) { + if b.N == 0 { + return + } defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(1)) // Create a CPU hog -- 2.48.1