new: dev: pos-398 restore old testing way

This commit is contained in:
Marcello Ardizzone 2022-07-12 11:53:30 +02:00
parent 5265da30b8
commit 56eefc6a0b
5 changed files with 45 additions and 53 deletions

View file

@ -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)
}
})

View file

@ -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)
}
})

View file

@ -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)
}
})

View file

@ -124,7 +124,13 @@ 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 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)
@ -136,12 +142,7 @@ func TestState(t *testing.T) {
// 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) {
@ -158,17 +159,13 @@ func TestState(t *testing.T) {
// 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)
})
})
}
})
}
}
// Transactions with gasLimit above this value will not get a VM trace on failure.
const traceErrorLimit = 400000
@ -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)
}
if gasLimit > traceErrorLimit {
t.Log("gas limit too high for EVM trace")
return

View file

@ -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)
}
})