go-ethereum/cmd/workload/main.go
rjl493456442 51c1bb76f4
cmd/workload: introduce transaction-trace test (#31288)
This pull request introduces a new test suite in workload framework, for
transaction tracing.

**test generation**
`go run . tracegen --trace-tests trace-test.json http://host:8545`

and you can choose to store the trace result in a specific folder
`go run . tracegen --trace-tests trace-test.json --trace-output
./trace-result http://host:8545`

**test run**
`./workload test -run Trace/Transaction --trace-invalid ./trace-invalid
http://host:8545`

The mismatched trace result will be saved in the specific folder for
further investigation.
2025-06-09 16:36:24 +02:00

65 lines
1.6 KiB
Go

// Copyright 2025 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"fmt"
"os"
"github.com/ethereum/go-ethereum/internal/debug"
"github.com/ethereum/go-ethereum/internal/flags"
"github.com/urfave/cli/v2"
)
var app = flags.NewApp("go-ethereum workload test tool")
func init() {
app.Flags = append(app.Flags, debug.Flags...)
app.Before = func(ctx *cli.Context) error {
flags.MigrateGlobalFlags(ctx)
return debug.Setup(ctx)
}
app.After = func(ctx *cli.Context) error {
debug.Exit()
return nil
}
app.CommandNotFound = func(ctx *cli.Context, cmd string) {
fmt.Fprintf(os.Stderr, "No such command: %s\n", cmd)
os.Exit(1)
}
// Add subcommands.
app.Commands = []*cli.Command{
runTestCommand,
historyGenerateCommand,
filterGenerateCommand,
traceGenerateCommand,
filterPerfCommand,
}
}
func main() {
exit(app.Run(os.Args))
}
func exit(err any) {
if err == nil {
os.Exit(0)
}
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}