@@ -28,6 +28,7 @@ import (
2828 "github.com/ethereum/go-ethereum/common"
2929 "github.com/ethereum/go-ethereum/core"
3030 "github.com/ethereum/go-ethereum/core/rawdb"
31+ "github.com/ethereum/go-ethereum/log"
3132 "github.com/ethereum/go-ethereum/tests"
3233 "github.com/urfave/cli/v2"
3334)
@@ -42,6 +43,7 @@ var blockTestCommand = &cli.Command{
4243 HumanReadableFlag ,
4344 RunFlag ,
4445 WitnessCrossCheckFlag ,
46+ FuzzFlag ,
4547 }, traceFlags ),
4648}
4749
@@ -75,46 +77,14 @@ func blockTestCmd(ctx *cli.Context) error {
7577 if err != nil {
7678 return err
7779 }
78- report (ctx , results )
80+ // During fuzzing, we report the result after every block
81+ if ! ctx .IsSet (FuzzFlag .Name ) {
82+ report (ctx , results )
83+ }
7984 }
8085 return nil
8186}
8287
83- // traceEndMarker represents the final status of a blocktest when tracing is enabled.
84- // It is written as the last line of trace output in JSONL format to signal completion.
85- type traceEndMarker struct {
86- TestEnd traceEndDetails `json:"testEnd"`
87- }
88-
89- type traceEndDetails struct {
90- Name string `json:"name"`
91- Pass bool `json:"pass"`
92- Fork string `json:"fork"`
93- Root string `json:"root,omitempty"`
94- Error string `json:"error,omitempty"`
95- }
96-
97- // writeTraceEndMarker writes a blocktest end marker to stderr in JSONL format.
98- // This provides a clear delimiter for trace parsers (e.g., goevmlab) to know when
99- // the trace output for a specific test is complete, enabling proper batched processing.
100- func writeTraceEndMarker (name string , pass bool , fork string , root * common.Hash , errMsg string ) {
101- details := traceEndDetails {
102- Name : name ,
103- Pass : pass ,
104- Fork : fork ,
105- }
106- if root != nil {
107- details .Root = root .Hex ()
108- }
109- if ! pass && errMsg != "" {
110- details .Error = errMsg
111- }
112- marker := traceEndMarker {TestEnd : details }
113- if data , err := json .Marshal (marker ); err == nil {
114- fmt .Fprintf (os .Stderr , "%s\n " , data )
115- }
116- }
117-
11888func runBlockTest (ctx * cli.Context , fname string ) ([]testResult , error ) {
11989 src , err := os .ReadFile (fname )
12090 if err != nil {
@@ -130,6 +100,11 @@ func runBlockTest(ctx *cli.Context, fname string) ([]testResult, error) {
130100 }
131101 tracer := tracerFromFlags (ctx )
132102
103+ // Suppress INFO logs during fuzzing
104+ if ctx .IsSet (FuzzFlag .Name ) {
105+ log .SetDefault (log .NewLogger (log .DiscardHandler ()))
106+ }
107+
133108 // Pull out keys to sort and ensure tests are run in order.
134109 keys := slices .Sorted (maps .Keys (tests ))
135110
@@ -165,10 +140,9 @@ func runBlockTest(ctx *cli.Context, fname string) ([]testResult, error) {
165140 }
166141
167142 // When tracing, write end marker to delimit trace output for this test
168- if tracer != nil {
169- writeTraceEndMarker ( result . Name , result . Pass , result . Fork , finalRoot , result . Error )
143+ if ctx . IsSet ( FuzzFlag . Name ) {
144+ report ( ctx , [] testResult { * result } )
170145 }
171-
172146 results = append (results , * result )
173147 }
174148 return results , nil
0 commit comments