From 25259e93e17bfc1876fcb0f0452c142602b696d9 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Sun, 7 Mar 2021 15:45:56 +0000 Subject: [PATCH] Add preparer for test to allow missing dependencies Bug: 181070625 Test: m nothing Change-Id: I426fcb19d9bea8b9551dc5c3a803228a34768fc0 --- android/testing.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/testing.go b/android/testing.go index 03d7bd5a6..dd3d607aa 100644 --- a/android/testing.go +++ b/android/testing.go @@ -24,6 +24,7 @@ import ( "testing" "github.com/google/blueprint" + "github.com/google/blueprint/proptools" ) func NewTestContext(config Config) *TestContext { @@ -105,6 +106,17 @@ var PrepareForIntegrationTestWithAndroid = GroupFixturePreparers( PrepareForTestWithAndroidBuildComponents, ) +// Prepares a test that may be missing dependencies by setting allow_missing_dependencies to +// true. +var PrepareForTestWithAllowMissingDependencies = GroupFixturePreparers( + FixtureModifyProductVariables(func(variables FixtureProductVariables) { + variables.Allow_missing_dependencies = proptools.BoolPtr(true) + }), + FixtureModifyContext(func(ctx *TestContext) { + ctx.SetAllowMissingDependencies(true) + }), +) + func NewTestArchContext(config Config) *TestContext { ctx := NewTestContext(config) ctx.preDeps = append(ctx.preDeps, registerArchMutator)