summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsin-Yi Chen <hsinyichen@google.com>2020-10-01 20:14:32 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-10-01 20:14:32 +0000
commit7b70531ab250558b37873c7428570f10d673e4c6 (patch)
tree48bbfb53a2002956792c22d92bb9862e44b1a309
parent3aa7c19c0ab25a462b2c1fbe8893d7025bf1a1ce (diff)
parentc8721fe510cac24a88b3808ce20cb408892cd11c (diff)
downloadvndk-7b70531ab250558b37873c7428570f10d673e4c6.tar.gz
Add searching path for app internal libraries am: 68f5276dbb am: c8721fe510
Original change: https://android-review.googlesource.com/c/platform/test/vts-testcase/vndk/+/1440551 Change-Id: Iee92e7ce8ead8280654ffa906f5e200bff8cbde0
-rw-r--r--dependency/VtsVndkDependencyTest.py43
1 files changed, 29 insertions, 14 deletions
diff --git a/dependency/VtsVndkDependencyTest.py b/dependency/VtsVndkDependencyTest.py
index 0302220..28e87c9 100644
--- a/dependency/VtsVndkDependencyTest.py
+++ b/dependency/VtsVndkDependencyTest.py
@@ -52,6 +52,7 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
/system/lib[64]/vndk-sp-${VER}.
_SP_HAL_LINK_PATHS: Format strings of same-process HAL's link paths.
_VENDOR_LINK_PATHS: Format strings of vendor processes' link paths.
+ _VENDOR_APP_DIRS: The app directories in vendor partitions.
"""
_TARGET_ROOT_DIR = "/"
_TARGET_ODM_DIR = "/odm"
@@ -65,6 +66,9 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
"/odm/{LIB}/hw", "/odm/{LIB}/egl", "/odm/{LIB}",
"/vendor/{LIB}/hw", "/vendor/{LIB}/egl", "/vendor/{LIB}"
]
+ _VENDOR_APP_DIRS = [
+ "/vendor/app", "/vendor/priv-app", "/odm/app", "/odm/priv-app"
+ ]
_DEFAULT_PROGRAM_INTERPRETERS = [
"/system/bin/linker", "/system/bin/linker64"
]
@@ -290,9 +294,10 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
Args:
objs: A collection of ElfObject, the libraries/executables.
- is_allowed_dependency: A function that takes the library name as the
- argument and returns whether objs can depend
- on the library.
+ is_allowed_dependency: A function that takes a library name and an
+ ElfObject as the arguments, and returns
+ whether the object can depend on the
+ library.
Returns:
List of tuples (path, disallowed_dependencies). The library with
@@ -301,7 +306,7 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
dep_errors = []
for obj in objs:
disallowed_libs = [
- x for x in obj.deps if not is_allowed_dependency(x)]
+ x for x in obj.deps if not is_allowed_dependency(x, obj)]
if disallowed_libs:
dep_errors.append((obj.target_path, disallowed_libs))
return dep_errors
@@ -326,10 +331,20 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
List of tuples (path, disallowed_dependencies).
"""
vendor_lib_names = set(x.name for x in vendor_libs)
- is_allowed_dep = lambda x: (x in self._ll_ndk or
- x in self._vndk or
- x in self._vndk_sp or
- x in vendor_lib_names)
+ # b/123216664 App libraries depend on those in the same directory.
+ vendor_app_lib_names = {}
+ for obj in vendor_objs:
+ if any(obj.target_dir.startswith(app_dir + "/") for app_dir in
+ self._VENDOR_APP_DIRS):
+ vendor_app_lib_names.setdefault(
+ obj.target_dir, set()).add(obj.name)
+
+ is_allowed_dep = lambda name, obj: (
+ name in self._ll_ndk or
+ name in self._vndk or
+ name in self._vndk_sp or
+ name in vendor_lib_names or
+ name in vendor_app_lib_names.get(obj.target_dir, ()))
return self._FilterDisallowedDependencies(vendor_objs, is_allowed_dep)
def _TestVndkSpExtDependency(self, vndk_sp_ext_deps, vendor_libs):
@@ -353,9 +368,9 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
List of tuples (path, disallowed_dependencies).
"""
vendor_lib_names = set(x.name for x in vendor_libs)
- is_allowed_dep = lambda x: (x in self._ll_ndk or
- x in self._vndk_sp or
- x in vendor_lib_names)
+ is_allowed_dep = lambda x, obj: (x in self._ll_ndk or
+ x in self._vndk_sp or
+ x in vendor_lib_names)
return self._FilterDisallowedDependencies(
vndk_sp_ext_deps, is_allowed_dep)
@@ -375,9 +390,9 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
List of tuples (path, disallowed_dependencies).
"""
sp_hal_lib_names = set(x.name for x in sp_hal_libs)
- is_allowed_dep = lambda x: (x in self._ll_ndk or
- x in self._vndk_sp or
- x in sp_hal_lib_names)
+ is_allowed_dep = lambda x, obj: (x in self._ll_ndk or
+ x in self._vndk_sp or
+ x in sp_hal_lib_names)
return self._FilterDisallowedDependencies(sp_hal_libs, is_allowed_dep)
def _TestElfDependency(self, bitness, objs):