summaryrefslogtreecommitdiff
path: root/apex/apex_test.go
diff options
context:
space:
mode:
author Yo Chiang <yochiang@google.com> 2020-07-23 20:09:18 +0800
committer Yo Chiang <yochiang@google.com> 2020-07-24 20:05:20 +0800
commite812805e756d37108d16cfe7da784169369c7e86 (patch)
tree088d313261694c96f9af68e833ffe1f1a1a4c3eb /apex/apex_test.go
parent13aa44fc15ea718b0c31a8a3c60f4bbe9cea9763 (diff)
Use BaseModuleName() + SubName as apexFile.moduleName
This change fixes this error: ``` TARGET module com.android.adbd.flattened requires non-existent TARGET module: prebuilt_libclang_rt.ubsan_standalone-arm-android ``` apexFile.moduleName is used as Make dependency name, so it should use m.BaseModuleName() instead of m.Name(), because soong may prepend "prebuilt_" to or mutate the output of m.Name() in other ways. android/androidmk.go emits Android.mk modules with `LOCAL_MODULE := module.BaseModuleName() + <SubName>`, so replace apexFile.moduleName with BaseModuleName() + <SubName> as much as possible. Bug: 7456955 Test: Add unit test in apex/apex_test.go Test: lunch blueline_hwasan && SANITIZE_TARGET='hwaddress fuzzer' m nothing Test: Verify out/soong/Android-blueline_hwasan.mk Change-Id: If8537fc1bedbe6c3405de3662a5df210a073c43f
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index f06433848..360061410 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -5179,6 +5179,57 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
ensureRealfileExists(t, files, "lib64/myotherlib.so") // this is a real file
}
+func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
+ ctx, config := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ native_shared_libs: ["mylib"],
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library_shared {
+ name: "mylib",
+ srcs: ["mylib.cpp"],
+ shared_libs: ["myotherlib"],
+ system_shared_libs: [],
+ stl: "none",
+ apex_available: [
+ "myapex",
+ "//apex_available:platform",
+ ],
+ }
+
+ cc_prebuilt_library_shared {
+ name: "myotherlib",
+ srcs: ["prebuilt.so"],
+ system_shared_libs: [],
+ stl: "none",
+ apex_available: [
+ "myapex",
+ "//apex_available:platform",
+ ],
+ }
+ `)
+
+ apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
+ data := android.AndroidMkDataForTest(t, config, "", apexBundle)
+ var builder strings.Builder
+ data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
+ androidMk := builder.String()
+ // `myotherlib` is added to `myapex` as symlink
+ ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n")
+ ensureNotContains(t, androidMk, "LOCAL_MODULE := prebuilt_myotherlib.myapex\n")
+ ensureNotContains(t, androidMk, "LOCAL_MODULE := myotherlib.myapex\n")
+ // `myapex` should have `myotherlib` in its required line, not `prebuilt_myotherlib`
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += mylib.myapex myotherlib apex_manifest.pb.myapex apex_pubkey.myapex\n")
+}
+
func TestApexWithJniLibs(t *testing.T) {
ctx, _ := testApex(t, `
apex {