time: use an alternative method of yielding during Overflow timer test
Fixes #6874.
Use runtime.GC() as a stronger version of runtime.Gosched() which tends to bias the running goroutine in an otherwise idle system. This appears to reduce the worst case number of spins from 600 down to 30 on my 2 core system under high load.
LGTM=iant
R=golang-codereviews, lucio.dere, iant, dvyukov
CC=golang-codereviews
https://golang.org/cl/56540046
diff --git a/src/pkg/time/sleep_test.go b/src/pkg/time/sleep_test.go
index 4687259..23cb3da 100644
--- a/src/pkg/time/sleep_test.go
+++ b/src/pkg/time/sleep_test.go
@@ -398,6 +398,9 @@
}
func TestOverflowRuntimeTimer(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping in short mode, see issue 6874")
+ }
if err := CheckRuntimeTimerOverflow(); err != nil {
t.Fatalf(err.Error())
}