summaryrefslogtreecommitdiff
path: root/android/testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/testing.go')
-rw-r--r--android/testing.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/android/testing.go b/android/testing.go
index 3a6643941..79d0c9b41 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -179,6 +179,16 @@ var PrepareForTestDisallowNonExistentPaths = FixtureModifyConfig(func(config Con
config.TestAllowNonExistentPaths = false
})
+// PrepareForTestWithBuildFlag returns a FixturePreparer that sets the given flag to the given value.
+func PrepareForTestWithBuildFlag(flag, value string) FixturePreparer {
+ return FixtureModifyProductVariables(func(variables FixtureProductVariables) {
+ if variables.BuildFlags == nil {
+ variables.BuildFlags = make(map[string]string)
+ }
+ variables.BuildFlags[flag] = value
+ })
+}
+
func NewTestArchContext(config Config) *TestContext {
ctx := NewTestContext(config)
ctx.preDeps = append(ctx.preDeps, registerArchMutator)
@@ -207,7 +217,7 @@ func (ctx *TestContext) HardCodedPreArchMutators(f RegisterMutatorFunc) {
ctx.PreArchMutators(f)
}
-func (ctx *TestContext) moduleProvider(m blueprint.Module, p blueprint.AnyProviderKey) (any, bool) {
+func (ctx *TestContext) otherModuleProvider(m blueprint.Module, p blueprint.AnyProviderKey) (any, bool) {
return ctx.Context.ModuleProvider(m, p)
}
@@ -225,7 +235,7 @@ func (ctx *TestContext) FinalDepsMutators(f RegisterMutatorFunc) {
func (ctx *TestContext) OtherModuleProviderAdaptor() OtherModuleProviderContext {
return NewOtherModuleProviderAdaptor(func(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) {
- return ctx.moduleProvider(module, provider)
+ return ctx.otherModuleProvider(module, provider)
})
}