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
diff --git a/sdk/testing.go b/sdk/testing.go
index 307b6de..d21f425 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -27,13 +27,9 @@
"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 @@
"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) {