Add a test to check the intall partitions

cc modules have complex image variant settings. To avoid setting
wrong partitions to modules, add a test to check the install
partition.

Bug: 184885453
Test: m nothing
Change-Id: I080661335f2da7281d6e6a0d2fedd1fcecb4b2cb
This commit is contained in:
Justin Yun
2021-04-12 13:19:28 +09:00
parent 33db5cbf6e
commit 7f99ec7c1f
2 changed files with 135 additions and 11 deletions

View File

@@ -49,23 +49,15 @@ const (
)
func (ctx *moduleContext) ProductSpecific() bool {
// Additionally check if this module is inProduct() that means it is a "product" variant of a
// module. As well as product specific modules, product variants must be installed to /product.
return ctx.ModuleContext.ProductSpecific() || ctx.mod.InProduct()
return ctx.ModuleContext.ProductSpecific() || ctx.mod.productSpecificModuleContext()
}
func (ctx *moduleContext) SocSpecific() bool {
// Additionally check if this module is inVendor() that means it is a "vendor" variant of a
// module. As well as SoC specific modules, vendor variants must be installed to /vendor
// unless they have "odm_available: true".
return ctx.ModuleContext.SocSpecific() ||
(ctx.mod.HasVendorVariant() && ctx.mod.InVendor() && !ctx.mod.VendorVariantToOdm())
return ctx.ModuleContext.SocSpecific() || ctx.mod.socSpecificModuleContext()
}
func (ctx *moduleContext) DeviceSpecific() bool {
// Some vendor variants want to be installed to /odm by setting "odm_available: true".
return ctx.ModuleContext.DeviceSpecific() ||
(ctx.mod.HasVendorVariant() && ctx.mod.InVendor() && ctx.mod.VendorVariantToOdm())
return ctx.ModuleContext.DeviceSpecific() || ctx.mod.deviceSpecificModuleContext()
}
func (ctx *moduleContextImpl) inProduct() bool {
@@ -88,6 +80,24 @@ func (ctx *moduleContextImpl) inRecovery() bool {
return ctx.mod.InRecovery()
}
func (c *Module) productSpecificModuleContext() bool {
// Additionally check if this module is inProduct() that means it is a "product" variant of a
// module. As well as product specific modules, product variants must be installed to /product.
return c.InProduct()
}
func (c *Module) socSpecificModuleContext() bool {
// Additionally check if this module is inVendor() that means it is a "vendor" variant of a
// module. As well as SoC specific modules, vendor variants must be installed to /vendor
// unless they have "odm_available: true".
return c.HasVendorVariant() && c.InVendor() && !c.VendorVariantToOdm()
}
func (c *Module) deviceSpecificModuleContext() bool {
// Some vendor variants want to be installed to /odm by setting "odm_available: true".
return c.InVendor() && c.VendorVariantToOdm()
}
// Returns true when this module is configured to have core and vendor variants.
func (c *Module) HasVendorVariant() bool {
return Bool(c.VendorProperties.Vendor_available) || Bool(c.VendorProperties.Odm_available)