summaryrefslogtreecommitdiff
path: root/android/testing.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2024-10-15 20:45:35 +0000
committer Yu Liu <yudiliu@google.com> 2024-10-29 19:21:44 +0000
commite70976d4d537dc69cb9f53557251065f3beb1a72 (patch)
treef9147acc403b809227567938549ab0c4fa4dd22d /android/testing.go
parentcc723c5a2727e5c111d0f4cad7bd9e042371b066 (diff)
Revert^2 "Convert cc modules to use AndroidMkInfoProvider."
This reverts commit 37e6794ad44926e64c1f733dbe32bbf5a40efe77. Reason for revert: reland with fix to the test Bug: 358427516 Test: Unit tests and manually compare generated mk files. Change-Id: Iddc34471f15cfe0c8ed863d05a1344e295925565
Diffstat (limited to 'android/testing.go')
-rw-r--r--android/testing.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/android/testing.go b/android/testing.go
index 7440869f3..23aadda53 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -19,6 +19,7 @@ import (
"fmt"
"path/filepath"
"regexp"
+ "runtime"
"sort"
"strings"
"sync"
@@ -1152,6 +1153,30 @@ func AndroidMkEntriesForTest(t *testing.T, ctx *TestContext, mod blueprint.Modul
return entriesList
}
+func AndroidMkInfoForTest(t *testing.T, ctx *TestContext, mod blueprint.Module) *AndroidMkProviderInfo {
+ if runtime.GOOS == "darwin" && mod.(Module).base().Os() != Darwin {
+ // The AndroidMkInfo provider is not set in this case.
+ t.Skip("AndroidMkInfo provider is not set on darwin")
+ }
+
+ t.Helper()
+ var ok bool
+ if _, ok = mod.(AndroidMkProviderInfoProducer); !ok {
+ t.Errorf("module does not implement AndroidMkProviderInfoProducer: " + mod.Name())
+ }
+
+ info := OtherModuleProviderOrDefault(ctx, mod, AndroidMkInfoProvider)
+ aconfigUpdateAndroidMkInfos(ctx, mod.(Module), info)
+ info.PrimaryInfo.fillInEntries(ctx, mod)
+ if len(info.ExtraInfo) > 0 {
+ for _, ei := range info.ExtraInfo {
+ ei.fillInEntries(ctx, mod)
+ }
+ }
+
+ return info
+}
+
func AndroidMkDataForTest(t *testing.T, ctx *TestContext, mod blueprint.Module) AndroidMkData {
t.Helper()
var p AndroidMkDataProvider