summaryrefslogtreecommitdiff
path: root/filesystem/filesystem_test.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2024-10-28 22:49:38 +0000
committer Spandan Das <spandandas@google.com> 2024-10-31 17:03:32 +0000
commit9263188d99be646e559bb78777c65f8516b3d0a7 (patch)
treeea8e8bdd7f91d022b20b6279f457e1fea308f260 /filesystem/filesystem_test.go
parent840880cf7627d2342f78c9b25419eaf059b43799 (diff)
Add linker.config.pb support to android_filesystem
As part of the mk->bp conversion, all modules and partitions will eventually be built with Soong. vendor.img (built with kati) uses some rules in build/make/core to install a /etc/linker.config.pb file. This CL adds this logic to `android_filesystem`. This soong module will eventually be used to build vendor.img There are two main inputs to linker.config.pb generation for vendor. 1. PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS, a list of json files 2. List of stub libraries installed in vendor (1) will be passed to `android_filesystem` as `Linker_config_srcs`. (2) has a subtle difference between kati and soong implementation. Kati uses `SOONG_STUB_VENDOR_LIBRARIES` to determine the list of all vendor stub libraries in the tree, and then uses `--system $TARGET_OUT/vendor` to filter in the libraries which are actually installed. For the Soong implementation, this will be replaced with ctx.VisitDirectDeps, followed by child.HasStubVariants Test: go test ./filesystem Bug: 375686533 Change-Id: I6f9130d2aa866dcac9272b71939e40ed50a952ac
Diffstat (limited to 'filesystem/filesystem_test.go')
-rw-r--r--filesystem/filesystem_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 730006116..cb27f6464 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -664,3 +664,24 @@ cc_library {
fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList"))
android.AssertDeepEquals(t, "Shared library dep of overridden binary should not be installed", fileList, "bin/binfoo1\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo2.so\nlib64/libm.so\n")
}
+
+func TestInstallLinkerConfigFile(t *testing.T) {
+ result := fixture.RunTestWithBp(t, `
+android_filesystem {
+ name: "myfilesystem",
+ deps: ["libfoo_has_no_stubs", "libfoo_has_stubs"],
+ linker_config_srcs: ["linker.config.json"]
+}
+cc_library {
+ name: "libfoo_has_no_stubs",
+}
+cc_library {
+ name: "libfoo_has_stubs",
+ stubs: {symbol_file: "libfoo.map.txt"},
+}
+ `)
+
+ linkerConfigCmd := result.ModuleForTests("myfilesystem", "android_common").Rule("build_filesystem_image").RuleParams.Command
+ android.AssertStringDoesContain(t, "", linkerConfigCmd, "conv_linker_config proto --force -s linker.config.json")
+ android.AssertStringDoesContain(t, "", linkerConfigCmd, "--key provideLibs --value libfoo_has_stubs.so")
+}