summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--abi/VtsVndkAbiTest.py12
-rw-r--r--dependency/VtsVndkDependencyTest.py96
-rwxr-xr-xgolden/dump_abi.py100
-rw-r--r--open_libraries/VtsVndkOpenLibrariesTest.py3
4 files changed, 91 insertions, 120 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/golden/dump_abi.py b/golden/dump_abi.py
index 1afeda0..d00ee0a 100755
--- a/golden/dump_abi.py
+++ b/golden/dump_abi.py
@@ -84,18 +84,22 @@ def _ExecuteCommand(cmd, **kwargs):
return stdout.strip()
-def GetBuildVariable(build_top_dir, var):
- """Gets value of a variable from build config.
+def GetBuildVariables(build_top_dir, abs_path, vars):
+ """Gets values of variables from build config.
Args:
build_top_dir: The path to root directory of Android source.
- var: The name of the variable.
+ abs_path: A boolean, whether to convert the values to absolute paths.
+ vars: A list of strings, the names of the variables.
Returns:
- A string which is the value of the variable.
+ A list of strings which are the values of the variables.
"""
- cmd = ["build/soong/soong_ui.bash", "--dumpvar-mode", var]
- return _ExecuteCommand(cmd, cwd=build_top_dir)
+ cmd = ["build/soong/soong_ui.bash", "--dumpvars-mode",
+ ("--abs-vars" if abs_path else "--vars"), " ".join(vars)]
+ stdout = _ExecuteCommand(cmd, cwd=build_top_dir)
+ print(stdout)
+ return [line.split("=", 1)[1].strip("'") for line in stdout.splitlines()]
def FindBinary(file_name):
@@ -189,25 +193,6 @@ def DumpVtables(lib_path, dump_path, dumper_dir, include_symbols):
return dump_string
-def GetSystemLibDirByArch(product_dir, arch_name):
- """Returns the directory containing libraries for specific architecture.
-
- Args:
- product_dir: The path to the product output directory in Android source.
- arch_name: The name of the CPU architecture.
-
- Returns:
- The path to the directory containing the libraries.
- """
- if arch_name in ("arm", "x86", "mips"):
- src_dir = os.path.join(product_dir, "system", "lib")
- elif arch_name in ("arm64", "x86_64", "mips64"):
- src_dir = os.path.join(product_dir, "system", "lib64")
- else:
- sys.exit("Unknown target arch " + str(target_arch))
- return src_dir
-
-
def _LoadLibraryNames(file_names):
"""Loads library names from files.
@@ -232,15 +217,14 @@ def _LoadLibraryNames(file_names):
return lib_names
-def DumpAbi(output_dir, lib_names, product_dir, object_dir, arch, dumper_dir):
+def DumpAbi(output_dir, lib_names, lib_dir, object_dir, dumper_dir):
"""Generates dump from libraries.
Args:
output_dir: The output directory of dump files.
lib_names: The names of the libraries to dump.
- product_dir: The path to the product output directory in Android source.
- object_dir: The path to directory containing intermediate objects.
- arch: A string representing the CPU architecture of the libraries.
+ lib_dir: The path to the directory containing the libraries to dump.
+ object_dir: The path to the directory containing intermediate objects.
dumper_dir: The path to the directory containing the vtable dumper
executable and library.
"""
@@ -252,8 +236,7 @@ def DumpAbi(output_dir, lib_names, product_dir, object_dir, arch, dumper_dir):
ar_name + ".a")
static_symbols.update(ar_parser.ListGlobalSymbols(ar_path))
- lib_dir = GetSystemLibDirByArch(product_dir, arch)
- dump_dir = os.path.join(output_dir, arch)
+ dump_dir = os.path.join(output_dir, os.path.basename(lib_dir))
for lib_name in lib_names:
lib_path = os.path.join(lib_dir, lib_name)
symbol_dump_path = os.path.join(dump_dir, lib_name + "_symbol.dump")
@@ -285,31 +268,33 @@ def main():
arg_parser.add_argument("--import-path", "-i", action="store",
help="the directory for VTS python modules. "
"Default value is $ANDROID_BUILD_TOP/test")
- arg_parser.add_argument("--output", "-o", action="store", required=True,
- help="output directory for ABI reference dump.")
+ arg_parser.add_argument("--output", "-o", action="store",
+ help="output directory for ABI reference dump. "
+ "Default value is PLATFORM_VNDK_VERSION.")
args = arg_parser.parse_args()
- # Get product directory
- product_dir = os.getenv("ANDROID_PRODUCT_OUT")
- if not product_dir:
- sys.exit("env var ANDROID_PRODUCT_OUT is not set")
- print("ANDROID_PRODUCT_OUT=" + product_dir)
-
# Get target architectures
build_top_dir = os.getenv("ANDROID_BUILD_TOP")
if not build_top_dir:
sys.exit("env var ANDROID_BUILD_TOP is not set")
- target_arch = GetBuildVariable(build_top_dir, "TARGET_ARCH")
- target_obj_dir = GetBuildVariable(build_top_dir, "TARGET_OUT_INTERMEDIATES")
- target_2nd_arch = GetBuildVariable(build_top_dir, "TARGET_2ND_ARCH")
- target_2nd_obj_dir = GetBuildVariable(build_top_dir,
- "2ND_TARGET_OUT_INTERMEDIATES")
- print("TARGET_ARCH=" + target_arch)
- print("TARGET_OUT_INTERMEDIATES=" + target_obj_dir)
- print("TARGET_2ND_ARCH=" + target_2nd_arch)
- print("2ND_TARGET_OUT_INTERMEDIATES=" + target_2nd_obj_dir)
- target_obj_dir = os.path.join(build_top_dir, target_obj_dir)
- target_2nd_obj_dir = os.path.join(build_top_dir, target_2nd_obj_dir)
+
+ (vndk_version,
+ target_arch,
+ target_2nd_arch) = GetBuildVariables(
+ build_top_dir, abs_path=False, vars=(
+ "PLATFORM_VNDK_VERSION",
+ "TARGET_ARCH",
+ "TARGET_2ND_ARCH"))
+
+ (target_lib_dir,
+ target_obj_dir,
+ target_2nd_lib_dir,
+ target_2nd_obj_dir) = GetBuildVariables(
+ build_top_dir, abs_path=True, vars=(
+ "TARGET_OUT_SHARED_LIBRARIES",
+ "TARGET_OUT_INTERMEDIATES",
+ "2ND_TARGET_OUT_SHARED_LIBRARIES",
+ "2ND_TARGET_OUT_INTERMEDIATES"))
# Import elf_parser and vtable_parser
ExternalModules.ImportParsers(args.import_path if args.import_path else
@@ -324,12 +309,17 @@ def main():
dumper_dir = os.path.dirname(os.path.dirname(dumper_path))
print("DUMPER_DIR=" + dumper_dir)
- lib_names = _LoadLibraryNames(args.file)
- DumpAbi(args.output, lib_names, product_dir, target_obj_dir, target_arch,
- dumper_dir)
+ output_dir = os.path.join((args.output if args.output else vndk_version),
+ target_arch)
+ print("OUTPUT_DIR=" + output_dir)
+
+ lib_names = [name.format(VNDK_VER="-" + vndk_version) for
+ name in _LoadLibraryNames(args.file)]
+
+ DumpAbi(output_dir, lib_names, target_lib_dir, target_obj_dir, dumper_dir)
if target_2nd_arch:
- DumpAbi(args.output, lib_names, product_dir, target_2nd_obj_dir,
- target_2nd_arch, dumper_dir)
+ DumpAbi(output_dir, lib_names, target_2nd_lib_dir, target_2nd_obj_dir,
+ dumper_dir)
if __name__ == "__main__":
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