summaryrefslogtreecommitdiff
path: root/android/testing.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-03-30 16:55:41 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-03-30 16:55:41 +0000
commitb2786a3fdc36cb87c5ef5a9b4940cacffc0a90f2 (patch)
tree669e7acfb28b4ab864574942c1e937805182383c /android/testing.go
parent03d56c774396c166539b837d7ff72ed557a4da03 (diff)
parent962783a660d991cf925cd695a67d7484c4ff427d (diff)
Merge "Add TestingModule.Outputs"
Diffstat (limited to 'android/testing.go')
-rw-r--r--android/testing.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/android/testing.go b/android/testing.go
index bfea6c514..acec6fc01 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -816,6 +816,22 @@ 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
+// on the returned Paths.
+func (m TestingModule) OutputFiles(t *testing.T, tag string) Paths {
+ producer, ok := m.module.(OutputFileProducer)
+ if !ok {
+ t.Fatalf("%q must implement OutputFileProducer\n", m.module.Name())
+ }
+ paths, err := producer.OutputFiles(tag)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ return paths.RelativeToTop()
+}
+
// TestingSingleton is wrapper around an android.Singleton that provides methods to find information about individual
// ctx.Build parameters for verification in tests.
type TestingSingleton struct {