mirror of
https://github.com/golang/go
synced 2024-11-22 03:34:40 -07:00
runtime/pprof: continued attempt to deflake the VMInfo test.
This PR will use test.Skip to bypass a test run for which the vmmap subprocess appears to hang before the test times out. In addition it catches a different error message from vmmap that can occur due to transient resource shortages and triggers a retry for this additional case. Fixes #62352 Change-Id: I3ae749e5cd78965c45b1b7c689b896493aa37ba0 Reviewed-on: https://go-review.googlesource.com/c/go/+/560935 Reviewed-by: Michael Pratt <mpratt@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
992f63583a
commit
8ac0a7c512
@ -17,6 +17,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestVMInfo(t *testing.T) {
|
func TestVMInfo(t *testing.T) {
|
||||||
@ -56,18 +57,35 @@ func TestVMInfo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type mapping struct {
|
||||||
|
hi, lo uint64
|
||||||
|
err error
|
||||||
|
}
|
||||||
|
|
||||||
func useVMMapWithRetry(t *testing.T) (hi, lo uint64, err error) {
|
func useVMMapWithRetry(t *testing.T) (hi, lo uint64, err error) {
|
||||||
var retryable bool
|
var retryable bool
|
||||||
for {
|
ch := make(chan mapping)
|
||||||
hi, lo, retryable, err = useVMMap(t)
|
go func() {
|
||||||
if err == nil {
|
for {
|
||||||
return hi, lo, nil
|
hi, lo, retryable, err = useVMMap(t)
|
||||||
|
if err == nil {
|
||||||
|
ch <- mapping{hi, lo, nil}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !retryable {
|
||||||
|
ch <- mapping{0, 0, err}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Logf("retrying vmmap after error: %v", err)
|
||||||
}
|
}
|
||||||
if !retryable {
|
}()
|
||||||
return 0, 0, err
|
select {
|
||||||
}
|
case m := <-ch:
|
||||||
t.Logf("retrying vmmap after error: %v", err)
|
return m.hi, m.lo, m.err
|
||||||
|
case <-time.After(time.Minute):
|
||||||
|
t.Skip("vmmap taking too long")
|
||||||
}
|
}
|
||||||
|
return 0, 0, fmt.Errorf("unreachable")
|
||||||
}
|
}
|
||||||
|
|
||||||
func useVMMap(t *testing.T) (hi, lo uint64, retryable bool, err error) {
|
func useVMMap(t *testing.T) (hi, lo uint64, retryable bool, err error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user