travis: enable test suite on ARM64 (#20219)

* travis: Enable ARM support

* Include fixes from 20039

* Add a trace to debug the invalid lookup issue

* Try increasing the timeout to see if the arm test passes

* Investigate the resolver issue

* Increase arm64 timeout for clique test

* increase timeout in tests for arm64

* Only test the failing tests

* Review feedback: don't export epsilon

* Remove investigation tricks+include fjl's feeback

* Revert the retry ahead of using the mock resolver

* Fix rebase errors
pull/20249/head
Guillaume Ballet 5 years ago committed by Péter Szilágyi
parent adf007dadc
commit de2259d27c
  1. 10
      .travis.yml
  2. 2
      consensus/ethash/ethash_test.go
  3. 2
      eth/handler_test.go
  4. 4
      metrics/doc.go
  5. 101
      metrics/ewma_test.go
  6. 3
      metrics/sample_test.go
  7. 6
      miner/worker_test.go

@ -34,6 +34,16 @@ jobs:
# These are the latest Go versions. # These are the latest Go versions.
- stage: build - stage: build
os: linux os: linux
arch: amd64
dist: xenial
go: 1.13.x
script:
- go run build/ci.go install
- go run build/ci.go test -coverage $TEST_PACKAGES
- stage: build
os: linux
arch: arm64
dist: xenial dist: xenial
go: 1.13.x go: 1.13.x
script: script:

@ -49,7 +49,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(2 * time.Second).C:
t.Error("sealing result timeout") t.Error("sealing result timeout")
} }
} }

