From 8c5290502fc1d7cddf416614aab5d2ad3c1b9b08 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 29 Feb 2012 13:14:05 -0800 Subject: [PATCH] time: skip a often-flaky test in short mode In -test.short mode, skip measuring the upper bound of time sleeps. The API only guarantees minimum bounds on sleeps, anyway, so this isn't a bug we're ignoring as much as it is simply observing bad builder virtualization and/or loaded machines. We keep the test in full mode where developers will presumably be running on a lightly-loaded, native, fast machine. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5713044 --- src/pkg/time/sleep_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pkg/time/sleep_test.go b/src/pkg/time/sleep_test.go index 9b0b7f7e06..526d58d75e 100644 --- a/src/pkg/time/sleep_test.go +++ b/src/pkg/time/sleep_test.go @@ -120,8 +120,11 @@ func TestAfterTick(t *testing.T) { t1 := Now() d := t1.Sub(t0) target := Delta * Count - if d < target*9/10 || d > target*30/10 { - t.Fatalf("%d ticks of %s took %s, expected %s", Count, Delta, d, target) + if d < target*9/10 { + t.Fatalf("%d ticks of %s too fast: took %s, expected %s", Count, Delta, d, target) + } + if !testing.Short() && d > target*30/10 { + t.Fatalf("%d ticks of %s too slow: took %s, expected %s", Count, Delta, d, target) } } -- 2.50.0