未验证 提交 fc9e0be8 编写于 作者: A Alessandro Arzilli 提交者: GitHub

tests: changes to investigate TestClientServer_FullStacktrace errors (#2236)

Changs TestClientServer_FullStacktrace and
Test1ClientServer_FullStacktrace to log more information, also removes
code from TestFrameEvaluation that could mask the error.

Updates #2231
上级 3d0a93c5
......@@ -1302,23 +1302,9 @@ func TestFrameEvaluation(t *testing.T) {
found[vval] = true
}
firsterr := false
if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) {
// We try to make sure that all goroutines are stopped at a sensible place
// before reading their stacktrace, but due to the nature of the test
// program there is no guarantee that we always find them in a reasonable
// state.
// Asynchronous preemption in Go 1.14 exacerbates this problem, to avoid
// unnecessary flakiness allow a single goroutine to be in a bad state.
firsterr = true
}
for i := range found {
if !found[i] {
if firsterr {
firsterr = false
} else {
t.Fatalf("Goroutine %d not found\n", i)
}
t.Fatalf("Goroutine %d not found\n", i)
}
}
......
......@@ -730,19 +730,20 @@ func Test1ClientServer_FullStacktrace(t *testing.T) {
for _, g := range gs {
frames, err := c.Stacktrace(g.ID, 10, true)
assertNoError(err, t, fmt.Sprintf("Stacktrace(%d)", g.ID))
t.Logf("goroutine %d", g.ID)
for i, frame := range frames {
t.Logf("\tframe %d off=%#x bpoff=%#x pc=%#x %s:%d %s", i, frame.FrameOffset, frame.FramePointerOffset, frame.PC, frame.File, frame.Line, frame.Function.Name())
if frame.Function == nil {
continue
}
if frame.Function.Name() != "main.agoroutine" {
continue
}
t.Logf("frame %d: %v", i, frame)
for _, arg := range frame.Arguments {
if arg.Name != "i" {
continue
}
t.Logf("frame %d, variable i is %v\n", i, arg)
t.Logf("\tvariable i is %+v\n", arg)
argn, err := strconv.Atoi(arg.Value)
if err == nil {
found[argn] = true
......@@ -757,6 +758,8 @@ func Test1ClientServer_FullStacktrace(t *testing.T) {
}
}
t.Logf("continue")
state = <-c.Continue()
if state.Err != nil {
t.Fatalf("Continue(): %v\n", state.Err)
......@@ -767,10 +770,10 @@ func Test1ClientServer_FullStacktrace(t *testing.T) {
cur := 3
for i, frame := range frames {
t.Logf("\tframe %d off=%#x bpoff=%#x pc=%#x %s:%d %s", i, frame.FrameOffset, frame.FramePointerOffset, frame.PC, frame.File, frame.Line, frame.Function.Name())
if i == 0 {
continue
}
t.Logf("frame %d: %v", i, frame)
v := frame.Var("n")
if v == nil {
t.Fatalf("Could not find value of variable n in frame %d", i)
......
......@@ -925,19 +925,20 @@ func TestClientServer_FullStacktrace(t *testing.T) {
for _, g := range gs {
frames, err := c.Stacktrace(g.ID, 10, 0, &normalLoadConfig)
assertNoError(err, t, fmt.Sprintf("Stacktrace(%d)", g.ID))
t.Logf("goroutine %d", g.ID)
for i, frame := range frames {
t.Logf("\tframe %d off=%#x bpoff=%#x pc=%#x %s:%d %s", i, frame.FrameOffset, frame.FramePointerOffset, frame.PC, frame.File, frame.Line, frame.Function.Name())
if frame.Function == nil {
continue
}
if frame.Function.Name() != "main.agoroutine" {
continue
}
t.Logf("frame %d: %v", i, frame)
for _, arg := range frame.Arguments {
if arg.Name != "i" {
continue
}
t.Logf("frame %v, variable i is %v\n", frame, arg)
t.Logf("\tvariable i is %+v\n", arg)
argn, err := strconv.Atoi(arg.Value)
if err == nil {
found[argn] = true
......@@ -952,6 +953,8 @@ func TestClientServer_FullStacktrace(t *testing.T) {
}
}
t.Logf("continue")
state = <-c.Continue()
if state.Err != nil {
t.Fatalf("Continue(): %v\n", state.Err)
......@@ -962,10 +965,10 @@ func TestClientServer_FullStacktrace(t *testing.T) {
cur := 3
for i, frame := range frames {
t.Logf("\tframe %d off=%#x bpoff=%#x pc=%#x %s:%d %s", i, frame.FrameOffset, frame.FramePointerOffset, frame.PC, frame.File, frame.Line, frame.Function.Name())
if i == 0 {
continue
}
t.Logf("frame %d: %v", i, frame)
v := frame.Var("n")
if v == nil {
t.Fatalf("Could not find value of variable n in frame %d", i)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册