Merge "Convert android/androidmk_test.go to test fixtures" am: aa8270eca7

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1640328

Change-Id: Iecbd20eb999bfa994b619e05d4a195804d1bbf62
This commit is contained in:
Paul Duffin
2021-03-18 08:55:57 +00:00
committed by Automerger Merge Worker

View File

@@ -141,21 +141,17 @@ func customModuleFactory() Module {
// bp module and then returns the config and the custom module called "foo".
func buildContextAndCustomModuleFoo(t *testing.T, bp string) (*TestContext, *customModule) {
t.Helper()
config := TestConfig(buildDir, nil, bp, nil)
config.katiEnabled = true // Enable androidmk Singleton
result := emptyTestFixtureFactory.RunTest(t,
// Enable androidmk Singleton
PrepareForTestWithAndroidMk,
FixtureRegisterWithContext(func(ctx RegistrationContext) {
ctx.RegisterModuleType("custom", customModuleFactory)
}),
FixtureWithRootAndroidBp(bp),
)
ctx := NewTestContext(config)
ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
ctx.RegisterModuleType("custom", customModuleFactory)
ctx.Register()
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config)
FailIfErrored(t, errs)
module := ctx.ModuleForTests("foo", "").Module().(*customModule)
return ctx, module
module := result.ModuleForTests("foo", "").Module().(*customModule)
return result.TestContext, module
}
func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) {