mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
cmd/evm: make evm statetest accept non-json files
This commit is contained in:
parent
bc1ec69008
commit
840c187eb8
3 changed files with 10 additions and 5 deletions
|
|
@ -50,7 +50,7 @@ func blockTestCmd(ctx *cli.Context) error {
|
|||
return errors.New("path argument required")
|
||||
}
|
||||
var (
|
||||
collected = collectJSONFiles(path)
|
||||
collected = collectFiles(path)
|
||||
results []testResult
|
||||
)
|
||||
for _, fname := range collected {
|
||||
|
|
|
|||
|
|
@ -262,10 +262,15 @@ func tracerFromFlags(ctx *cli.Context) *tracing.Hooks {
|
|||
}
|
||||
}
|
||||
|
||||
// collectJSONFiles walks the given path and accumulates all files with json
|
||||
// extension.
|
||||
func collectJSONFiles(path string) []string {
|
||||
// collectFiles walks the given path. If the path is a directory, it will
|
||||
// return a list of all accumulates all files with json extension.
|
||||
// Otherwise (if path points to a file), it will return the path.
|
||||
func collectFiles(path string) []string {
|
||||
var out []string
|
||||
if info, err := os.Stat(path); err == nil && !info.IsDir() {
|
||||
// User explicitly pointed out a file, ignore extension.
|
||||
return []string{path}
|
||||
}
|
||||
err := filepath.Walk(path, func(path string, info fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func stateTestCmd(ctx *cli.Context) error {
|
|||
// If path is provided, run the tests at that path.
|
||||
if len(path) != 0 {
|
||||
var (
|
||||
collected = collectJSONFiles(path)
|
||||
collected = collectFiles(path)
|
||||
results []testResult
|
||||
)
|
||||
for _, fname := range collected {
|
||||
|
|
|
|||
Loading…
Reference in a new issue