Add a new module named prebuilt_dsp.
prebuilt_dsp soong module allows to install DSP related file to <partition>/etc/dsp directory. If soc_specific property is enabled to true, it is then installed to <partition>/dsp directory for vendor image. Bug: b/157259542 Test: Wrote unit test cases. Change-Id: I15431a14bf399338a00835718dfe29544be02e34
This commit is contained in:
@@ -35,6 +35,7 @@ func init() {
|
|||||||
android.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
android.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
||||||
android.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
android.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
||||||
android.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
android.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
||||||
|
android.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
type prebuiltEtcProperties struct {
|
type prebuiltEtcProperties struct {
|
||||||
@@ -293,3 +294,15 @@ func PrebuiltFirmwareFactory() android.Module {
|
|||||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
|
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
|
||||||
|
// If soc_specific property is set to true, the DSP related file is installed to the vendor <partition>/dsp
|
||||||
|
// directory for vendor image.
|
||||||
|
func PrebuiltDSPFactory() android.Module {
|
||||||
|
module := &PrebuiltEtc{}
|
||||||
|
module.socInstallDirBase = "dsp"
|
||||||
|
InitPrebuiltEtcModule(module, "etc/dsp")
|
||||||
|
// This module is device-only
|
||||||
|
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
|
||||||
|
return module
|
||||||
|
}
|
||||||
|
@@ -65,6 +65,7 @@ func testPrebuiltEtc(t *testing.T, bp string) (*android.TestContext, android.Con
|
|||||||
ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
||||||
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
||||||
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
|
||||||
|
ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
|
||||||
ctx.Register(config)
|
ctx.Register(config)
|
||||||
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
|
||||||
android.FailIfErrored(t, errs)
|
android.FailIfErrored(t, errs)
|
||||||
@@ -281,3 +282,39 @@ func TestPrebuiltFirmwareDirPath(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPrebuiltDSPDirPath(t *testing.T) {
|
||||||
|
targetPath := filepath.Join(buildDir, "/target/product/test_device")
|
||||||
|
tests := []struct {
|
||||||
|
description string
|
||||||
|
config string
|
||||||
|
expectedPath string
|
||||||
|
}{{
|
||||||
|
description: "prebuilt: system dsp",
|
||||||
|
config: `
|
||||||
|
prebuilt_dsp {
|
||||||
|
name: "foo.conf",
|
||||||
|
src: "foo.conf",
|
||||||
|
}`,
|
||||||
|
expectedPath: filepath.Join(targetPath, "system/etc/dsp"),
|
||||||
|
}, {
|
||||||
|
description: "prebuilt: vendor dsp",
|
||||||
|
config: `
|
||||||
|
prebuilt_dsp {
|
||||||
|
name: "foo.conf",
|
||||||
|
src: "foo.conf",
|
||||||
|
soc_specific: true,
|
||||||
|
sub_dir: "sub_dir",
|
||||||
|
}`,
|
||||||
|
expectedPath: filepath.Join(targetPath, "vendor/dsp/sub_dir"),
|
||||||
|
}}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.description, func(t *testing.T) {
|
||||||
|
ctx, _ := testPrebuiltEtc(t, tt.config)
|
||||||
|
p := ctx.ModuleForTests("foo.conf", "android_arm64_armv8-a").Module().(*PrebuiltEtc)
|
||||||
|
if p.installDirPath.String() != tt.expectedPath {
|
||||||
|
t.Errorf("expected %q, got %q", tt.expectedPath, p.installDirPath)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user