Include objdump failures in test output.
We log a warning if objdump fails, but this appears in the build log, not test log, which can make it hard to notice. Include it with the actual escape output as context on "(possible)" to make it more clear when something is wrong. PiperOrigin-RevId: 350355759
This commit is contained in:
parent
a1e3845b65
commit
23f94cee67
|
@ -618,12 +618,12 @@ func findReasons(pass *analysis.Pass, fdecl *ast.FuncDecl) ([]EscapeReason, bool
|
||||||
|
|
||||||
// run performs the analysis.
|
// run performs the analysis.
|
||||||
func run(pass *analysis.Pass, localEscapes bool) (interface{}, error) {
|
func run(pass *analysis.Pass, localEscapes bool) (interface{}, error) {
|
||||||
calls, err := loadObjdump()
|
calls, callsErr := loadObjdump()
|
||||||
if err != nil {
|
if callsErr != nil {
|
||||||
// Note that if this analysis fails, then we don't actually
|
// Note that if this analysis fails, then we don't actually
|
||||||
// fail the analyzer itself. We simply report every possible
|
// fail the analyzer itself. We simply report every possible
|
||||||
// escape. In most cases this will work just fine.
|
// escape. In most cases this will work just fine.
|
||||||
log.Printf("WARNING: unable to load objdump: %v", err)
|
log.Printf("WARNING: unable to load objdump: %v", callsErr)
|
||||||
}
|
}
|
||||||
allEscapes := make(map[string][]Escapes)
|
allEscapes := make(map[string][]Escapes)
|
||||||
mergedEscapes := make(map[string]Escapes)
|
mergedEscapes := make(map[string]Escapes)
|
||||||
|
@ -645,10 +645,10 @@ func run(pass *analysis.Pass, localEscapes bool) (interface{}, error) {
|
||||||
}
|
}
|
||||||
hasCall := func(inst poser) (string, bool) {
|
hasCall := func(inst poser) (string, bool) {
|
||||||
p := linePosition(inst, nil)
|
p := linePosition(inst, nil)
|
||||||
if calls == nil {
|
if callsErr != nil {
|
||||||
// See above: we don't have access to the binary
|
// See above: we don't have access to the binary
|
||||||
// itself, so need to include every possible call.
|
// itself, so need to include every possible call.
|
||||||
return "(possible)", true
|
return fmt.Sprintf("(possible, unable to load objdump: %v)", callsErr), true
|
||||||
}
|
}
|
||||||
s, ok := calls[p.Simplified()]
|
s, ok := calls[p.Simplified()]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue