diff --git a/tests/block_test.go b/tests/block_test.go index ceb3af2802..6bdb98679f 100644 --- a/tests/block_test.go +++ b/tests/block_test.go @@ -20,7 +20,6 @@ package tests import ( - "errors" "testing" ) @@ -57,10 +56,10 @@ func TestBlockchain(t *testing.T) { bt.skipLoad(`.*TransitionTests*`) bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) { - if err := bt.checkFailure(t, test.Run(false)); err != nil && !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { + if err := bt.checkFailure(t, test.Run(false)); err != nil { t.Errorf("in 'block_test.go', test '%s' without snapshotter failed with error: '%v'", name, err) } - if err := bt.checkFailure(t, test.Run(true)); err != nil && !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { + if err := bt.checkFailure(t, test.Run(true)); err != nil { t.Errorf("in 'block_test.go', test '%s' with snapshotter failed with error: '%v'", name, err) } }) diff --git a/tests/difficulty_test.go b/tests/difficulty_test.go index cac2ea9868..d8b172d6fe 100644 --- a/tests/difficulty_test.go +++ b/tests/difficulty_test.go @@ -20,7 +20,6 @@ package tests import ( - "errors" "math/big" "testing" @@ -91,7 +90,7 @@ func TestDifficulty(t *testing.T) { t.Skip("difficulty below minimum") return } - if err := dt.checkFailure(t, test.Run(cfg)); err != nil && !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { + if err := dt.checkFailure(t, test.Run(cfg)); err != nil { t.Errorf("in 'difficulty_test.go', test '%s' failed with error: '%v'", name, err) } }) diff --git a/tests/rlp_test.go b/tests/rlp_test.go index 003e512d5c..a41464c30c 100644 --- a/tests/rlp_test.go +++ b/tests/rlp_test.go @@ -20,7 +20,6 @@ package tests import ( - "errors" "testing" ) @@ -28,7 +27,7 @@ func TestRLP(t *testing.T) { t.Parallel() tm := new(testMatcher) tm.walk(t, rlpTestDir, func(t *testing.T, name string, test *RLPTest) { - if err := tm.checkFailure(t, test.Run()); err != nil && !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { + if err := tm.checkFailure(t, test.Run()); err != nil { t.Errorf("in 'rlp_test.go', test '%s' failed with error: '%v'", name, err) } }) diff --git a/tests/state_test.go b/tests/state_test.go index db87f66072..05deca788e 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -124,50 +124,47 @@ func TestState(t *testing.T) { //st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/0`, "bug in test") //st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/3`, "bug in test") - st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) { - for _, subtest := range test.Subtests() { - subtest := subtest - key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index) + // For Istanbul, older tests were moved into LegacyTests + for _, dir := range []string{ + stateTestDir, + legacyStateTestDir, + benchmarksDir, + } { + st.walk(t, dir, func(t *testing.T, name string, test *StateTest) { + for _, subtest := range test.Subtests() { + subtest := subtest + key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index) - t.Run(key+"/trie", func(t *testing.T) { - withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { - _, _, err := test.Run(subtest, vmconfig, false) - if err != nil && len(test.json.Post[subtest.Fork][subtest.Index].ExpectException) > 0 { - // Ignore expected errors (TODO MariusVanDerWijden check error string) - return nil - } - err = st.checkFailure(t, err) - if err != nil && !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { - t.Errorf("in 'state_test.go', test '%s' failed with error: '%v'", name, err) - return err - } - return nil - }) - }) - t.Run(key+"/snap", func(t *testing.T) { - withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { - snaps, statedb, err := test.Run(subtest, vmconfig, true) - if snaps != nil && statedb != nil { - if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil && - !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { - t.Errorf("in 'rlp_test.go', test '%s' failed with error: '%v'", name, err) - return err + t.Run(key+"/trie", func(t *testing.T) { + withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { + _, _, err := test.Run(subtest, vmconfig, false) + if err != nil && len(test.json.Post[subtest.Fork][subtest.Index].ExpectException) > 0 { + // Ignore expected errors (TODO MariusVanDerWijden check error string) + return nil } - } - if err != nil && len(test.json.Post[subtest.Fork][subtest.Index].ExpectException) > 0 { - // Ignore expected errors (TODO MariusVanDerWijden check error string) - return nil - } - err = st.checkFailure(t, err) - if err != nil && !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { - t.Errorf("in 'state_test.go', test '%s' failed with error: '%v'", name, err) - return err - } - return nil + return st.checkFailure(t, err) + }) }) - }) - } - }) + t.Run(key+"/snap", func(t *testing.T) { + withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { + snaps, statedb, err := test.Run(subtest, vmconfig, true) + if snaps != nil && statedb != nil { + if _, err := snaps.Journal(statedb.IntermediateRoot(false)); err != nil && + !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { + t.Errorf("in 'rlp_test.go', test '%s' failed with error: '%v'", name, err) + return err + } + } + if err != nil && len(test.json.Post[subtest.Fork][subtest.Index].ExpectException) > 0 { + // Ignore expected errors (TODO MariusVanDerWijden check error string) + return nil + } + return st.checkFailure(t, err) + }) + }) + } + }) + } } // Transactions with gasLimit above this value will not get a VM trace on failure. @@ -182,9 +179,8 @@ func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) { } // Test failed, re-run with tracing enabled. - if !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { - t.Error(err) - } + t.Error(err) + if gasLimit > traceErrorLimit { t.Log("gas limit too high for EVM trace") return diff --git a/tests/transaction_test.go b/tests/transaction_test.go index fcd9cf018e..5663805605 100644 --- a/tests/transaction_test.go +++ b/tests/transaction_test.go @@ -20,7 +20,6 @@ package tests import ( - "errors" "testing" "github.com/ethereum/go-ethereum/params" @@ -51,7 +50,7 @@ func TestTransaction(t *testing.T) { txt.skipLoad("^ttValue/TransactionWithHighValueOverflow.json") txt.walk(t, transactionTestDir, func(t *testing.T, name string, test *TransactionTest) { cfg := params.MainnetChainConfig - if err := txt.checkFailure(t, test.Run(cfg)); err != nil && !errors.Is(err, UnsupportedForkError{Name: "Merge"}) { + if err := txt.checkFailure(t, test.Run(cfg)); err != nil { t.Errorf("in 'transaction_test.go', test '%s' failed with error: '%v'", name, err) } })