diff options
author | 2021-09-17 02:51:48 +0100 | |
---|---|---|
committer | 2021-09-20 14:17:09 +0100 | |
commit | a4aaa47a00ceb2c8509850411e3e09cd0564bc5a (patch) | |
tree | 48e9ecac0a387f12ef9ccdaa07629bd8b150b943 /android/testing.go | |
parent | 2c6ede11cc91c1eaec00741ded3d136d1f63b637 (diff) |
Show less ambiguous paths in the error when it fails to match the given
output file.
PathRelativeToTop should give an unambiguous path that can be used for
matching, as opposed to Rel().
Test: `m nothing` with a test with an invalid Output() call
Change-Id: I6d501df6acb0a1700f1480bd4250320f69278c39
Diffstat (limited to 'android/testing.go')
-rw-r--r-- | android/testing.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/android/testing.go b/android/testing.go index bd2faa291..78b32995e 100644 --- a/android/testing.go +++ b/android/testing.go @@ -748,7 +748,7 @@ func (b baseTestingComponent) buildParamsFromDescription(desc string) TestingBui } func (b baseTestingComponent) maybeBuildParamsFromOutput(file string) (TestingBuildParams, []string) { - var searchedOutputs []string + searchedOutputs := WritablePaths(nil) for _, p := range b.provider.BuildParamsForTests() { outputs := append(WritablePaths(nil), p.Outputs...) outputs = append(outputs, p.ImplicitOutputs...) @@ -759,10 +759,17 @@ func (b baseTestingComponent) maybeBuildParamsFromOutput(file string) (TestingBu if f.String() == file || f.Rel() == file || PathRelativeToTop(f) == file { return b.newTestingBuildParams(p), nil } - searchedOutputs = append(searchedOutputs, f.Rel()) + searchedOutputs = append(searchedOutputs, f) } } - return TestingBuildParams{}, searchedOutputs + + formattedOutputs := []string{} + for _, f := range searchedOutputs { + formattedOutputs = append(formattedOutputs, + fmt.Sprintf("%s (rel=%s)", PathRelativeToTop(f), f.Rel())) + } + + return TestingBuildParams{}, formattedOutputs } func (b baseTestingComponent) buildParamsFromOutput(file string) TestingBuildParams { |