mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
new: dev: pos-398 restore old testing way
This commit is contained in:
parent
5265da30b8
commit
56eefc6a0b
5 changed files with 45 additions and 53 deletions
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue