Skip to content

Commit

Permalink
sweet/cmd/sweet: fix benchmark error report
Browse files Browse the repository at this point in the history
CL 600235 added code to print the benchmark log tail on failure, but
that code overwrote the error from the benchmark itself, causing the
log print to print a useless (generally <nil>) error. Fix this.

Change-Id: I4cd6bfeb08108b66fc5450c9e64bb13ed9fc1628
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/600795
Auto-Submit: Austin Clements <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
aclements authored and gopherbot committed Jul 24, 2024
1 parent 0997f8f commit 43f3923
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sweet/cmd/sweet/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ func (b *benchmark) execute(cfgs []*common.Config, r *runCfg) error {
if err := b.harness.Run(cfgs[i], &setup); err != nil {
debug.SetGCPercent(gogc)
// Useful error messages are often in the log. Grab the end.
logTail, err := readFileTail(setup.Results)
if err != nil {
logTail = fmt.Sprintf("error reading log tail: %s", err)
logTail, tailErr := readFileTail(setup.Results)
if tailErr != nil {
logTail = fmt.Sprintf("error reading log tail: %s", tailErr)
}
setup.Results.Close()
return fmt.Errorf("run benchmark %s for config %s: %v\nLog tail:\n%s", b.name, cfgs[i].Name, err, logTail)
Expand Down

0 comments on commit 43f3923

Please sign in to comment.