Commit 96c9f3aa authored by Ian Lance Taylor's avatar Ian Lance Taylor

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 <iant@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 580337e2
...@@ -6,6 +6,7 @@ package time_test ...@@ -6,6 +6,7 @@ package time_test
import ( import (
"fmt" "fmt"
"runtime"
"testing" "testing"
. "time" . "time"
) )
...@@ -16,9 +17,15 @@ func TestTicker(t *testing.T) { ...@@ -16,9 +17,15 @@ func TestTicker(t *testing.T) {
// want to use lengthy times. This makes the test inherently flaky. // want to use lengthy times. This makes the test inherently flaky.
// So only report an error if it fails five times in a row. // So only report an error if it fails five times in a row.
const count = 10 count := 10
delta := 20 * Millisecond delta := 20 * Millisecond
// On Darwin ARM64 the tick frequency seems limited. Issue 35692.
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
count = 5
delta = 100 * Millisecond
}
var errs []string var errs []string
logErrs := func() { logErrs := func() {
for _, e := range errs { for _, e := range errs {
...@@ -35,7 +42,7 @@ func TestTicker(t *testing.T) { ...@@ -35,7 +42,7 @@ func TestTicker(t *testing.T) {
ticker.Stop() ticker.Stop()
t1 := Now() t1 := Now()
dt := t1.Sub(t0) dt := t1.Sub(t0)
target := delta * count target := delta * Duration(count)
slop := target * 2 / 10 slop := target * 2 / 10
if dt < target-slop || dt > target+slop { if dt < target-slop || dt > target+slop {
errs = append(errs, fmt.Sprintf("%d %s ticks took %s, expected [%s,%s]", count, delta, dt, target-slop, target+slop)) errs = append(errs, fmt.Sprintf("%d %s ticks took %s, expected [%s,%s]", count, delta, dt, target-slop, target+slop))
......
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