]> Cypherpunks repositories - gostls13.git/commitdiff
time: skip a often-flaky test in short mode
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 29 Feb 2012 21:14:05 +0000 (13:14 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 29 Feb 2012 21:14:05 +0000 (13:14 -0800)
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

index 9b0b7f7e06a1efc25e490efc259f22628ef590d5..526d58d75e7a478781bf6e78cbf77ad134b31a48 100644 (file)
@@ -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)
        }
 }