unexport evm state test bench command flags

This commit is contained in:
Jared Wasinger 2024-09-30 22:02:24 +07:00
parent 64cbd00e86
commit b8ed3deee7

View file

@ -35,18 +35,18 @@ import (
) )
var ( var (
ForkFlag = &cli.StringFlag{ forkFlag = &cli.StringFlag{
Name: "statetest.fork", Name: "statetest.fork",
Usage: "The hard-fork to run the test against", Usage: "The hard-fork to run the test against",
Category: flags.VMCategory, Category: flags.VMCategory,
} }
IdxFlag = &cli.IntFlag{ idxFlag = &cli.IntFlag{
Name: "statetest.index", Name: "statetest.index",
Usage: "The index of the subtest to run", Usage: "The index of the subtest to run",
Category: flags.VMCategory, Category: flags.VMCategory,
Value: -1, // default to select all subtest indices Value: -1, // default to select all subtest indices
} }
TestNameFlag = &cli.StringFlag{ testNameFlag = &cli.StringFlag{
Name: "statetest.name", Name: "statetest.name",
Usage: "The name of the state test to run", Usage: "The name of the state test to run",
Category: flags.VMCategory, Category: flags.VMCategory,
@ -58,9 +58,9 @@ var stateTestCommand = &cli.Command{
Usage: "Executes the given state tests. Filenames can be fed via standard input (batch mode) or as an argument (one-off execution).", Usage: "Executes the given state tests. Filenames can be fed via standard input (batch mode) or as an argument (one-off execution).",
ArgsUsage: "<file>", ArgsUsage: "<file>",
Flags: []cli.Flag{ Flags: []cli.Flag{
ForkFlag, forkFlag,
IdxFlag, idxFlag,
TestNameFlag, testNameFlag,
}, },
} }
@ -118,15 +118,15 @@ type stateTestCase struct {
// collectMatchedSubtests returns test cases which match against provided filtering CLI parameters // collectMatchedSubtests returns test cases which match against provided filtering CLI parameters
func collectMatchedSubtests(ctx *cli.Context, testsByName map[string]tests.StateTest) []stateTestCase { func collectMatchedSubtests(ctx *cli.Context, testsByName map[string]tests.StateTest) []stateTestCase {
var res []stateTestCase var res []stateTestCase
subtestName := ctx.String(TestNameFlag.Name) subtestName := ctx.String(testNameFlag.Name)
if subtestName != "" { if subtestName != "" {
if subtest, ok := testsByName[subtestName]; ok { if subtest, ok := testsByName[subtestName]; ok {
testsByName := make(map[string]tests.StateTest) testsByName := make(map[string]tests.StateTest)
testsByName[subtestName] = subtest testsByName[subtestName] = subtest
} }
} }
idx := ctx.Int(IdxFlag.Name) idx := ctx.Int(idxFlag.Name)
fork := ctx.String(ForkFlag.Name) fork := ctx.String(forkFlag.Name)
for key, test := range testsByName { for key, test := range testsByName {
for _, st := range test.Subtests() { for _, st := range test.Subtests() {