From 81a9cc31c46aada8ec4ff7e262b8b0a46e2ce57a Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Thu, 20 Sep 2012 12:06:08 +1000 Subject: [PATCH] misc/cgo/test: do not run wasteCPU during TestParallelSleep unless on arm R=golang-dev, r, minux.ma, dave, bradfitz CC=golang-dev https://golang.org/cl/6532052 --- misc/cgo/test/issue1560.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/misc/cgo/test/issue1560.go b/misc/cgo/test/issue1560.go index ac897aa33bf..4f49399545f 100644 --- a/misc/cgo/test/issue1560.go +++ b/misc/cgo/test/issue1560.go @@ -56,8 +56,12 @@ func wasteCPU() chan struct{} { } func testParallelSleep(t *testing.T) { - defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2)) - defer close(wasteCPU()) + if runtime.GOARCH == "arm" { + // on ARM, the 1.3s deadline is frequently missed, + // and burning cpu seems to help + defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2)) + defer close(wasteCPU()) + } sleepSec := 1 start := time.Now()