mirror of https://github.com/golang/go.git
time: increase arbitrary upper bound in TestReset to 10s
The previous upper bound was around 0.375 s, which is empirically too short on a slow, heavily-loaded builder. Since the test doesn't seem to depend on the actual duration in any meaningful way, let's make it several orders of magnitude larger. Fixes #61266. Change-Id: I6dde5e174966ee385db67e3cb87334f463c7e597 Reviewed-on: https://go-review.googlesource.com/c/go/+/508695 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
6a063b01b0
commit
4c58d6bf52
|
|
@ -418,22 +418,22 @@ func TestReset(t *testing.T) {
|
||||||
// We try to run this test with increasingly larger multiples
|
// We try to run this test with increasingly larger multiples
|
||||||
// until one works so slow, loaded hardware isn't as flaky,
|
// until one works so slow, loaded hardware isn't as flaky,
|
||||||
// but without slowing down fast machines unnecessarily.
|
// but without slowing down fast machines unnecessarily.
|
||||||
const unit = 25 * Millisecond
|
//
|
||||||
tries := []Duration{
|
// (maxDuration is several orders of magnitude longer than we
|
||||||
1 * unit,
|
// expect this test to actually take on a fast, unloaded machine.)
|
||||||
3 * unit,
|
d := 1 * Millisecond
|
||||||
7 * unit,
|
const maxDuration = 10 * Second
|
||||||
15 * unit,
|
for {
|
||||||
}
|
err := testReset(d)
|
||||||
var err error
|
|
||||||
for _, d := range tries {
|
|
||||||
err = testReset(d)
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Logf("passed using duration %v", d)
|
break
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
d *= 2
|
||||||
|
if d > maxDuration {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
t.Logf("%v; trying duration %v", err, d)
|
||||||
}
|
}
|
||||||
t.Error(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that sleeping (via Sleep or Timer) for an interval so large it
|
// Test that sleeping (via Sleep or Timer) for an interval so large it
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue