1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:44:46 -07:00

runtime/pprof: print stderr on test failure

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>
This commit is contained in:
Cosmos Nicolaou 2023-08-29 14:34:40 -07:00 committed by Cherry Mui
parent 38b623f42d
commit 660feea72f

View File

@ -12,6 +12,7 @@ import (
"internal/abi"
"internal/testenv"
"os"
"os/exec"
"strconv"
"strings"
"testing"
@ -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)
}