aboutsummaryrefslogtreecommitdiffstats
path: root/apex/apex_test.go
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2018-12-20 22:10:17 +0900
committerJiyong Park <jiyong@google.com>2019-01-10 09:57:29 +0900
commitb07885714c6995606b67eae2cae6459e70e4c8b9 (patch)
tree02e27c36a49b7703db34c35ec398cef20ff86d06 /apex/apex_test.go
parent10ed054a6b8de5024455a0d36edf1b3280559c07 (diff)
downloadbuild_soong-b07885714c6995606b67eae2cae6459e70e4c8b9.tar.gz
build_soong-b07885714c6995606b67eae2cae6459e70e4c8b9.tar.bz2
build_soong-b07885714c6995606b67eae2cae6459e70e4c8b9.zip
Rename non-stubs variant of a lib if it is included in APEX
If a lib is directly included in an APEX (via native_shared_libs property) and the lib has stubs (via stubs.versions property), then the ordinary non-stubs variant of the library is renamed to <libname>.bootstrap in the makefile. At the same time, the stubs variant of the lib becomes visible and it's name is <libname>. This ensures that modules in Android.mk build against the stubs variant thus preventing them from using private APIs in the lib. The non-stubs variant, however, is used if the module explicitly has set the new 'bootstrap' property to true. This is useful for building some early binaries (such as init and vold) which need to run before APEXes are activated. Since they can't use the bionic libs from the runtime APEX, they should use the bionic libs left in the system partition which is called the boostrap bionic. Bug: 120266448 Test: m Test: m with https://android-review.googlesource.com/c/platform/bionic/+/849044 Change-Id: I882b8aeb5b29460f07b4424e4f8eb844d6c9a9b0
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index f8f9b33b..d4f0f7e3 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -492,6 +492,13 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
versions: ["27", "28", "29"],
},
}
+
+ cc_library {
+ name: "libBootstrap",
+ srcs: ["mylib.cpp"],
+ stl: "none",
+ bootstrap: true,
+ }
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
@@ -499,11 +506,11 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
// Ensure that mylib, libm, libdl are included.
ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
- ensureContains(t, copyCmds, "image.apex/lib64/libm.so")
- ensureContains(t, copyCmds, "image.apex/lib64/libdl.so")
+ ensureContains(t, copyCmds, "image.apex/lib64/bionic/libm.so")
+ ensureContains(t, copyCmds, "image.apex/lib64/bionic/libdl.so")
// Ensure that libc is not included (since it has stubs and not listed in native_shared_libs)
- ensureNotContains(t, copyCmds, "image.apex/lib64/libc.so")
+ ensureNotContains(t, copyCmds, "image.apex/lib64/bionic/libc.so")
mylibLdFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_core_shared_myapex").Rule("ld").Args["libFlags"]
mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_core_static_myapex").Rule("cc").Args["cFlags"]
@@ -538,6 +545,12 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
// ... Cflags from stub is correctly exported to mylib
ensureContains(t, mylibCFlags, "__LIBDL_API__=27")
ensureContains(t, mylibSharedCFlags, "__LIBDL_API__=27")
+
+ // Ensure that libBootstrap is depending on the platform variant of bionic libs
+ libFlags := ctx.ModuleForTests("libBootstrap", "android_arm64_armv8-a_core_shared").Rule("ld").Args["libFlags"]
+ ensureContains(t, libFlags, "libc/android_arm64_armv8-a_core_shared/libc.so")
+ ensureContains(t, libFlags, "libm/android_arm64_armv8-a_core_shared/libm.so")
+ ensureContains(t, libFlags, "libdl/android_arm64_armv8-a_core_shared/libdl.so")
}
func TestFilesInSubDir(t *testing.T) {