diff options
author | 2021-02-24 01:49:52 +0000 | |
---|---|---|
committer | 2021-02-26 23:01:50 +0000 | |
commit | 358161232cc80d6bd9daf6b0c9fb042d04f41502 (patch) | |
tree | eb5a0a250245f4486aec814cce285a39a30a7266 /android/testing.go | |
parent | 30e3e9d21d3898bc1e97917b4a0428fb696d0804 (diff) |
Add test fixture support
Adds the test fixture support and converts a few tests to exercise the
code and show how it works.
Bug: 181070625
Test: m nothing
Change-Id: I0a2b40fff93b6041f9aa8c4ef0aba91da1bc8bf3
Diffstat (limited to 'android/testing.go')
-rw-r--r-- | android/testing.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/android/testing.go b/android/testing.go index 1b1feb774..583279656 100644 --- a/android/testing.go +++ b/android/testing.go @@ -48,6 +48,43 @@ func NewTestContext(config Config) *TestContext { return ctx } +var PrepareForTestWithArchMutator = FixturePreparers( + // Configure architecture targets in the fixture config. + FixtureModifyConfig(modifyTestConfigToSupportArchMutator), + + // Add the arch mutator to the context. + FixtureRegisterWithContext(func(ctx RegistrationContext) { + ctx.PreDepsMutators(registerArchMutator) + }), +) + +var PrepareForTestWithDefaults = FixtureRegisterWithContext(func(ctx RegistrationContext) { + ctx.PreArchMutators(RegisterDefaultsPreArchMutators) +}) + +var PrepareForTestWithComponentsMutator = FixtureRegisterWithContext(func(ctx RegistrationContext) { + ctx.PreArchMutators(RegisterComponentsMutator) +}) + +var PrepareForTestWithPrebuilts = FixtureRegisterWithContext(RegisterPrebuiltMutators) + +var PrepareForTestWithOverrides = FixtureRegisterWithContext(func(ctx RegistrationContext) { + ctx.PostDepsMutators(RegisterOverridePostDepsMutators) +}) + +// Prepares an integration test with build components from the android package. +var PrepareForIntegrationTestWithAndroid = FixturePreparers( + // Mutators. Must match order in mutator.go. + PrepareForTestWithArchMutator, + PrepareForTestWithDefaults, + PrepareForTestWithComponentsMutator, + PrepareForTestWithPrebuilts, + PrepareForTestWithOverrides, + + // Modules + PrepareForTestWithFilegroup, +) + func NewTestArchContext(config Config) *TestContext { ctx := NewTestContext(config) ctx.preDeps = append(ctx.preDeps, registerArchMutator) |