@ -608,7 +608,7 @@ func testBroadcastBlock(t *testing.T, totalPeers, broadcastExpected int) {
} }
}(peer) }(peer)
} }
timeout := time.After(300 * time.Millisecond) timeout := time.After(time.Second)
var receivedCount int var receivedCount int
outer: outer:
for { for {

@ -0,0 +1,4 @@
package metrics
const epsilon = 0.0000000000000001
const epsilonPercentile = .00000000001

@ -1,6 +1,9 @@
package metrics package metrics
import "testing" import (
"math"
"testing"
)
func BenchmarkEWMA(b *testing.B) { func BenchmarkEWMA(b *testing.B) {
a := NewEWMA1() a := NewEWMA1()
@ -15,67 +18,67 @@ func TestEWMA1(t *testing.T) {
a := NewEWMA1() a := NewEWMA1()
a.Update(3) a.Update(3)
a.Tick() a.Tick()
if rate := a.Rate(); 0.6 != rate { if rate := a.Rate(); math.Abs(0.6-rate) > epsilon {
t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) t.Errorf("initial a.Rate(): 0.6 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.22072766470286553 != rate { if rate := a.Rate(); math.Abs(0.22072766470286553-rate) > epsilon {
t.Errorf("1 minute a.Rate(): 0.22072766470286553 != %v\n", rate) t.Errorf("1 minute a.Rate(): 0.22072766470286553 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.08120116994196772 != rate { if rate := a.Rate(); math.Abs(0.08120116994196772-rate) > epsilon {
t.Errorf("2 minute a.Rate(): 0.08120116994196772 != %v\n", rate) t.Errorf("2 minute a.Rate(): 0.08120116994196772 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.029872241020718428 != rate { if rate := a.Rate(); math.Abs(0.029872241020718428-rate) > epsilon {
t.Errorf("3 minute a.Rate(): 0.029872241020718428 != %v\n", rate) t.Errorf("3 minute a.Rate(): 0.029872241020718428 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.01098938333324054 != rate { if rate := a.Rate(); math.Abs(0.01098938333324054-rate) > epsilon {
t.Errorf("4 minute a.Rate(): 0.01098938333324054 != %v\n", rate) t.Errorf("4 minute a.Rate(): 0.01098938333324054 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.004042768199451294 != rate { if rate := a.Rate(); math.Abs(0.004042768199451294-rate) > epsilon {
t.Errorf("5 minute a.Rate(): 0.004042768199451294 != %v\n", rate) t.Errorf("5 minute a.Rate(): 0.004042768199451294 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.0014872513059998212 != rate { if rate := a.Rate(); math.Abs(0.0014872513059998212-rate) > epsilon {
t.Errorf("6 minute a.Rate(): 0.0014872513059998212 != %v\n", rate) t.Errorf("6 minute a.Rate(): 0.0014872513059998212 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.0005471291793327122 != rate { if rate := a.Rate(); math.Abs(0.0005471291793327122-rate) > epsilon {
t.Errorf("7 minute a.Rate(): 0.0005471291793327122 != %v\n", rate) t.Errorf("7 minute a.Rate(): 0.0005471291793327122 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.00020127757674150815 != rate { if rate := a.Rate(); math.Abs(0.00020127757674150815-rate) > epsilon {
t.Errorf("8 minute a.Rate(): 0.00020127757674150815 != %v\n", rate) t.Errorf("8 minute a.Rate(): 0.00020127757674150815 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 7.404588245200814e-05 != rate { if rate := a.Rate(); math.Abs(7.404588245200814e-05-rate) > epsilon {
t.Errorf("9 minute a.Rate(): 7.404588245200814e-05 != %v\n", rate) t.Errorf("9 minute a.Rate(): 7.404588245200814e-05 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 2.7239957857491083e-05 != rate { if rate := a.Rate(); math.Abs(2.7239957857491083e-05-rate) > epsilon {
t.Errorf("10 minute a.Rate(): 2.7239957857491083e-05 != %v\n", rate) t.Errorf("10 minute a.Rate(): 2.7239957857491083e-05 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 1.0021020474147462e-05 != rate { if rate := a.Rate(); math.Abs(1.0021020474147462e-05-rate) > epsilon {
t.Errorf("11 minute a.Rate(): 1.0021020474147462e-05 != %v\n", rate) t.Errorf("11 minute a.Rate(): 1.0021020474147462e-05 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 3.6865274119969525e-06 != rate { if rate := a.Rate(); math.Abs(3.6865274119969525e-06-rate) > epsilon {
t.Errorf("12 minute a.Rate(): 3.6865274119969525e-06 != %v\n", rate) t.Errorf("12 minute a.Rate(): 3.6865274119969525e-06 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 1.3561976441886433e-06 != rate { if rate := a.Rate(); math.Abs(1.3561976441886433e-06-rate) > epsilon {
t.Errorf("13 minute a.Rate(): 1.3561976441886433e-06 != %v\n", rate) t.Errorf("13 minute a.Rate(): 1.3561976441886433e-06 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 4.989172314621449e-07 != rate { if rate := a.Rate(); math.Abs(4.989172314621449e-07-rate) > epsilon {
t.Errorf("14 minute a.Rate(): 4.989172314621449e-07 != %v\n", rate) t.Errorf("14 minute a.Rate(): 4.989172314621449e-07 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 1.8354139230109722e-07 != rate { if rate := a.Rate(); math.Abs(1.8354139230109722e-07-rate) > epsilon {
t.Errorf("15 minute a.Rate(): 1.8354139230109722e-07 != %v\n", rate) t.Errorf("15 minute a.Rate(): 1.8354139230109722e-07 != %v\n", rate)
} }
} }
@ -84,67 +87,67 @@ func TestEWMA5(t *testing.T) {
a := NewEWMA5() a := NewEWMA5()
a.Update(3) a.Update(3)
a.Tick() a.Tick()
if rate := a.Rate(); 0.6 != rate { if rate := a.Rate(); math.Abs(0.6-rate) > epsilon {
t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) t.Errorf("initial a.Rate(): 0.6 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.49123845184678905 != rate { if rate := a.Rate(); math.Abs(0.49123845184678905-rate) > epsilon {
t.Errorf("1 minute a.Rate(): 0.49123845184678905 != %v\n", rate) t.Errorf("1 minute a.Rate(): 0.49123845184678905 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.4021920276213837 != rate { if rate := a.Rate(); math.Abs(0.4021920276213837-rate) > epsilon {
t.Errorf("2 minute a.Rate(): 0.4021920276213837 != %v\n", rate) t.Errorf("2 minute a.Rate(): 0.4021920276213837 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.32928698165641596 != rate { if rate := a.Rate(); math.Abs(0.32928698165641596-rate) > epsilon {
t.Errorf("3 minute a.Rate(): 0.32928698165641596 != %v\n", rate) t.Errorf("3 minute a.Rate(): 0.32928698165641596 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.269597378470333 != rate { if rate := a.Rate(); math.Abs(0.269597378470333-rate) > epsilon {
t.Errorf("4 minute a.Rate(): 0.269597378470333 != %v\n", rate) t.Errorf("4 minute a.Rate(): 0.269597378470333 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.2207276647028654 != rate { if rate := a.Rate(); math.Abs(0.2207276647028654-rate) > epsilon {
t.Errorf("5 minute a.Rate(): 0.2207276647028654 != %v\n", rate) t.Errorf("5 minute a.Rate(): 0.2207276647028654 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.18071652714732128 != rate { if rate := a.Rate(); math.Abs(0.18071652714732128-rate) > epsilon {
t.Errorf("6 minute a.Rate(): 0.18071652714732128 != %v\n", rate) t.Errorf("6 minute a.Rate(): 0.18071652714732128 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.14795817836496392 != rate { if rate := a.Rate(); math.Abs(0.14795817836496392-rate) > epsilon {
t.Errorf("7 minute a.Rate(): 0.14795817836496392 != %v\n", rate) t.Errorf("7 minute a.Rate(): 0.14795817836496392 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.12113791079679326 != rate { if rate := a.Rate(); math.Abs(0.12113791079679326-rate) > epsilon {
t.Errorf("8 minute a.Rate(): 0.12113791079679326 != %v\n", rate) t.Errorf("8 minute a.Rate(): 0.12113791079679326 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.09917933293295193 != rate { if rate := a.Rate(); math.Abs(0.09917933293295193-rate) > epsilon {
t.Errorf("9 minute a.Rate(): 0.09917933293295193 != %v\n", rate) t.Errorf("9 minute a.Rate(): 0.09917933293295193 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.08120116994196763 != rate { if rate := a.Rate(); math.Abs(0.08120116994196763-rate) > epsilon {
t.Errorf("10 minute a.Rate(): 0.08120116994196763 != %v\n", rate) t.Errorf("10 minute a.Rate(): 0.08120116994196763 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.06648189501740036 != rate { if rate := a.Rate(); math.Abs(0.06648189501740036-rate) > epsilon {
t.Errorf("11 minute a.Rate(): 0.06648189501740036 != %v\n", rate) t.Errorf("11 minute a.Rate(): 0.06648189501740036 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.05443077197364752 != rate { if rate := a.Rate(); math.Abs(0.05443077197364752-rate) > epsilon {
t.Errorf("12 minute a.Rate(): 0.05443077197364752 != %v\n", rate) t.Errorf("12 minute a.Rate(): 0.05443077197364752 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.04456414692860035 != rate { if rate := a.Rate(); math.Abs(0.04456414692860035-rate) > epsilon {
t.Errorf("13 minute a.Rate(): 0.04456414692860035 != %v\n", rate) t.Errorf("13 minute a.Rate(): 0.04456414692860035 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.03648603757513079 != rate { if rate := a.Rate(); math.Abs(0.03648603757513079-rate) > epsilon {
t.Errorf("14 minute a.Rate(): 0.03648603757513079 != %v\n", rate) t.Errorf("14 minute a.Rate(): 0.03648603757513079 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.0298722410207183831020718428 != rate { if rate := a.Rate(); math.Abs(0.0298722410207183831020718428-rate) > epsilon {
t.Errorf("15 minute a.Rate(): 0.0298722410207183831020718428 != %v\n", rate) t.Errorf("15 minute a.Rate(): 0.0298722410207183831020718428 != %v\n", rate)
} }
} }
@ -153,67 +156,67 @@ func TestEWMA15(t *testing.T) {
a := NewEWMA15() a := NewEWMA15()
a.Update(3) a.Update(3)
a.Tick() a.Tick()
if rate := a.Rate(); 0.6 != rate { if rate := a.Rate(); math.Abs(0.6-rate) > epsilon {
t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) t.Errorf("initial a.Rate(): 0.6 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.5613041910189706 != rate { if rate := a.Rate(); math.Abs(0.5613041910189706-rate) > epsilon {
t.Errorf("1 minute a.Rate(): 0.5613041910189706 != %v\n", rate) t.Errorf("1 minute a.Rate(): 0.5613041910189706 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.5251039914257684 != rate { if rate := a.Rate(); math.Abs(0.5251039914257684-rate) > epsilon {
t.Errorf("2 minute a.Rate(): 0.5251039914257684 != %v\n", rate) t.Errorf("2 minute a.Rate(): 0.5251039914257684 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.4912384518467888184678905 != rate { if rate := a.Rate(); math.Abs(0.4912384518467888184678905-rate) > epsilon {
t.Errorf("3 minute a.Rate(): 0.4912384518467888184678905 != %v\n", rate) t.Errorf("3 minute a.Rate(): 0.4912384518467888184678905 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.459557003018789 != rate { if rate := a.Rate(); math.Abs(0.459557003018789-rate) > epsilon {
t.Errorf("4 minute a.Rate(): 0.459557003018789 != %v\n", rate) t.Errorf("4 minute a.Rate(): 0.459557003018789 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.4299187863442732 != rate { if rate := a.Rate(); math.Abs(0.4299187863442732-rate) > epsilon {
t.Errorf("5 minute a.Rate(): 0.4299187863442732 != %v\n", rate) t.Errorf("5 minute a.Rate(): 0.4299187863442732 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.4021920276213831 != rate { if rate := a.Rate(); math.Abs(0.4021920276213831-rate) > epsilon {
t.Errorf("6 minute a.Rate(): 0.4021920276213831 != %v\n", rate) t.Errorf("6 minute a.Rate(): 0.4021920276213831 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.37625345116383313 != rate { if rate := a.Rate(); math.Abs(0.37625345116383313-rate) > epsilon {
t.Errorf("7 minute a.Rate(): 0.37625345116383313 != %v\n", rate) t.Errorf("7 minute a.Rate(): 0.37625345116383313 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.3519877317060185 != rate { if rate := a.Rate(); math.Abs(0.3519877317060185-rate) > epsilon {
t.Errorf("8 minute a.Rate(): 0.3519877317060185 != %v\n", rate) t.Errorf("8 minute a.Rate(): 0.3519877317060185 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.3292869816564153165641596 != rate { if rate := a.Rate(); math.Abs(0.3292869816564153165641596-rate) > epsilon {
t.Errorf("9 minute a.Rate(): 0.3292869816564153165641596 != %v\n", rate) t.Errorf("9 minute a.Rate(): 0.3292869816564153165641596 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.3080502714195546 != rate { if rate := a.Rate(); math.Abs(0.3080502714195546-rate) > epsilon {
t.Errorf("10 minute a.Rate(): 0.3080502714195546 != %v\n", rate) t.Errorf("10 minute a.Rate(): 0.3080502714195546 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.2881831806538789 != rate { if rate := a.Rate(); math.Abs(0.2881831806538789-rate) > epsilon {
t.Errorf("11 minute a.Rate(): 0.2881831806538789 != %v\n", rate) t.Errorf("11 minute a.Rate(): 0.2881831806538789 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.26959737847033216 != rate { if rate := a.Rate(); math.Abs(0.26959737847033216-rate) > epsilon {
t.Errorf("12 minute a.Rate(): 0.26959737847033216 != %v\n", rate) t.Errorf("12 minute a.Rate(): 0.26959737847033216 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.2522102307052083 != rate { if rate := a.Rate(); math.Abs(0.2522102307052083-rate) > epsilon {
t.Errorf("13 minute a.Rate(): 0.2522102307052083 != %v\n", rate) t.Errorf("13 minute a.Rate(): 0.2522102307052083 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.23594443252115815 != rate { if rate := a.Rate(); math.Abs(0.23594443252115815-rate) > epsilon {
t.Errorf("14 minute a.Rate(): 0.23594443252115815 != %v\n", rate) t.Errorf("14 minute a.Rate(): 0.23594443252115815 != %v\n", rate)
} }
elapseMinute(a) elapseMinute(a)
if rate := a.Rate(); 0.2207276647028646247028654470286553 != rate { if rate := a.Rate(); math.Abs(0.2207276647028646247028654470286553-rate) > epsilon {
t.Errorf("15 minute a.Rate(): 0.2207276647028646247028654470286553 != %v\n", rate) t.Errorf("15 minute a.Rate(): 0.2207276647028646247028654470286553 != %v\n", rate)
} }
} }

@ -1,6 +1,7 @@
package metrics package metrics
import ( import (
"math"
"math/rand" "math/rand"
"runtime" "runtime"
"testing" "testing"
@ -326,7 +327,7 @@ func testUniformSampleStatistics(t *testing.T, s Sample) {
if 7380.5 != ps[1] { if 7380.5 != ps[1] {
t.Errorf("75th percentile: 7380.5 != %v\n", ps[1]) t.Errorf("75th percentile: 7380.5 != %v\n", ps[1])
} }
if 9986.429999999998 != ps[2] { if math.Abs(9986.429999999998-ps[2]) > epsilonPercentile {
t.Errorf("99th percentile: 9986.429999999998 != %v\n", ps[2]) t.Errorf("99th percentile: 9986.429999999998 != %v\n", ps[2])
} }
} }

@ -340,7 +340,9 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens
} }
} }
w.fullTaskHook = func() { w.fullTaskHook = func() {
time.Sleep(100 * time.Millisecond) // Aarch64 unit tests are running in a VM on travis, they must
// be given more time to execute.
time.Sleep(time.Second)
} }
// Ensure worker has finished initialization // Ensure worker has finished initialization
@ -355,7 +357,7 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens
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(4 * time.Second).C:
t.Error("new task timeout") t.Error("new task timeout")
} }
} }

Loading…
Cancel
Save