From: Brad Fitzpatrick Date: Wed, 29 Feb 2012 21:14:05 +0000 (-0800) Subject: time: skip a often-flaky test in short mode X-Git-Tag: weekly.2012-03-04~78 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8c5290502fc1d7cddf416614aab5d2ad3c1b9b08;p=gostls13.git 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 --- 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) } }