mirror of
https://github.com/golang/go
synced 2024-11-19 00:04:40 -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:
parent
38b623f42d
commit
660feea72f
@ -12,6 +12,7 @@ import (
|
|||||||
"internal/abi"
|
"internal/abi"
|
||||||
"internal/testenv"
|
"internal/testenv"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -54,9 +55,14 @@ func TestVMInfo(t *testing.T) {
|
|||||||
func useVMMap(t *testing.T) (hi, lo uint64) {
|
func useVMMap(t *testing.T) (hi, lo uint64) {
|
||||||
pid := strconv.Itoa(os.Getpid())
|
pid := strconv.Itoa(os.Getpid())
|
||||||
testenv.MustHaveExecPath(t, "vmmap")
|
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 {
|
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)
|
return parseVmmap(t, out)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user