diff options
author | 2024-06-13 17:02:59 -0700 | |
---|---|---|
committer | 2024-06-14 11:09:54 -0700 | |
commit | e81e77a2b16936610c90c5af36efb8e4a5b47b3c (patch) | |
tree | 50dd2552175bc87e278ab0cfb34b6545256d9150 | |
parent | 7467410787dd39f3770428fc06586cf831995874 (diff) |
Add another way for TestingModule to get its output files
In OutputFiles method, TestingModule is able to get its own output
files by reading its module base property. If the TestingModule
never updates its outputFiles property, it will fall back to use the OutputFileProducer interface.
Only empty string tag case is added in this CL since all the testing modules are getting the output files using empty string tag.
Test: CI
Bug: 339477385
Change-Id: I3009ae45d8d909653e3b6b222bced9ccabbaede7
-rw-r--r-- | android/testing.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/android/testing.go b/android/testing.go index 6518f4a53..6fb2997cb 100644 --- a/android/testing.go +++ b/android/testing.go @@ -1014,10 +1014,18 @@ func (m TestingModule) VariablesForTestsRelativeToTop() map[string]string { return normalizeStringMapRelativeToTop(m.config, m.module.VariablesForTests()) } -// OutputFiles calls OutputFileProducer.OutputFiles on the encapsulated module, exits the test -// immediately if there is an error and otherwise returns the result of calling Paths.RelativeToTop +// OutputFiles first checks if module base outputFiles property has any output +// files can be used to return. +// If not, it calls OutputFileProducer.OutputFiles on the +// encapsulated module, exits the test immediately if there is an error and +// otherwise returns the result of calling Paths.RelativeToTop // on the returned Paths. func (m TestingModule) OutputFiles(t *testing.T, tag string) Paths { + // TODO: add non-empty-string tag case and remove OutputFileProducer part + if tag == "" && m.module.base().outputFiles.DefaultOutputFiles != nil { + return m.module.base().outputFiles.DefaultOutputFiles.RelativeToTop() + } + producer, ok := m.module.(OutputFileProducer) if !ok { t.Fatalf("%q must implement OutputFileProducer\n", m.module.Name()) |