Allow sdk package tests to optimize their test setup

Extracts the setup for apex from prepareForSdkTest to allow it to be
reused without using all of it. That will allow tests to optimize their
test setup.

Bug: 182638834
Test: m nothing
Change-Id: I2056103b15c2737a616ee29ff890c6af0722e6d2
This commit is contained in:
Paul Duffin 2021-03-15 13:08:51 +00:00
parent c93c98e315
commit cf3ee2f87e
1 changed files with 20 additions and 6 deletions

View File

@ -27,13 +27,9 @@ import (
"android/soong/java"
)
var prepareForSdkTest = android.GroupFixturePreparers(
// Prepare for running an sdk test with an apex.
var prepareForSdkTestWithApex = android.GroupFixturePreparers(
apex.PrepareForTestWithApexBuildComponents,
cc.PrepareForTestWithCcDefaultModules,
genrule.PrepareForTestWithGenRuleBuildComponents,
java.PrepareForTestWithJavaBuildComponents,
PrepareForTestWithSdkBuildComponents,
android.FixtureAddTextFile("sdk/tests/Android.bp", `
apex_key {
name: "myapex.key",
@ -58,6 +54,24 @@ var prepareForSdkTest = android.GroupFixturePreparers(
"myapex.x509.pem": nil,
"myapex.pk8": nil,
}),
)
// Legacy preparer used for running tests within the sdk package.
//
// This includes everything that was needed to run any test in the sdk package prior to the
// introduction of the test fixtures. Tests that are being converted to use fixtures directly
// rather than through the testSdkError() and testSdkWithFs() methods should avoid using this and
// instead should use the various preparers directly using android.GroupFixturePreparers(...) to
// group them when necessary.
//
// deprecated
var prepareForSdkTest = android.GroupFixturePreparers(
cc.PrepareForTestWithCcDefaultModules,
genrule.PrepareForTestWithGenRuleBuildComponents,
java.PrepareForTestWithJavaBuildComponents,
PrepareForTestWithSdkBuildComponents,
prepareForSdkTestWithApex,
cc.PrepareForTestOnWindows,
android.FixtureModifyConfig(func(config android.Config) {