forked from cerc-io/plugeth
tests: Add flag to use EVMC for state tests (#18084)
This commit is contained in:
parent
197d609b9a
commit
0699287440
@ -18,10 +18,12 @@ package tests
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -65,8 +67,17 @@ 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.
|
||||||
const traceErrorLimit = 400000
|
const traceErrorLimit = 400000
|
||||||
|
|
||||||
|
// The VM config for state tests that accepts --vm.* command line arguments.
|
||||||
|
var testVMConfig = func() vm.Config {
|
||||||
|
vmconfig := vm.Config{}
|
||||||
|
flag.StringVar(&vmconfig.EVMInterpreter, utils.EVMInterpreterFlag.Name, utils.EVMInterpreterFlag.Value, utils.EVMInterpreterFlag.Usage)
|
||||||
|
flag.StringVar(&vmconfig.EWASMInterpreter, utils.EWASMInterpreterFlag.Name, utils.EWASMInterpreterFlag.Value, utils.EWASMInterpreterFlag.Usage)
|
||||||
|
flag.Parse()
|
||||||
|
return vmconfig
|
||||||
|
}()
|
||||||
|
|
||||||
func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
|
func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
|
||||||
err := test(vm.Config{})
|
err := test(testVMConfig)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user