Skip to content

Commit f3d18d6

Browse files
authored
tests, appveyor: only execute one in four permutations on CI (ethereum#29220)
tests, appveyor: only execute one in four permutations when flag -short is used Also enable -short flag on all appveyor builds (also ubuntu)
1 parent c170fa2 commit f3d18d6

3 files changed

Lines changed: 44 additions & 22 deletions

File tree

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ for:
2626
- go run build/ci.go lint
2727
- go run build/ci.go install -dlgo
2828
test_script:
29-
- go run build/ci.go test -dlgo
29+
- go run build/ci.go test -dlgo -short
3030

3131
# linux/386 is disabled.
3232
- matrix:

tests/block_test.go

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package tests
1818

1919
import (
2020
"math/rand"
21-
"runtime"
2221
"testing"
2322

2423
"github.com/ethereum/go-ethereum/common"
@@ -51,9 +50,6 @@ func TestBlockchain(t *testing.T) {
5150
bt.skipLoad(`.*randomStatetest94.json.*`)
5251

5352
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
54-
if runtime.GOARCH == "386" && runtime.GOOS == "windows" && rand.Int63()%2 == 0 {
55-
t.Skip("test (randomly) skipped on 32-bit windows")
56-
}
5753
execBlockTest(t, bt, test)
5854
})
5955
// There is also a LegacyTests folder, containing blockchain tests generated
@@ -74,20 +70,33 @@ func TestExecutionSpecBlocktests(t *testing.T) {
7470
}
7571

7672
func execBlockTest(t *testing.T, bt *testMatcher, test *BlockTest) {
77-
if err := bt.checkFailure(t, test.Run(false, rawdb.HashScheme, nil, nil)); err != nil {
78-
t.Errorf("test in hash mode without snapshotter failed: %v", err)
79-
return
73+
// If -short flag is used, we don't execute all four permutations, only one.
74+
executionMask := 0xf
75+
if testing.Short() {
76+
executionMask = (1 << (rand.Int63() & 4))
77+
}
78+
if executionMask&0x1 != 0 {
79+
if err := bt.checkFailure(t, test.Run(false, rawdb.HashScheme, nil, nil)); err != nil {
80+
t.Errorf("test in hash mode without snapshotter failed: %v", err)
81+
return
82+
}
8083
}
81-
if err := bt.checkFailure(t, test.Run(true, rawdb.HashScheme, nil, nil)); err != nil {
82-
t.Errorf("test in hash mode with snapshotter failed: %v", err)
83-
return
84+
if executionMask&0x2 != 0 {
85+
if err := bt.checkFailure(t, test.Run(true, rawdb.HashScheme, nil, nil)); err != nil {
86+
t.Errorf("test in hash mode with snapshotter failed: %v", err)
87+
return
88+
}
8489
}
85-
if err := bt.checkFailure(t, test.Run(false, rawdb.PathScheme, nil, nil)); err != nil {
86-
t.Errorf("test in path mode without snapshotter failed: %v", err)
87-
return
90+
if executionMask&0x4 != 0 {
91+
if err := bt.checkFailure(t, test.Run(false, rawdb.PathScheme, nil, nil)); err != nil {
92+
t.Errorf("test in path mode without snapshotter failed: %v", err)
93+
return
94+
}
8895
}
89-
if err := bt.checkFailure(t, test.Run(true, rawdb.PathScheme, nil, nil)); err != nil {
90-
t.Errorf("test in path mode with snapshotter failed: %v", err)
91-
return
96+
if executionMask&0x8 != 0 {
97+
if err := bt.checkFailure(t, test.Run(true, rawdb.PathScheme, nil, nil)); err != nil {
98+
t.Errorf("test in path mode with snapshotter failed: %v", err)
99+
return
100+
}
92101
}
93102
}

tests/state_test.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"os"
2626
"path/filepath"
2727
"reflect"
28-
"runtime"
2928
"strings"
3029
"testing"
3130
"time"
@@ -99,15 +98,20 @@ func TestExecutionSpecState(t *testing.T) {
9998
}
10099

101100
func execStateTest(t *testing.T, st *testMatcher, test *StateTest) {
102-
if runtime.GOARCH == "386" && runtime.GOOS == "windows" && rand.Int63()%2 == 0 {
103-
t.Skip("test (randomly) skipped on 32-bit windows")
104-
return
105-
}
106101
for _, subtest := range test.Subtests() {
107102
subtest := subtest
108103
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
109104

105+
// If -short flag is used, we don't execute all four permutations, only
106+
// one.
107+
executionMask := 0xf
108+
if testing.Short() {
109+
executionMask = (1 << (rand.Int63() & 4))
110+
}
110111
t.Run(key+"/hash/trie", func(t *testing.T) {
112+
if executionMask&0x1 == 0 {
113+
t.Skip("test (randomly) skipped due to short-tag")
114+
}
111115
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
112116
var result error
113117
test.Run(subtest, vmconfig, false, rawdb.HashScheme, func(err error, state *StateTestState) {
@@ -117,6 +121,9 @@ func execStateTest(t *testing.T, st *testMatcher, test *StateTest) {
117121
})
118122
})
119123
t.Run(key+"/hash/snap", func(t *testing.T) {
124+
if executionMask&0x2 == 0 {
125+
t.Skip("test (randomly) skipped due to short-tag")
126+
}
120127
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
121128
var result error
122129
test.Run(subtest, vmconfig, true, rawdb.HashScheme, func(err error, state *StateTestState) {
@@ -132,6 +139,9 @@ func execStateTest(t *testing.T, st *testMatcher, test *StateTest) {
132139
})
133140
})
134141
t.Run(key+"/path/trie", func(t *testing.T) {
142+
if executionMask&0x4 == 0 {
143+
t.Skip("test (randomly) skipped due to short-tag")
144+
}
135145
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
136146
var result error
137147
test.Run(subtest, vmconfig, false, rawdb.PathScheme, func(err error, state *StateTestState) {
@@ -141,6 +151,9 @@ func execStateTest(t *testing.T, st *testMatcher, test *StateTest) {
141151
})
142152
})
143153
t.Run(key+"/path/snap", func(t *testing.T) {
154+
if executionMask&0x8 == 0 {
155+
t.Skip("test (randomly) skipped due to short-tag")
156+
}
144157
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
145158
var result error
146159
test.Run(subtest, vmconfig, true, rawdb.PathScheme, func(err error, state *StateTestState) {

0 commit comments

Comments
 (0)