Add PrepareForTestWithBuildFlag
Add a helper function that creates a test fixture preparer that sets a build flag, and use it everywhere that was setting build flags manually. Test: all soong tests Flag: EXEMPT refactor Change-Id: I68d50d68787a30d091f0827e8caa51f5c5a762ef
This commit is contained in:
@@ -174,6 +174,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)
|
||||
|
Reference in New Issue
Block a user