summaryrefslogtreecommitdiff
path: root/filesystem/filesystem_test.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2024-10-18 18:35:50 +0000
committer Spandan Das <spandandas@google.com> 2024-10-18 18:35:50 +0000
commit8a49643e6b727490898ea94b41667eecf24685f2 (patch)
tree816d46d0db9116c28acb0366d366d0ccde5121d4 /filesystem/filesystem_test.go
parentd9875bc11afeac1c8f23aa48b4329173c4f89fca (diff)
Use a partition packaging spec filter for android_filesystem
This revives https://r.android.com/3308803. The use case for this filter is 1. To remove the transitive shared library dependencies of `system_ext` binaries that are intended to be installed in `system`. Without this filter, we get two copies of libc.so, libz.so, ... on device 2. To filter out dexpreopt files of apps. Even if an app is installed in `/system_ext`, its dexpreopt files will be installed in `system_other`. Kati allows this by allowing ctx.InstallFile to specify the path relative to device root. Diff in autogenerated `system_ext` partition for aosp cf before and after this CL https://diff.googleplex.com/#key=6ekb09PtreNh Test: go test ./filesystem Bug: 372487849 Change-Id: Ie52723be2469d3b210ee1ebb62997d378d44788b
Diffstat (limited to 'filesystem/filesystem_test.go')
-rw-r--r--filesystem/filesystem_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 057dcaaff..1e508364c 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -584,3 +584,28 @@ func TestErofsPartition(t *testing.T) {
android.AssertStringDoesContain(t, "erofs fs type compress hint", buildImageConfig, "erofs_default_compress_hints=compress_hints.txt")
android.AssertStringDoesContain(t, "erofs fs type sparse", buildImageConfig, "erofs_sparse_flag=-s")
}
+
+// If a system_ext/ module depends on system/ module, the dependency should *not*
+// be installed in system_ext/
+func TestDoNotPackageCrossPartitionDependencies(t *testing.T) {
+ result := fixture.RunTestWithBp(t, `
+ android_filesystem {
+ name: "myfilesystem",
+ deps: ["binfoo"],
+ partition_type: "system_ext",
+ }
+
+ cc_binary {
+ name: "binfoo",
+ shared_libs: ["libfoo"],
+ system_ext_specific: true,
+ }
+ cc_library_shared {
+ name: "libfoo", // installed in system/
+ }
+ `)
+
+ partition := result.ModuleForTests("myfilesystem", "android_common")
+ fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
+ android.AssertDeepEquals(t, "filesystem with dependencies on different partition", "bin/binfoo\n", fileList)
+}