|
|
|
@ -18,7 +18,6 @@ package tests |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"math/rand" |
|
|
|
|
"runtime" |
|
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
@ -51,9 +50,6 @@ func TestBlockchain(t *testing.T) { |
|
|
|
|
bt.skipLoad(`.*randomStatetest94.json.*`) |
|
|
|
|
|
|
|
|
|
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) { |
|
|
|
|
if runtime.GOARCH == "386" && runtime.GOOS == "windows" && rand.Int63()%2 == 0 { |
|
|
|
|
t.Skip("test (randomly) skipped on 32-bit windows") |
|
|
|
|
} |
|
|
|
|
execBlockTest(t, bt, test) |
|
|
|
|
}) |
|
|
|
|
// There is also a LegacyTests folder, containing blockchain tests generated
|
|
|
|
@ -74,20 +70,33 @@ func TestExecutionSpecBlocktests(t *testing.T) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func execBlockTest(t *testing.T, bt *testMatcher, test *BlockTest) { |
|
|
|
|
if err := bt.checkFailure(t, test.Run(false, rawdb.HashScheme, nil, nil)); err != nil { |
|
|
|
|
t.Errorf("test in hash mode without snapshotter failed: %v", err) |
|
|
|
|
return |
|
|
|
|
// If -short flag is used, we don't execute all four permutations, only one.
|
|
|
|
|
executionMask := 0xf |
|
|
|
|
if testing.Short() { |
|
|
|
|
executionMask = (1 << (rand.Int63() & 4)) |
|
|
|
|
} |
|
|
|
|
if executionMask&0x1 != 0 { |
|
|
|
|
if err := bt.checkFailure(t, test.Run(false, rawdb.HashScheme, nil, nil)); err != nil { |
|
|
|
|
t.Errorf("test in hash mode without snapshotter failed: %v", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if err := bt.checkFailure(t, test.Run(true, rawdb.HashScheme, nil, nil)); err != nil { |
|
|
|
|
t.Errorf("test in hash mode with snapshotter failed: %v", err) |
|
|
|
|
return |
|
|
|
|
if executionMask&0x2 != 0 { |
|
|
|
|
if err := bt.checkFailure(t, test.Run(true, rawdb.HashScheme, nil, nil)); err != nil { |
|
|
|
|
t.Errorf("test in hash mode with snapshotter failed: %v", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if err := bt.checkFailure(t, test.Run(false, rawdb.PathScheme, nil, nil)); err != nil { |
|
|
|
|
t.Errorf("test in path mode without snapshotter failed: %v", err) |
|
|
|
|
return |
|
|
|
|
if executionMask&0x4 != 0 { |
|
|
|
|
if err := bt.checkFailure(t, test.Run(false, rawdb.PathScheme, nil, nil)); err != nil { |
|
|
|
|
t.Errorf("test in path mode without snapshotter failed: %v", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if err := bt.checkFailure(t, test.Run(true, rawdb.PathScheme, nil, nil)); err != nil { |
|
|
|
|
t.Errorf("test in path mode with snapshotter failed: %v", err) |
|
|
|
|
return |
|
|
|
|
if executionMask&0x8 != 0 { |
|
|
|
|
if err := bt.checkFailure(t, test.Run(true, rawdb.PathScheme, nil, nil)); err != nil { |
|
|
|
|
t.Errorf("test in path mode with snapshotter failed: %v", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|