From 7d56acbda4b06ab3fbee391466a5ac5df8c47be6 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Thu, 31 Oct 2019 06:58:39 +0100 Subject: [PATCH] increase timeout in tests for arm64 --- .travis.yml | 3 ++- consensus/ethash/ethash_test.go | 9 ++++++++- eth/handler_test.go | 9 ++++++++- miner/worker_test.go | 9 ++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9db482a01f..b37476ec8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,8 +46,9 @@ jobs: arch: arm64 dist: xenial go: 1.13.x + env: + - GODEBUG="netdns=cgo" script: - - export GODEBUG=netdns=cgo - go run build/ci.go install - go run build/ci.go test -coverage $TEST_PACKAGES diff --git a/consensus/ethash/ethash_test.go b/consensus/ethash/ethash_test.go index 90cb6470f7..260a173dde 100644 --- a/consensus/ethash/ethash_test.go +++ b/consensus/ethash/ethash_test.go @@ -21,6 +21,7 @@ import ( "math/big" "math/rand" "os" + "runtime" "sync" "testing" "time" @@ -32,6 +33,12 @@ import ( // Tests that ethash works correctly in test mode. 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)} ethash := NewTester(nil, false) @@ -49,7 +56,7 @@ func TestTestMode(t *testing.T) { if err := ethash.VerifySeal(nil, header); err != nil { t.Fatalf("unexpected verification error: %v", err) } - case <-time.NewTimer(time.Second).C: + case <-time.NewTimer(timeoutS).C: t.Error("sealing result timeout") } } diff --git a/eth/handler_test.go b/eth/handler_test.go index 256883d1f0..6c950872d1 100644 --- a/eth/handler_test.go +++ b/eth/handler_test.go @@ -21,6 +21,7 @@ import ( "math" "math/big" "math/rand" + "runtime" "testing" "time" @@ -608,7 +609,13 @@ func testBroadcastBlock(t *testing.T, totalPeers, broadcastExpected int) { } }(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 outer: for { diff --git a/miner/worker_test.go b/miner/worker_test.go index adaf25bf6a..68aabb9363 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -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() for i := 0; i < 2; i += 1 { select { case <-taskCh: - case <-time.NewTimer(2 * time.Second).C: + case <-time.NewTimer(timeoutS).C: t.Error("new task timeout") } }