diff options
Diffstat (limited to 'libgo/go/runtime/testdata/testprog/gc.go')
-rw-r--r-- | libgo/go/runtime/testdata/testprog/gc.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libgo/go/runtime/testdata/testprog/gc.go b/libgo/go/runtime/testdata/testprog/gc.go index a0c1f82b56b..744b6108e2b 100644 --- a/libgo/go/runtime/testdata/testprog/gc.go +++ b/libgo/go/runtime/testdata/testprog/gc.go @@ -98,11 +98,25 @@ func GCFairness2() { // If the scheduling rules change, this may not be enough time // to let all goroutines run, but for now we cycle through // them rapidly. + // + // OpenBSD's scheduler makes every usleep() take at least + // 20ms, so we need a long time to ensure all goroutines have + // run. If they haven't run after 30ms, give it another 1000ms + // and check again. time.Sleep(30 * time.Millisecond) + var fail bool for i := range count { if atomic.LoadInt64(&count[i]) == 0 { - fmt.Printf("goroutine %d did not run\n", i) - return + fail = true + } + } + if fail { + time.Sleep(1 * time.Second) + for i := range count { + if atomic.LoadInt64(&count[i]) == 0 { + fmt.Printf("goroutine %d did not run\n", i) + return + } } } fmt.Println("OK") |