Unverified Commit c5b46a79 authored by Péter Szilágyi's avatar Péter Szilágyi Committed by GitHub

Merge pull request #20338 from etclabscore/feat/statetests-dedupe-walk-refactor

tests: refactor TestState to dedupe walk callback
parents b4bc3b3c b8ced9e0
...@@ -53,21 +53,12 @@ func TestState(t *testing.T) { ...@@ -53,21 +53,12 @@ func TestState(t *testing.T) {
//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/0`, "bug in test") //st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/0`, "bug in test")
//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/3`, "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)
name := name + "/" + key
t.Run(key, func(t *testing.T) {
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
_, err := test.Run(subtest, vmconfig)
return st.checkFailure(t, name, err)
})
})
}
})
// For Istanbul, older tests were moved into LegacyTests // For Istanbul, older tests were moved into LegacyTests
st.walk(t, legacyStateTestDir, func(t *testing.T, name string, test *StateTest) { for _, dir := range []string{
stateTestDir,
legacyStateTestDir,
} {
st.walk(t, dir, func(t *testing.T, name string, test *StateTest) {
for _, subtest := range test.Subtests() { for _, subtest := range test.Subtests() {
subtest := subtest subtest := subtest
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index) key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
...@@ -80,6 +71,7 @@ func TestState(t *testing.T) { ...@@ -80,6 +71,7 @@ func TestState(t *testing.T) {
}) })
} }
}) })
}
} }
// Transactions with gasLimit above this value will not get a VM trace on failure. // Transactions with gasLimit above this value will not get a VM trace on failure.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment