Commit 8c529050 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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
parent 8e38b17a
...@@ -120,8 +120,11 @@ func TestAfterTick(t *testing.T) { ...@@ -120,8 +120,11 @@ func TestAfterTick(t *testing.T) {
t1 := Now() t1 := Now()
d := t1.Sub(t0) d := t1.Sub(t0)
target := Delta * Count target := Delta * Count
if d < target*9/10 || d > target*30/10 { if d < target*9/10 {
t.Fatalf("%d ticks of %s took %s, expected %s", Count, Delta, d, target) 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)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment