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