1
0
mirror of https://github.com/golang/go synced 2024-11-12 00:20:22 -07:00

time: during short test, do not bother tickers take longer than expected

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5752058
This commit is contained in:
Shenghou Ma 2012-03-07 01:10:55 +08:00
parent aabbcda816
commit db80edde7d

View File

@ -22,7 +22,7 @@ func TestTicker(t *testing.T) {
dt := t1.Sub(t0)
target := Delta * Count
slop := target * 2 / 10
if dt < target-slop || dt > target+slop {
if dt < target-slop || (!testing.Short() && dt > target+slop) {
t.Fatalf("%d %s ticks took %s, expected [%s,%s]", Count, Delta, dt, target-slop, target+slop)
}
// Now test that the ticker stopped