Prepare tests for dexpreopt changes. am: c67528bf7e
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23206714 Change-Id: I468d89ed0ec9eec3a24a9d0e4e85f597370057ca Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -38,6 +38,7 @@ bootstrap_go_package {
|
||||
"apex_test.go",
|
||||
"bootclasspath_fragment_test.go",
|
||||
"classpath_element_test.go",
|
||||
"dexpreopt_bootjars_test.go",
|
||||
"metadata_test.go",
|
||||
"platform_bootclasspath_test.go",
|
||||
"systemserver_classpath_fragment_test.go",
|
||||
|
@@ -146,7 +146,7 @@ var prepareForApexTest = android.GroupFixturePreparers(
|
||||
android.PrepareForTestWithAndroidBuildComponents,
|
||||
bpf.PrepareForTestWithBpf,
|
||||
cc.PrepareForTestWithCcBuildComponents,
|
||||
java.PrepareForTestWithJavaDefaultModules,
|
||||
java.PrepareForTestWithDexpreopt,
|
||||
prebuilt_etc.PrepareForTestWithPrebuiltEtc,
|
||||
rust.PrepareForTestWithRustDefaultModules,
|
||||
sh.PrepareForTestWithShBuildComponents,
|
||||
|
@@ -1250,7 +1250,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable(t *testing.T) {
|
||||
func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithBootclasspathFragment,
|
||||
java.PrepareForTestWithJavaDefaultModules,
|
||||
java.PrepareForTestWithDexpreopt,
|
||||
prepareForTestWithArtApex,
|
||||
prepareForTestWithMyapex,
|
||||
// Configure bootclasspath jars to ensure that hidden API encoding is performed on them.
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package java
|
||||
package apex
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/java"
|
||||
)
|
||||
|
||||
func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOutputs []string) {
|
||||
@@ -48,10 +49,10 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu
|
||||
`
|
||||
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForJavaTest,
|
||||
PrepareForTestWithJavaSdkLibraryFiles,
|
||||
FixtureWithLastReleaseApis("foo"),
|
||||
FixtureConfigureBootJars("platform:foo", "system_ext:bar", "platform:baz"),
|
||||
java.PrepareForTestWithDexpreopt,
|
||||
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||
java.FixtureWithLastReleaseApis("foo"),
|
||||
java.FixtureConfigureBootJars("platform:foo", "system_ext:bar", "platform:baz"),
|
||||
).RunTestWithBp(t, bp)
|
||||
|
||||
platformBootclasspath := result.ModuleForTests("platform-bootclasspath", "android_common")
|
@@ -27,7 +27,7 @@ import (
|
||||
func TestModulesSingleton(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
PrepareForTestWithApexMultitreeSingleton,
|
||||
java.PrepareForTestWithDexpreopt,
|
||||
java.PrepareForTestWithJavaDefaultModules,
|
||||
PrepareForTestWithApexBuildComponents,
|
||||
java.FixtureConfigureApexBootJars("myapex:foo"),
|
||||
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||
|
@@ -20,6 +20,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/dexpreopt"
|
||||
"android/soong/java"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
@@ -30,7 +31,7 @@ import (
|
||||
// apexes.
|
||||
|
||||
var prepareForTestWithPlatformBootclasspath = android.GroupFixturePreparers(
|
||||
java.PrepareForTestWithDexpreopt,
|
||||
java.PrepareForTestWithJavaDefaultModules,
|
||||
PrepareForTestWithApexBuildComponents,
|
||||
)
|
||||
|
||||
@@ -249,6 +250,8 @@ func TestPlatformBootclasspathDependencies(t *testing.T) {
|
||||
java.FixtureConfigureApexBootJars("myapex:bar"),
|
||||
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||
java.FixtureWithLastReleaseApis("foo"),
|
||||
java.PrepareForTestWithDexpreopt,
|
||||
dexpreopt.FixtureDisableDexpreoptBootImages(false),
|
||||
).RunTestWithBp(t, `
|
||||
apex {
|
||||
name: "com.android.art",
|
||||
@@ -539,9 +542,6 @@ func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) {
|
||||
// Not a prebuilt as no prebuilt existed when it was added.
|
||||
"platform:legacy.core.platform.api.stubs",
|
||||
|
||||
// Needed for generating the boot image.
|
||||
"platform:dex2oatd",
|
||||
|
||||
// The platform_bootclasspath intentionally adds dependencies on both source and prebuilt
|
||||
// modules when available as it does not know which one will be preferred.
|
||||
"myapex:foo",
|
||||
|
@@ -87,7 +87,6 @@ bootstrap_go_package {
|
||||
"device_host_converter_test.go",
|
||||
"dex_test.go",
|
||||
"dexpreopt_test.go",
|
||||
"dexpreopt_bootjars_test.go",
|
||||
"dexpreopt_config_test.go",
|
||||
"droiddoc_test.go",
|
||||
"droidstubs_test.go",
|
||||
|
@@ -212,7 +212,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
preparers := android.GroupFixturePreparers(
|
||||
PrepareForTestWithJavaDefaultModules,
|
||||
PrepareForTestWithDexpreopt,
|
||||
PrepareForTestWithFakeApexMutator,
|
||||
dexpreopt.FixtureSetApexSystemServerJars("com.android.apex1:service-foo"),
|
||||
)
|
||||
@@ -257,7 +257,7 @@ func TestDex2oatToolDeps(t *testing.T) {
|
||||
|
||||
preparers := android.GroupFixturePreparers(
|
||||
cc.PrepareForTestWithCcDefaultModules,
|
||||
PrepareForTestWithJavaDefaultModulesWithoutFakeDex2oatd,
|
||||
PrepareForTestWithDexpreoptWithoutFakeDex2oatd,
|
||||
dexpreopt.PrepareForTestByEnablingDexpreopt)
|
||||
|
||||
testDex2oatToolDep := func(sourceEnabled, prebuiltEnabled, prebuiltPreferred bool,
|
||||
@@ -299,7 +299,7 @@ func TestDex2oatToolDeps(t *testing.T) {
|
||||
|
||||
func TestDexpreoptBuiltInstalledForApex(t *testing.T) {
|
||||
preparers := android.GroupFixturePreparers(
|
||||
PrepareForTestWithJavaDefaultModules,
|
||||
PrepareForTestWithDexpreopt,
|
||||
PrepareForTestWithFakeApexMutator,
|
||||
dexpreopt.FixtureSetApexSystemServerJars("com.android.apex1:service-foo"),
|
||||
)
|
||||
@@ -386,7 +386,7 @@ func verifyEntries(t *testing.T, message string, expectedModule string,
|
||||
|
||||
func TestAndroidMkEntriesForApex(t *testing.T) {
|
||||
preparers := android.GroupFixturePreparers(
|
||||
PrepareForTestWithJavaDefaultModules,
|
||||
PrepareForTestWithDexpreopt,
|
||||
PrepareForTestWithFakeApexMutator,
|
||||
dexpreopt.FixtureSetApexSystemServerJars("com.android.apex1:service-foo"),
|
||||
)
|
||||
|
@@ -39,7 +39,9 @@ var prepareForTestWithDefaultPlatformBootclasspath = android.FixtureAddTextFile(
|
||||
`)
|
||||
|
||||
var hiddenApiFixtureFactory = android.GroupFixturePreparers(
|
||||
prepareForJavaTest, PrepareForTestWithHiddenApiBuildComponents)
|
||||
PrepareForTestWithJavaDefaultModules,
|
||||
PrepareForTestWithHiddenApiBuildComponents,
|
||||
)
|
||||
|
||||
func TestHiddenAPISingleton(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
|
@@ -46,12 +46,11 @@ var prepareForJavaTest = android.GroupFixturePreparers(
|
||||
// Get the CC build components but not default modules.
|
||||
cc.PrepareForTestWithCcBuildComponents,
|
||||
// Include all the default java modules.
|
||||
PrepareForTestWithJavaDefaultModules,
|
||||
PrepareForTestWithDexpreopt,
|
||||
PrepareForTestWithOverlayBuildComponents,
|
||||
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
|
||||
ctx.RegisterPreSingletonType("sdk_versions", sdkPreSingletonFactory)
|
||||
}),
|
||||
PrepareForTestWithDexpreopt,
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
@@ -18,14 +18,12 @@ import (
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/dexpreopt"
|
||||
)
|
||||
|
||||
// Contains some simple tests for platform_bootclasspath.
|
||||
|
||||
var prepareForTestWithPlatformBootclasspath = android.GroupFixturePreparers(
|
||||
PrepareForTestWithJavaDefaultModules,
|
||||
dexpreopt.PrepareForTestByEnablingDexpreopt,
|
||||
)
|
||||
|
||||
func TestPlatformBootclasspath(t *testing.T) {
|
||||
|
@@ -80,9 +80,7 @@ var prepareForTestWithFrameworkDeps = android.GroupFixturePreparers(
|
||||
}.AddToFixture(),
|
||||
)
|
||||
|
||||
// Test fixture preparer that will define all default java modules except the
|
||||
// fake_tool_binary for dex2oatd.
|
||||
var PrepareForTestWithJavaDefaultModulesWithoutFakeDex2oatd = android.GroupFixturePreparers(
|
||||
var prepareForTestWithJavaDefaultModulesBase = android.GroupFixturePreparers(
|
||||
// Make sure that all the module types used in the defaults are registered.
|
||||
PrepareForTestWithJavaBuildComponents,
|
||||
prepareForTestWithFrameworkDeps,
|
||||
@@ -92,13 +90,21 @@ var PrepareForTestWithJavaDefaultModulesWithoutFakeDex2oatd = android.GroupFixtu
|
||||
|
||||
// Test fixture preparer that will define default java modules, e.g. standard prebuilt modules.
|
||||
var PrepareForTestWithJavaDefaultModules = android.GroupFixturePreparers(
|
||||
PrepareForTestWithJavaDefaultModulesWithoutFakeDex2oatd,
|
||||
dexpreopt.PrepareForTestWithFakeDex2oatd,
|
||||
prepareForTestWithJavaDefaultModulesBase,
|
||||
dexpreopt.FixtureDisableDexpreoptBootImages(true),
|
||||
dexpreopt.FixtureDisableDexpreopt(true),
|
||||
)
|
||||
|
||||
// Provides everything needed by dexpreopt.
|
||||
var PrepareForTestWithDexpreopt = android.GroupFixturePreparers(
|
||||
PrepareForTestWithJavaDefaultModules,
|
||||
prepareForTestWithJavaDefaultModulesBase,
|
||||
dexpreopt.PrepareForTestWithFakeDex2oatd,
|
||||
dexpreopt.PrepareForTestByEnablingDexpreopt,
|
||||
)
|
||||
|
||||
// Provides everything needed by dexpreopt except the fake_tool_binary for dex2oatd.
|
||||
var PrepareForTestWithDexpreoptWithoutFakeDex2oatd = android.GroupFixturePreparers(
|
||||
prepareForTestWithJavaDefaultModulesBase,
|
||||
dexpreopt.PrepareForTestByEnablingDexpreopt,
|
||||
)
|
||||
|
||||
|
@@ -74,7 +74,7 @@ func fixtureAddPrebuiltApexForBootclasspathFragment(apex, fragment string) andro
|
||||
func TestSnapshotWithBootclasspathFragment_ImageName(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForSdkTestWithJava,
|
||||
java.PrepareForTestWithJavaDefaultModules,
|
||||
java.PrepareForTestWithDexpreopt,
|
||||
prepareForSdkTestWithApex,
|
||||
|
||||
// Some additional files needed for the art apex.
|
||||
|
Reference in New Issue
Block a user