Skip to content

Commit

Permalink
cmd/evm: add --evmc.ewasm flag to 'evm statetest' command
Browse files Browse the repository at this point in the history
Signed-off-by: meows <b5c6@protonmail.com>
  • Loading branch information
meowsbits committed Mar 10, 2020
1 parent a4bd333 commit 88f5c66
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cmd/evm/staterunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ var stateTestCommand = cli.Command{
Name: "statetest",
Usage: "executes the given state tests",
ArgsUsage: "<file>",
Flags: []cli.Flag{stateTestEVMCEWASMFlag},
}

var stateTestEVMCEWASMFlag = cli.StringFlag{
Name: "evmc.ewasm",
Usage: "EVMC EWASM configuration",
}

// StatetestResult contains the execution status after running a state test, any
Expand All @@ -57,6 +63,11 @@ func stateTestCmd(ctx *cli.Context) error {
glogger.Verbosity(log.Lvl(ctx.GlobalInt(VerbosityFlag.Name)))
log.Root().SetHandler(glogger)

if s := ctx.String(stateTestEVMCEWASMFlag.Name); s != "" {
log.Info("Running tests with %s=%s", "evmc.ewasm", s)
vm.InitEVMCEwasm(s)
}

// Configure the EVM logger
config := &vm.LogConfig{
DisableMemory: ctx.GlobalBool(DisableMemoryFlag.Name),
Expand Down Expand Up @@ -88,8 +99,9 @@ func stateTestCmd(ctx *cli.Context) error {
}
// Iterate over all the tests, run them and aggregate the results
cfg := vm.Config{
Tracer: tracer,
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),
Tracer: tracer,
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),
EWASMInterpreter: ctx.String(stateTestEVMCEWASMFlag.Name),
}
results := make([]StatetestResult, 0, len(tests))
for key, test := range tests {
Expand Down

0 comments on commit 88f5c66

Please sign in to comment.