1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:34:39 -07:00

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
This commit is contained in:
Brad Fitzpatrick 2012-02-29 13:14:05 -08:00
parent 8e38b17a90
commit 8c5290502f

View 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)
}
}