From 4e6e35c561aca19e2176a2ef80595612b6c2f0a1 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Mon, 22 Mar 2021 11:34:57 +0000 Subject: [PATCH] Improve searching for TestingBuildParams using the output file When searching for an TestingBuildParams this change will compare the supplied path against the value returned by PathRelativeToTop() as well as the String() and Rel() values. In the event that it cannot find the file it also formats the available outputs, one per line with both rel and path relative to top. Bug: 182885307 Test: m nothing Change-Id: Icbd37018b9a028abf37e27d1bea12a407316e031 --- android/testing.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/testing.go b/android/testing.go index d6d829cd0..abfc65932 100644 --- a/android/testing.go +++ b/android/testing.go @@ -585,7 +585,7 @@ func (b baseTestingComponent) maybeBuildParamsFromOutput(file string) (TestingBu outputs = append(outputs, p.Output) } for _, f := range outputs { - if f.String() == file || f.Rel() == file { + if f.String() == file || f.Rel() == file || PathRelativeToTop(f) == file { return b.newTestingBuildParams(p), nil } searchedOutputs = append(searchedOutputs, f.Rel()) @@ -597,8 +597,8 @@ func (b baseTestingComponent) maybeBuildParamsFromOutput(file string) (TestingBu func (b baseTestingComponent) buildParamsFromOutput(file string) TestingBuildParams { p, searchedOutputs := b.maybeBuildParamsFromOutput(file) if p.Rule == nil { - panic(fmt.Errorf("couldn't find output %q.\nall outputs: %v", - file, searchedOutputs)) + panic(fmt.Errorf("couldn't find output %q.\nall outputs:\n %s\n", + file, strings.Join(searchedOutputs, "\n "))) } return p }