summaryrefslogtreecommitdiff
path: root/apex/apex_test.go
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2020-05-08 02:12:58 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-05-08 02:12:58 +0000
commit06938a0a16a297041b4c914d0e2dda1413e556ea (patch)
tree86c2777e40acf404a4820c4b19f3e7e0a9073b4f /apex/apex_test.go
parentaf6fbcbccacf5a2f4a7f683ca089f47d3ccb04fe (diff)
parent45b90e79c9b0807221f9d4584bd2524cac16369b (diff)
Merge changes from topic "no_staticlinking_to_stubs"
* changes: Prevent statically linking to a lib providing stable C APIs Add GetPathString
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index dc6986244..81df02a05 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -4774,6 +4774,42 @@ func TestTestFor(t *testing.T) {
ensureNotContains(t, ldFlags, "mylib/android_arm64_armv8-a_shared_1/mylib.so")
}
+func TestNoStaticLinkingToStubsLib(t *testing.T) {
+ testApexError(t, `.*required by "mylib" is a native library providing stub.*`, `
+ 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 {
+ name: "mylib",
+ srcs: ["mylib.cpp"],
+ static_libs: ["otherlib"],
+ system_shared_libs: [],
+ stl: "none",
+ apex_available: [ "myapex" ],
+ }
+
+ cc_library {
+ name: "otherlib",
+ srcs: ["mylib.cpp"],
+ system_shared_libs: [],
+ stl: "none",
+ stubs: {
+ versions: ["1", "2", "3"],
+ },
+ apex_available: [ "myapex" ],
+ }
+ `)
+}
+
func TestMain(m *testing.M) {
run := func() int {
setUp()