Skip to content

Commit 0699287

Browse files
chfastgballet
authored andcommitted
tests: Add flag to use EVMC for state tests (#18084)
1 parent 197d609 commit 0699287

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/state_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ package tests
1818

1919
import (
2020
"bytes"
21+
"flag"
2122
"fmt"
2223
"reflect"
2324
"testing"
2425

26+
"github.com/ethereum/go-ethereum/cmd/utils"
2527
"github.com/ethereum/go-ethereum/core/vm"
2628
)
2729

@@ -65,8 +67,17 @@ func TestState(t *testing.T) {
6567
// Transactions with gasLimit above this value will not get a VM trace on failure.
6668
const traceErrorLimit = 400000
6769

70+
// The VM config for state tests that accepts --vm.* command line arguments.
71+
var testVMConfig = func() vm.Config {
72+
vmconfig := vm.Config{}
73+
flag.StringVar(&vmconfig.EVMInterpreter, utils.EVMInterpreterFlag.Name, utils.EVMInterpreterFlag.Value, utils.EVMInterpreterFlag.Usage)
74+
flag.StringVar(&vmconfig.EWASMInterpreter, utils.EWASMInterpreterFlag.Name, utils.EWASMInterpreterFlag.Value, utils.EWASMInterpreterFlag.Usage)
75+
flag.Parse()
76+
return vmconfig
77+
}()
78+
6879
func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
69-
err := test(vm.Config{})
80+
err := test(testVMConfig)
7081
if err == nil {
7182
return
7283
}

0 commit comments

Comments
 (0)