Skip to content

Commit 96c9f3a

Browse files
time: give TestTicker more time on darwin-arm64
The darwin-arm64-correlium builder was failing the test consistently at the old values. Give the ticks more time to let the test pass. Updates #35692 Change-Id: Ibc636cd4db2595c82f4e8c6c822c3df4c2b7e0a1 Reviewed-on: https://go-review.googlesource.com/c/go/+/207839 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 580337e commit 96c9f3a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/time/tick_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package time_test
66

77
import (
88
"fmt"
9+
"runtime"
910
"testing"
1011
. "time"
1112
)
@@ -16,9 +17,15 @@ func TestTicker(t *testing.T) {
1617
// want to use lengthy times. This makes the test inherently flaky.
1718
// So only report an error if it fails five times in a row.
1819

19-
const count = 10
20+
count := 10
2021
delta := 20 * Millisecond
2122

23+
// On Darwin ARM64 the tick frequency seems limited. Issue 35692.
24+
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
25+
count = 5
26+
delta = 100 * Millisecond
27+
}
28+
2229
var errs []string
2330
logErrs := func() {
2431
for _, e := range errs {
@@ -35,7 +42,7 @@ func TestTicker(t *testing.T) {
3542
ticker.Stop()
3643
t1 := Now()
3744
dt := t1.Sub(t0)
38-
target := delta * count
45+
target := delta * Duration(count)
3946
slop := target * 2 / 10
4047
if dt < target-slop || dt > target+slop {
4148
errs = append(errs, fmt.Sprintf("%d %s ticks took %s, expected [%s,%s]", count, delta, dt, target-slop, target+slop))

0 commit comments

Comments
 (0)