Skip to content

Commit

Permalink
runtime/pprof: print stderr on test failure
Browse files Browse the repository at this point in the history
Print Stderr on test failure to track down the intermittent
test failure reported in issue #62352.

Change-Id: I547a3220dc07d05578dac093d6c028a9103b552a
Reviewed-on: https://go-review.googlesource.com/c/go/+/524156
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
cosnicolaou authored and cherrymui committed Sep 1, 2023
1 parent 38b623f commit 660feea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/runtime/pprof/vminfo_darwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"internal/abi"
"internal/testenv"
"os"
"os/exec"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -54,9 +55,14 @@ func TestVMInfo(t *testing.T) {
func useVMMap(t *testing.T) (hi, lo uint64) {
pid := strconv.Itoa(os.Getpid())
testenv.MustHaveExecPath(t, "vmmap")
out, err := testenv.Command(t, "vmmap", pid).Output()
cmd := testenv.Command(t, "vmmap", pid)
out, err := cmd.Output()
if err != nil {
t.Fatal(err)
t.Logf("vmmap failed: %s", out)
if ee, ok := err.(*exec.ExitError); ok && len(ee.Stderr) > 0 {
t.Fatalf("%v: %v\n%s", cmd, err, ee.Stderr)
}
t.Fatalf("%v: %v", cmd, err)
}
return parseVmmap(t, out)
}
Expand Down

0 comments on commit 660feea

Please sign in to comment.