summaryrefslogtreecommitdiff
path: root/apex/bootclasspath_fragment_test.go
diff options
context:
space:
mode:
author Martin Stjernholm <mast@google.com> 2021-06-30 16:35:07 +0100
committer Martin Stjernholm <mast@google.com> 2021-12-07 23:30:30 +0000
commit43c44b00d63aef2d84aee2e2e7b9bce14dceb91b (patch)
tree0a1ef6b726e6a8e4a285e94fc6477b12730eee49 /apex/bootclasspath_fragment_test.go
parentd2d8e322f1ea3de8d4d7f13110b52f797f38dc30 (diff)
Do not allow duplicate deapexer dependencies.
Without these errors, the last encountered deapexer would silently be used. However with PRODUCT_INSTALL_APEXES there will only be deapexer for installable APEXes, and we can assume only a single installable APEX exists for each APEX variant, so make it an error if it isn't the case. Corresponding to http://ag/15156931. Test: m nothing SOONG_CONFIG_art_module_source_build=true Test: m nothing SOONG_CONFIG_art_module_source_build=false Test: m nothing SOONG_CONFIG_art_module_source_build=false with installable:true for the com.android.art.debug prebuilt APEX - check that it fails with an "ambiguous duplicate deapexer" error Bug: 192006406 Bug: 192542393 Change-Id: I44566fd26b12f82a8a67fe4a69e56303460756d0
Diffstat (limited to 'apex/bootclasspath_fragment_test.go')
-rw-r--r--apex/bootclasspath_fragment_test.go53
1 files changed, 39 insertions, 14 deletions
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index 9e030f10c..7ecf9b20f 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -548,7 +548,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
}
func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) {
- result := android.GroupFixturePreparers(
+ preparers := android.GroupFixturePreparers(
prepareForTestWithBootclasspathFragment,
prepareForTestWithArtApex,
@@ -559,7 +559,9 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) {
// Configure some libraries in the art bootclasspath_fragment.
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
- ).RunTestWithBp(t, `
+ )
+
+ bp := `
prebuilt_apex {
name: "com.android.art",
arch: {
@@ -605,22 +607,45 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) {
all_flags: "mybootclasspathfragment/all-flags.csv",
},
}
- `)
- java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{
- `com.android.art.apex.selector`,
- `prebuilt_mybootclasspathfragment`,
- })
+ // A prebuilt apex with the same apex_name that shouldn't interfere when it isn't enabled.
+ prebuilt_apex {
+ name: "com.mycompany.android.art",
+ apex_name: "com.android.art",
+ %s
+ src: "com.mycompany.android.art.apex",
+ exported_bootclasspath_fragments: ["mybootclasspathfragment"],
+ }
+ `
- java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_com.android.art", []string{
- `com.android.art.deapexer`,
- `dex2oatd`,
- `prebuilt_bar`,
- `prebuilt_foo`,
+ t.Run("disabled alternative APEX", func(t *testing.T) {
+ result := preparers.RunTestWithBp(t, fmt.Sprintf(bp, "enabled: false,"))
+
+ java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{
+ `com.android.art.apex.selector`,
+ `prebuilt_mybootclasspathfragment`,
+ })
+
+ java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_com.android.art", []string{
+ `com.android.art.deapexer`,
+ `dex2oatd`,
+ `prebuilt_bar`,
+ `prebuilt_foo`,
+ })
+
+ module := result.ModuleForTests("mybootclasspathfragment", "android_common_com.android.art")
+ checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
+
+ // Check that the right deapexer module was chosen for a boot image.
+ param := module.Output("out/soong/test_device/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art")
+ android.AssertStringDoesContain(t, "didn't find the expected deapexer in the input path", param.Input.String(), "/com.android.art.deapexer")
})
- module := result.ModuleForTests("mybootclasspathfragment", "android_common_com.android.art")
- checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
+ t.Run("enabled alternative APEX", func(t *testing.T) {
+ preparers.ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
+ "Multiple installable prebuilt APEXes provide ambiguous deapexers: com.android.art and com.mycompany.android.art")).
+ RunTestWithBp(t, fmt.Sprintf(bp, ""))
+ })
}
// checkCopiesToPredefinedLocationForArt checks that the supplied modules are copied to the