diff options
Diffstat (limited to 'dependency/vts_vndk_dependency_test.py')
-rw-r--r-- | dependency/vts_vndk_dependency_test.py | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/dependency/vts_vndk_dependency_test.py b/dependency/vts_vndk_dependency_test.py index 312c3b5..a89c3c3 100644 --- a/dependency/vts_vndk_dependency_test.py +++ b/dependency/vts_vndk_dependency_test.py @@ -38,6 +38,7 @@ class VtsVndkDependencyTest(unittest.TestCase): _dut: The AndroidDevice under test. _temp_dir: The temporary directory to which the odm and vendor partitions are copied. + _vndk_version: The VNDK version of the device. _ll_ndk: Set of strings. The names of low-level NDK libraries in /system/lib[64]. _sp_hal: List of patterns. The names of the same-process HAL libraries @@ -122,8 +123,9 @@ class VtsVndkDependencyTest(unittest.TestCase): else: logging.info("Skip adb pull %s", target_dir) + self._vndk_version = self._dut.GetVndkVersion() vndk_lists = vndk_data.LoadVndkLibraryListsFromResources( - self._dut.GetVndkVersion(), + self._vndk_version, vndk_data.SP_HAL, vndk_data.LL_NDK, vndk_data.VNDK, @@ -132,7 +134,11 @@ class VtsVndkDependencyTest(unittest.TestCase): sp_hal_strings = vndk_lists[0] self._sp_hal = [re.compile(x) for x in sp_hal_strings] - (self._ll_ndk, self._vndk, self._vndk_sp) = vndk_lists[1:] + self._ll_ndk = vndk_lists[1] + if vndk_utils.IsVndkInstalledInVendor(self._dut): + (self._vndk, self._vndk_sp) = ([], []) + else: + (self._vndk, self._vndk_sp) = vndk_lists[2:] logging.debug("LL_NDK: %s", self._ll_ndk) logging.debug("SP_HAL: %s", sp_hal_strings) @@ -257,9 +263,8 @@ class VtsVndkDependencyTest(unittest.TestCase): target_path) continue if not self._IsElfObjectBuiltForAndroid(elf, target_path): - logging.warning("%s is not built for Android, which is no " - "longer exempted.", target_path) - + logging.warning("%s is not built for Android", target_path) + continue deps, runpaths = elf.ListDependencies() except elf_parser.ElfError as e: elf_error_handler(target_path, e) @@ -385,6 +390,17 @@ class VtsVndkDependencyTest(unittest.TestCase): sp_hal_namespace = self._FindLibsInLinkPaths( bitness, self._VENDOR_PERMITTED_PATHS, objs) + if vndk_utils.IsVndkInstalledInVendor(self._dut): + vndk_in_vendor = [ + target_path_module.basename(lib_path) for lib_path in + self._dut.FindFiles( + vndk_utils.GetVndkDirectory(bitness, self._vndk_version), + "*", "!", "-type", "d")] + logging.info("%d-bit VNDK libraries installed in vendor: %s", + bitness, vndk_in_vendor) + else: + vndk_in_vendor = [] + # Find same-process HAL and dependencies sp_hal_libs = set() for link_path in sp_hal_link_paths: @@ -417,7 +433,7 @@ class VtsVndkDependencyTest(unittest.TestCase): obj not in vndk_sp_ext_deps} dep_errors = self._FindDisallowedDependencies( vendor_objs, vendor_namespace, vendor_link_paths, - self._ll_ndk, self._vndk, self._vndk_sp) + self._ll_ndk, self._vndk, self._vndk_sp, vndk_in_vendor) # A VNDK-SP extension library/dependency is allowed to depend on # LL-NDK @@ -432,7 +448,7 @@ class VtsVndkDependencyTest(unittest.TestCase): # restrictions are the same. dep_errors.extend(self._FindDisallowedDependencies( vndk_sp_ext_deps - sp_hal_libs, vendor_namespace, - vendor_link_paths, self._ll_ndk, self._vndk_sp)) + vendor_link_paths, self._ll_ndk, self._vndk_sp, vndk_in_vendor)) if not vndk_utils.IsVndkRuntimeEnforced(self._dut): logging.warning("Ignore dependency errors: %s", dep_errors) @@ -444,7 +460,7 @@ class VtsVndkDependencyTest(unittest.TestCase): # Other same-process HAL libraries and dependencies dep_errors.extend(self._FindDisallowedDependencies( sp_hal_libs, sp_hal_namespace, sp_hal_link_paths, - self._ll_ndk, self._vndk_sp)) + self._ll_ndk, self._vndk_sp, vndk_in_vendor)) return dep_errors def testElfDependency(self): @@ -455,7 +471,9 @@ class VtsVndkDependencyTest(unittest.TestCase): self._temp_dir, self._TARGET_ROOT_DIR, abi_list, lambda p, e: read_errors.append((p, str(e)))) - dep_errors = self._TestElfDependency(32, objs) + dep_errors = [] + if self._dut.GetCpuAbiList(32): + dep_errors.extend(self._TestElfDependency(32, objs)) if self._dut.GetCpuAbiList(64): dep_errors.extend(self._TestElfDependency(64, objs)) |