increase timeout in tests for arm64

This commit is contained in:
Guillaume Ballet 2019-10-31 06:58:39 +01:00
parent f87c2746d7
commit 7d56acbda4
4 changed files with 26 additions and 4 deletions

View file

@ -46,8 +46,9 @@ jobs:
arch: arm64 arch: arm64
dist: xenial dist: xenial
go: 1.13.x go: 1.13.x
env:
- GODEBUG="netdns=cgo"
script: script:
- export GODEBUG=netdns=cgo
- go run build/ci.go install - go run build/ci.go install
- go run build/ci.go test -coverage $TEST_PACKAGES - go run build/ci.go test -coverage $TEST_PACKAGES

View file

@ -21,6 +21,7 @@ import (
"math/big" "math/big"
"math/rand" "math/rand"
"os" "os"
"runtime"
"sync" "sync"
"testing" "testing"
"time" "time"
@ -32,6 +33,12 @@ import (
// Tests that ethash works correctly in test mode. // Tests that ethash works correctly in test mode.
func TestTestMode(t *testing.T) { func TestTestMode(t *testing.T) {
var timeoutS time.Duration
if runtime.GOARCH == "arm64" {
timeoutS = 2 * time.Second
} else {
timeoutS = time.Second
}
header := &types.Header{Number: big.NewInt(1), Difficulty: big.NewInt(100)} header := &types.Header{Number: big.NewInt(1), Difficulty: big.NewInt(100)}
ethash := NewTester(nil, false) ethash := NewTester(nil, false)
@ -49,7 +56,7 @@ func TestTestMode(t *testing.T) {
if err := ethash.VerifySeal(nil, header); err != nil { if err := ethash.VerifySeal(nil, header); err != nil {
t.Fatalf("unexpected verification error: %v", err) t.Fatalf("unexpected verification error: %v", err)
} }
case <-time.NewTimer(time.Second).C: case <-time.NewTimer(timeoutS).C:
t.Error("sealing result timeout") t.Error("sealing result timeout")
} }
} }

View file

@ -21,6 +21,7 @@ import (
"math" "math"
"math/big" "math/big"
"math/rand" "math/rand"
"runtime"
"testing" "testing"
"time" "time"
@ -608,7 +609,13 @@ func testBroadcastBlock(t *testing.T, totalPeers, broadcastExpected int) {
} }
}(peer) }(peer)
} }
timeout := time.After(300 * time.Millisecond) var timeoutMs time.Duration
if runtime.GOARCH == "arm64" {
timeoutMs = time.Second
} else {
timeoutMs = 300 * time.Millisecond
}
timeout := time.After(timeoutMs)
var receivedCount int var receivedCount int
outer: outer:
for { for {

View file

@ -358,11 +358,18 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens
} }
} }
var timeoutS time.Duration
if runtime.GOARCH == "arm64" {
timeoutS = 4 * time.Second
} else {
timeoutS = 2 * time.Second
}
w.start() w.start()
for i := 0; i < 2; i += 1 { for i := 0; i < 2; i += 1 {
select { select {
case <-taskCh: case <-taskCh:
case <-time.NewTimer(2 * time.Second).C: case <-time.NewTimer(timeoutS).C:
t.Error("new task timeout") t.Error("new task timeout")
} }
} }