From: Cosmos Nicolaou Date: Tue, 29 Aug 2023 21:34:40 +0000 (-0700) Subject: runtime/pprof: print stderr on test failure X-Git-Tag: go1.22rc1~1018 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=660feea72f64d9d6d619529f10afd8c042299c65;p=gostls13.git 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 Reviewed-by: Dmitri Shuralyov Reviewed-by: Bryan Mills Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI --- diff --git a/src/runtime/pprof/vminfo_darwin_test.go b/src/runtime/pprof/vminfo_darwin_test.go index c476110b09..b2b025668e 100644 --- a/src/runtime/pprof/vminfo_darwin_test.go +++ b/src/runtime/pprof/vminfo_darwin_test.go @@ -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) }