Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tests/integration/bless/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type ScriptProcessor struct {
patterns []MaskPattern
stdoutConv Converter
stderrConv Converter
stdoutPrefixes []string
stdoutPrefixes map[string]bool
}

const (
Expand All @@ -48,11 +48,12 @@ const (
okOutput = "OK!"
)

var defaultStdoutPrefixes = []string{
"GAS USED:",
"STORAGE DELTA:",
"TOTAL TX COST:",
"EVENTS:",
var defaultStdoutPrefixes = map[string]bool{
"GAS USED:": true,
"STORAGE DELTA:": true,
"STORAGE FEE:": true,
"TOTAL TX COST:": true,
"EVENTS:": true,
}

func main() {
Expand Down Expand Up @@ -366,7 +367,7 @@ func (p *outputParser) shouldKeepStdoutLine(line, cmd string) bool {
}

// Check against known prefixes
for _, prefix := range p.processor.stdoutPrefixes {
for prefix := range p.processor.stdoutPrefixes {
if strings.HasPrefix(line, prefix) {
return true
}
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/bless/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ func (rg *ReportGenerator) parseGasOutput(lines []string) []GasValue {
continue
}

// Only parse lines that START with known stdout prefixes
// This filters out commented lines like "# stdout 'GAS USED:'"
if !isValidStdoutLine(trimmed) {
continue
}

// Parse GAS USED
if matches := gasUsedPattern.FindStringSubmatch(trimmed); len(matches) > 1 {
current.GasUsed, _ = strconv.ParseUint(matches[1], 10, 64)
Expand All @@ -219,6 +225,17 @@ func (rg *ReportGenerator) parseGasOutput(lines []string) []GasValue {
return values
}

// isValidStdoutLine checks if a line starts with a known stdout prefix.
// Used to filter out commented lines like "# stdout 'GAS USED:'"
func isValidStdoutLine(line string) bool {
for prefix := range defaultStdoutPrefixes {
if strings.HasPrefix(line, prefix) {
return true
}
}
return false
}

// buildReport creates a GasReport from parsed data
func (rg *ReportGenerator) buildReport(functions []FunctionInfo, gasValues []GasValue) *GasReport {
report := &GasReport{
Expand Down
Loading
Loading