summaryrefslogtreecommitdiff
path: root/filesystem/filesystem_test.go
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2022-03-25 12:35:46 +0900
committer Jooyung Han <jooyung@google.com> 2022-03-29 07:56:02 +0900
commit0fbbc2b0d4bcebe2be1f91301f972be97b6fdbdc (patch)
tree11a34ee8d1c851acba107f483206ab844e033968 /filesystem/filesystem_test.go
parenta8834282934f9a098d1fd6f991142a9a2b227656 (diff)
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 <intermediate>/microdroid.img -R 'ls system' shows no "com.android.runtime" Change-Id: Ibc3d85ead2fda99e231132ce8ab9ccf1cc9317b7
Diffstat (limited to 'filesystem/filesystem_test.go')
-rw-r--r--filesystem/filesystem_test.go55
1 files changed, 53 insertions, 2 deletions
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)
+}