diff options
author | Hsin-Yi Chen <hsinyichen@google.com> | 2018-02-27 04:48:43 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-02-27 04:48:43 +0000 |
commit | dee6da57131339c91158bf72d973366d5eb27ed5 (patch) | |
tree | 4beb5e20927c27de9be81b3706d7d275c0846f77 | |
parent | 81e6910be407e0d60476f13a1d12144d3525d512 (diff) | |
parent | 60cf1289d1d6ede961898d54e8c98a3bbb41762c (diff) | |
download | vndk-dee6da57131339c91158bf72d973366d5eb27ed5.tar.gz |
Merge "Add odm to library paths in vts-vndk"
-rw-r--r-- | abi/VtsVndkAbiTest.py | 12 | ||||
-rw-r--r-- | dependency/VtsVndkDependencyTest.py | 96 | ||||
-rw-r--r-- | open_libraries/VtsVndkOpenLibrariesTest.py | 3 |
3 files changed, 46 insertions, 65 deletions
diff --git a/abi/VtsVndkAbiTest.py b/abi/VtsVndkAbiTest.py index 77c78cc..bc1b975 100644 --- a/abi/VtsVndkAbiTest.py +++ b/abi/VtsVndkAbiTest.py @@ -61,6 +61,8 @@ class VtsVndkAbiTest(base_test.BaseTestClass): _vndk_version: String, the VNDK version supported by the device. data_file_path: The path to VTS data directory. """ + _ODM_LIB_DIR_32 = "/odm/lib" + _ODM_LIB_DIR_64 = "/odm/lib64" _VENDOR_LIB_DIR_32 = "/vendor/lib" _VENDOR_LIB_DIR_64 = "/vendor/lib64" _SYSTEM_LIB_DIR_32 = "/system/lib" @@ -259,11 +261,17 @@ class VtsVndkAbiTest(base_test.BaseTestClass): self._vndk_version, primary_abi, self.abi_bitness)) logging.info("dump dir: %s", dump_dir) + odm_lib_dir = os.path.join( + self._temp_dir, "odm_lib_dir_" + self.abi_bitness) vendor_lib_dir = os.path.join( self._temp_dir, "vendor_lib_dir_" + self.abi_bitness) system_lib_dir = os.path.join( self._temp_dir, "system_lib_dir_" + self.abi_bitness) - logging.info("host lib dir: %s %s", vendor_lib_dir, system_lib_dir) + logging.info("host lib dir: %s %s %s", + odm_lib_dir, vendor_lib_dir, system_lib_dir) + self._PullOrCreateDir( + getattr(self, "_ODM_LIB_DIR_" + self.abi_bitness), + odm_lib_dir) self._PullOrCreateDir( getattr(self, "_VENDOR_LIB_DIR_" + self.abi_bitness), vendor_lib_dir) @@ -272,7 +280,7 @@ class VtsVndkAbiTest(base_test.BaseTestClass): system_lib_dir) error_count = self._ScanLibDirs( - dump_dir, [vendor_lib_dir, system_lib_dir], dump_version) + dump_dir, [odm_lib_dir, vendor_lib_dir, system_lib_dir], dump_version) asserts.assertEqual(error_count, 0, "Total number of errors: " + str(error_count)) diff --git a/dependency/VtsVndkDependencyTest.py b/dependency/VtsVndkDependencyTest.py index 7b9c6b6..6e2fb6c 100644 --- a/dependency/VtsVndkDependencyTest.py +++ b/dependency/VtsVndkDependencyTest.py @@ -40,8 +40,8 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): Attributes: data_file_path: The path to VTS data directory. _dut: The AndroidDevice under test. - _temp_dir: The temporary directory to which the vendor partition is - copied. + _temp_dir: The temporary directory to which the odm and vendor + partitions are copied. _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 @@ -54,28 +54,20 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): /system/lib[64]/vndk-sp-${VER}. _vndk_sp_indirect: Set of strings. The names of VNDK-SP-Indirect libraries in /system/lib[64]/vndk-sp-${VER}. - _SP_HAL_LINK_PATHS_32: 32-bit same-process HAL's link paths in - /vendor/lib. - _SP_HAL_LINK_PATHS_64: 64-bit same-process HAL's link paths in - /vendor/lib64. - _VENDOR_LINK_PATHS_32: 32-bit vendor processes' link paths in - /vendor/lib. - _VENDOR_LINK_PATHS_64: 64-bit vendor processes' link paths in - /vendor/lib64. + _SP_HAL_LINK_PATHS: Format strings of same-process HAL's link paths. + _VENDOR_LINK_PATHS: Format strings of vendor processes' link paths. """ + _TARGET_ROOT_DIR = "/" + _TARGET_ODM_DIR = "/odm" _TARGET_VENDOR_DIR = "/vendor" - _SP_HAL_LINK_PATHS_32 = [ - "/vendor/lib/egl", "/vendor/lib/hw", "/vendor/lib" + _SP_HAL_LINK_PATHS = [ + "/odm/{LIB}/egl", "/odm/{LIB}/hw", "/odm/{LIB}", + "/vendor/{LIB}/egl", "/vendor/{LIB}/hw", "/vendor/{LIB}" ] - _SP_HAL_LINK_PATHS_64 = [ - "/vendor/lib64/egl", "/vendor/lib64/hw", "/vendor/lib64" - ] - _VENDOR_LINK_PATHS_32 = [ - "/vendor/lib/hw", "/vendor/lib/egl", "/vendor/lib" - ] - _VENDOR_LINK_PATHS_64 = [ - "/vendor/lib64/hw", "/vendor/lib64/egl", "/vendor/lib64" + _VENDOR_LINK_PATHS = [ + "/odm/{LIB}/hw", "/odm/{LIB}/egl", "/odm/{LIB}", + "/vendor/{LIB}/hw", "/vendor/{LIB}/egl", "/vendor/{LIB}" ] class ElfObject(object): @@ -102,10 +94,12 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): self.getUserParams(required_params) self._dut = self.android_devices[0] self._temp_dir = tempfile.mkdtemp() - logging.info("adb pull %s %s", self._TARGET_VENDOR_DIR, self._temp_dir) - pull_output = self._dut.adb.pull(self._TARGET_VENDOR_DIR, - self._temp_dir) - logging.debug(pull_output) + for target_dir in (self._TARGET_ODM_DIR, self._TARGET_VENDOR_DIR): + if target_file_utils.IsDirectory(target_dir, self._dut.shell): + logging.info("adb pull %s %s", target_dir, self._temp_dir) + self._dut.adb.pull(target_dir, self._temp_dir) + else: + logging.info("Skip adb pull %s", target_dir) vndk_lists = vndk_data.LoadVndkLibraryLists( self.data_file_path, @@ -182,28 +176,6 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): objs.append(self.ElfObject(target_path, elf.bitness, deps)) return objs - def _GetVendorLinkPaths(self, bitness): - """Returns 32/64-bit vendor processes' link paths. - - Args: - bitness: 32 or 64, the bitness of the link paths.. - - Returns: - A list of strings, the vendor processes' link paths. - """ - return getattr(self, "_VENDOR_LINK_PATHS_" + str(bitness)) - - def _GetSpHalLinkPaths(self, bitness): - """Returns 32/64-bit same-process HAL link paths. - - Args: - bitness: 32 or 64, the bitness of the link paths. - - Returns: - A list of strings, the same-process HAL link paths. - """ - return getattr(self, "_SP_HAL_LINK_PATHS_" + str(bitness)) - def _DfsDependencies(self, lib, searched, searchable): """Depth-first-search for library dependencies. @@ -225,15 +197,16 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): Args: bitness: 32 or 64, the bitness of the returned libraries. - objs: List of ElfObject, the libraries/executables on vendor - partition. + objs: List of ElfObject, the libraries/executables in odm and + vendor partitions. Returns: Set of ElfObject, the same-process HAL libraries and their dependencies. """ # Map file names to libraries which can be linked to same-process HAL - sp_hal_link_paths = self._GetSpHalLinkPaths(bitness) + sp_hal_link_paths = [vndk_utils.FormatVndkPath(x, bitness) for + x in self._SP_HAL_LINK_PATHS] vendor_libs = [obj for obj in objs if obj.bitness == bitness and obj.target_dir in sp_hal_link_paths] @@ -285,9 +258,9 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): - Other libraries in vendor link paths. Args: - vendor_objs: Collection of ElfObject, the libraries/executables on - vendor partition, excluding VNDK-SP extension and - SP-HAL. + vendor_objs: Collection of ElfObject, the libraries/executables in + odm and vendor partitions, excluding VNDK-SP extension + and SP-HAL. vendor_libs: Set of ElfObject, the libraries in vendor link paths, including SP-HAL. @@ -316,7 +289,7 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): Args: vndk_sp_ext_libs: Collection of ElfObject, the VNDK-SP extension - libraries on vendor partition. + libraries. Returns: List of tuples (path, disallowed_dependencies). @@ -356,19 +329,20 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): Args: bitness: 32 or 64, the bitness of the vendor libraries. - objs: List of ElfObject. The libraries/executables on vendor - partition. + objs: List of ElfObject. The libraries/executables in odm and + vendor partitions. Returns: List of tuples (path, disallowed_dependencies). """ - vndk_sp_ext_dir = vndk_utils.GetVndkSpExtDirectory(bitness) - vendor_link_paths = self._GetVendorLinkPaths(bitness) + vndk_sp_ext_dirs = vndk_utils.GetVndkSpExtDirectories(bitness) + vendor_link_paths = [vndk_utils.FormatVndkPath(x, bitness) for + x in self._VENDOR_LINK_PATHS] vendor_libs = set(obj for obj in objs if obj.bitness == bitness and obj.target_dir in vendor_link_paths) - logging.info("%d-bit vendor libraries including SP-HAL: %s", + logging.info("%d-bit odm and vendor libraries including SP-HAL: %s", bitness, ", ".join(x.name for x in vendor_libs)) sp_hal_libs = self._FindSpHalLibs(bitness, objs) @@ -377,7 +351,7 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): vndk_sp_ext_libs = set(obj for obj in objs if obj.bitness == bitness and - obj.target_dir == vndk_sp_ext_dir) + obj.target_dir in vndk_sp_ext_dirs) logging.info("%d-bit VNDK-SP extension libraries: %s", bitness, ", ".join(x.name for x in vndk_sp_ext_libs)) @@ -401,9 +375,7 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): read_errors = [] abi_list = self._dut.getCpuAbiList() objs = self._LoadElfObjects( - self._temp_dir, - path_utils.TargetDirName(self._TARGET_VENDOR_DIR), - abi_list, + self._temp_dir, self._TARGET_ROOT_DIR, abi_list, lambda p, e: read_errors.append((p, str(e)))) dep_errors = self._TestElfDependency(32, objs) diff --git a/open_libraries/VtsVndkOpenLibrariesTest.py b/open_libraries/VtsVndkOpenLibrariesTest.py index 39404f7..d85a84d 100644 --- a/open_libraries/VtsVndkOpenLibrariesTest.py +++ b/open_libraries/VtsVndkOpenLibrariesTest.py @@ -119,7 +119,8 @@ class VtsVndkOpenLibrariesTest(base_test.BaseTestClass): asserts.assertTrue(self._dut.isAdbRoot, "Must be root to find all libraries in use.") - cmds = self._ListProcessCommands(lambda x: x.startswith("/vendor/")) + cmds = self._ListProcessCommands(lambda x: (x.startswith("/odm/") or + x.startswith("/vendor/"))) deps = self._ListOpenFiles(cmds.keys(), lambda x: (x.startswith("/system/") and x.endswith(".so") and |