From 0fbbc2b0d4bcebe2be1f91301f972be97b6fdbdc Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 25 Mar 2022 12:35:46 +0900 Subject: android_system_image only packages "system" items android_system_image filers packaging items installed outside "system" partition. Some packaging items install related items to different partitions but putting them altogether to android_system_image doesn't make sense. (android_system_image is suppposed to be "system" partition) To be specific, this filters out "apex" partition items. "apex" partition is used by APEX installation to install APEX contents to paths similar to activated paths on device so that symbol lookup works well with APEX contents. Bug: 225121718 Test: atest MicrodroidHostTestCases Test: debugfs /microdroid.img -R 'ls system' shows no "com.android.runtime" Change-Id: Ibc3d85ead2fda99e231132ce8ab9ccf1cc9317b7 --- filesystem/filesystem_test.go | 55 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'filesystem/filesystem_test.go') diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go index e78fdffde..cda06d907 100644 --- a/filesystem/filesystem_test.go +++ b/filesystem/filesystem_test.go @@ -45,11 +45,11 @@ func TestFileSystemDeps(t *testing.T) { func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) { result := fixture.RunTestWithBp(t, ` - android_system_image { + android_system_image { name: "myfilesystem", deps: [ "libfoo", - "libbar", + "libbar", ], linker_config_src: "linker.config.json", } @@ -74,3 +74,54 @@ func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) { android.AssertStringDoesNotContain(t, "linker.config.pb should not have libbar", output.RuleParams.Command, "libbar.so") } + +func registerComponent(ctx android.RegistrationContext) { + ctx.RegisterModuleType("component", componentFactory) +} + +func componentFactory() android.Module { + m := &component{} + m.AddProperties(&m.properties) + android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) + return m +} + +type component struct { + android.ModuleBase + properties struct { + Install_copy_in_data []string + } +} + +func (c *component) GenerateAndroidBuildActions(ctx android.ModuleContext) { + output := android.PathForModuleOut(ctx, c.Name()) + dir := android.PathForModuleInstall(ctx, "components") + ctx.InstallFile(dir, c.Name(), output) + + dataDir := android.PathForModuleInPartitionInstall(ctx, "data", "components") + for _, d := range c.properties.Install_copy_in_data { + ctx.InstallFile(dataDir, d, output) + } +} + +func TestFileSystemGathersItemsOnlyInSystemPartition(t *testing.T) { + f := android.GroupFixturePreparers(fixture, android.FixtureRegisterWithContext(registerComponent)) + result := f.RunTestWithBp(t, ` + android_system_image { + name: "myfilesystem", + multilib: { + common: { + deps: ["foo"], + }, + }, + linker_config_src: "linker.config.json", + } + component { + name: "foo", + install_copy_in_data: ["bar"], + } + `) + + module := result.ModuleForTests("myfilesystem", "android_common").Module().(*systemImage) + android.AssertDeepEquals(t, "entries should have foo only", []string{"components/foo"}, module.entries) +} -- cgit v1.2.3-59-g8ed1b