mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
testing: update helperNames just before checking it
parent's helperNames has not been set when frameSkip called, moving
helperNames initilazing to frameSkip.
Fixes #44887
Change-Id: I5107c5951033e5e47d1ac441eac3ba5344a7bdc0
GitHub-Last-Rev: 44b90b2e2e
GitHub-Pull-Request: golang/go#45071
Reviewed-on: https://go-review.googlesource.com/c/go/+/302469
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
dcc96e4b94
commit
6704843202
2 changed files with 39 additions and 8 deletions
|
|
@ -509,6 +509,13 @@ func (c *common) frameSkip(skip int) runtime.Frame {
|
|||
}
|
||||
return prevFrame
|
||||
}
|
||||
// If more helper PCs have been added since we last did the conversion
|
||||
if c.helperNames == nil {
|
||||
c.helperNames = make(map[string]struct{})
|
||||
for pc := range c.helperPCs {
|
||||
c.helperNames[pcToName(pc)] = struct{}{}
|
||||
}
|
||||
}
|
||||
if _, ok := c.helperNames[frame.Function]; !ok {
|
||||
// Found a frame that wasn't inside a helper function.
|
||||
return frame
|
||||
|
|
@ -521,14 +528,6 @@ func (c *common) frameSkip(skip int) runtime.Frame {
|
|||
// and inserts the final newline if needed and indentation spaces for formatting.
|
||||
// This function must be called with c.mu held.
|
||||
func (c *common) decorate(s string, skip int) string {
|
||||
// If more helper PCs have been added since we last did the conversion
|
||||
if c.helperNames == nil {
|
||||
c.helperNames = make(map[string]struct{})
|
||||
for pc := range c.helperPCs {
|
||||
c.helperNames[pcToName(pc)] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
frame := c.frameSkip(skip)
|
||||
file := frame.File
|
||||
line := frame.Line
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue