Merge "Don't create non-primary arch variant for recovery-only module"
am: 9ea9fc3dee
Change-Id: Ibe1274c36c9233ee396d323544c6aa599f635ae5
This commit is contained in:
@@ -330,6 +330,10 @@ func archMutator(mctx BottomUpMutatorContext) {
|
|||||||
// Windows builds always prefer 32-bit
|
// Windows builds always prefer 32-bit
|
||||||
prefer32 = true
|
prefer32 = true
|
||||||
}
|
}
|
||||||
|
// only the primary arch in the recovery partition
|
||||||
|
if module.InstallInRecovery() {
|
||||||
|
targets = []Target{mctx.Config().Targets[Device][0]}
|
||||||
|
}
|
||||||
targets, err := decodeMultilib(multilib, targets, prefer32)
|
targets, err := decodeMultilib(multilib, targets, prefer32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mctx.ModuleErrorf("%s", err.Error())
|
mctx.ModuleErrorf("%s", err.Error())
|
||||||
|
@@ -92,6 +92,16 @@ func (ctx *TestContext) ModuleForTests(name, variant string) TestingModule {
|
|||||||
return TestingModule{module}
|
return TestingModule{module}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ctx *TestContext) ModuleVariantsForTests(name string) []string {
|
||||||
|
var variants []string
|
||||||
|
ctx.VisitAllModules(func(m blueprint.Module) {
|
||||||
|
if ctx.ModuleName(m) == name {
|
||||||
|
variants = append(variants, ctx.ModuleSubDir(m))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return variants
|
||||||
|
}
|
||||||
|
|
||||||
// MockFileSystem causes the Context to replace all reads with accesses to the provided map of
|
// MockFileSystem causes the Context to replace all reads with accesses to the provided map of
|
||||||
// filenames to contents stored as a byte slice.
|
// filenames to contents stored as a byte slice.
|
||||||
func (ctx *TestContext) MockFileSystem(files map[string][]byte) {
|
func (ctx *TestContext) MockFileSystem(files map[string][]byte) {
|
||||||
|
@@ -75,16 +75,19 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
toolchain_library {
|
toolchain_library {
|
||||||
name: "libatomic",
|
name: "libatomic",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
toolchain_library {
|
||||||
name: "libcompiler_rt-extras",
|
name: "libcompiler_rt-extras",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
toolchain_library {
|
||||||
name: "libgcc",
|
name: "libgcc",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
@@ -92,6 +95,7 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
no_libgcc: true,
|
no_libgcc: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
llndk_library {
|
llndk_library {
|
||||||
name: "libc",
|
name: "libc",
|
||||||
@@ -102,6 +106,7 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
no_libgcc: true,
|
no_libgcc: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
llndk_library {
|
llndk_library {
|
||||||
name: "libm",
|
name: "libm",
|
||||||
@@ -112,6 +117,7 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
no_libgcc: true,
|
no_libgcc: true,
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
llndk_library {
|
llndk_library {
|
||||||
name: "libdl",
|
name: "libdl",
|
||||||
@@ -124,6 +130,7 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libc++",
|
name: "libc++",
|
||||||
@@ -132,6 +139,7 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
vndk: {
|
vndk: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
support_system_process: true,
|
support_system_process: true,
|
||||||
@@ -144,14 +152,17 @@ func createTestContext(t *testing.T, config android.Config, bp string) *android.
|
|||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_object {
|
cc_object {
|
||||||
name: "crtbegin_so",
|
name: "crtbegin_so",
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_object {
|
cc_object {
|
||||||
name: "crtend_so",
|
name: "crtend_so",
|
||||||
|
recovery_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
@@ -1651,3 +1662,28 @@ func TestVendorPublicLibraries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRecovery(t *testing.T) {
|
||||||
|
ctx := testCc(t, `
|
||||||
|
cc_library_shared {
|
||||||
|
name: "librecovery",
|
||||||
|
recovery: true,
|
||||||
|
}
|
||||||
|
cc_library_shared {
|
||||||
|
name: "librecovery32",
|
||||||
|
recovery: true,
|
||||||
|
compile_multilib:"32",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
variants := ctx.ModuleVariantsForTests("librecovery")
|
||||||
|
const arm64 = "android_arm64_armv8-a_recovery_shared"
|
||||||
|
if len(variants) != 1 || !android.InList(arm64, variants) {
|
||||||
|
t.Errorf("variants of librecovery must be \"%s\" only, but was %#v", arm64, variants)
|
||||||
|
}
|
||||||
|
|
||||||
|
variants = ctx.ModuleVariantsForTests("librecovery32")
|
||||||
|
if android.InList(arm64, variants) {
|
||||||
|
t.Errorf("multilib was set to 32 for librecovery32, but its variants has %s.", arm64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user