diff options
-rw-r--r-- | abi/VtsVndkAbiTest.py | 12 | ||||
-rw-r--r-- | dependency/VtsVndkDependencyTest.py | 96 | ||||
-rw-r--r-- | files/VtsVndkFilesTest.py | 51 | ||||
-rw-r--r-- | hidl/bufferpool/V1_0/target/Android.mk | 23 | ||||
-rw-r--r-- | hidl/bufferpool/V1_0/target/AndroidTest.xml | 32 | ||||
-rw-r--r-- | open_libraries/VtsVndkOpenLibrariesTest.py | 3 |
6 files changed, 152 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/files/VtsVndkFilesTest.py b/files/VtsVndkFilesTest.py index ab2c8d5..1ed1c7f 100644 --- a/files/VtsVndkFilesTest.py +++ b/files/VtsVndkFilesTest.py @@ -23,6 +23,7 @@ from vts.runners.host import keys from vts.runners.host import test_runner from vts.testcases.vndk.golden import vndk_data from vts.utils.python.file import target_file_utils +from vts.utils.python.os import path_utils from vts.utils.python.vndk import vndk_utils @@ -35,6 +36,14 @@ class VtsVndkFilesTest(base_test.BaseTestClass): _shell: The ShellMirrorObject that executes commands. _vndk_version: The VNDK version of the device. """ + # Some LL-NDK libraries may load the implementations with the same names + # from /vendor/lib. Since a vendor may install an implementation of an + # LL-NDK library with the same name, testNoLlndkInVendor doesn't raise + # errors on these LL-NDK libraries. + _LL_NDK_COLLIDING_NAMES = ("libEGL.so", "libGLESv1_CM.so", "libGLESv2.so", + "libGLESv3.so") + _TARGET_ODM_LIB = "/odm/{LIB}" + _TARGET_VENDOR_LIB = "/vendor/{LIB}" def setUpClass(self): """Initializes the data file path and shell.""" @@ -53,6 +62,9 @@ class VtsVndkFilesTest(base_test.BaseTestClass): Returns: A list of strings, the file paths in the directory. """ + if not target_file_utils.Exists(dir_path, self._shell): + logging.info("%s not found", dir_path) + return [] return target_file_utils.FindFiles(self._shell, dir_path, "*", "! -type d") @@ -74,6 +86,30 @@ class VtsVndkFilesTest(base_test.BaseTestClass): logging.error("Unexpected files:\n%s", "\n".join(unexpected)) asserts.fail("Total number of errors: %d" % len(unexpected)) + def _TestNotInVndkDirecotory(self, vndk_dir, vndk_list_names, except_libs): + """Verifies that VNDK directory doesn't contain specific files. + + Args: + vndk_dir, The path to the VNDK directory on device. + vndk_list_names: A list of strings, the categories of the VNDK + libraries that should not be in the directory. + except_libs: A set of strings, the file names of the libraries that + are exceptions to this test. + """ + vndk_lists = vndk_data.LoadVndkLibraryLists( + self.data_file_path, self._vndk_version, *vndk_list_names) + asserts.assertTrue(vndk_lists, "Cannot load VNDK library lists.") + vndk_set = set() + for vndk_list in vndk_lists: + vndk_set.update(path_utils.TargetBaseName(x) for x in vndk_list) + vndk_set.difference_update(except_libs) + logging.debug("vndk set: %s", vndk_set) + unexpected = [x for x in self._ListFiles(vndk_dir) if + path_utils.TargetBaseName(x) in vndk_set] + if unexpected: + logging.error("Unexpected files:\n%s", "\n".join(unexpected)) + asserts.fail("Total number of errors: %d" % len(unexpected)) + def testVndkCoreDirectory(self): """Verifies that VNDK-core directory doesn't contain extra files.""" asserts.skipIf(not vndk_utils.IsVndkRuntimeEnforced(self._dut), @@ -92,6 +128,21 @@ class VtsVndkFilesTest(base_test.BaseTestClass): vndk_data.VNDK_SP_INDIRECT, vndk_data.VNDK_SP_INDIRECT_PRIVATE) + def testNoLlndkInVendor(self): + """Verifies that vendor partition has no LL-NDK libraries.""" + self._TestNotInVndkDirecotory( + vndk_utils.FormatVndkPath( + self._TARGET_VENDOR_LIB, self.abi_bitness), + (vndk_data.LL_NDK,), + self._LL_NDK_COLLIDING_NAMES) + + def testNoLlndkInOdm(self): + """Verifies that odm partition has no LL-NDK libraries.""" + self._TestNotInVndkDirecotory( + vndk_utils.FormatVndkPath(self._TARGET_ODM_LIB, self.abi_bitness), + (vndk_data.LL_NDK,), + self._LL_NDK_COLLIDING_NAMES) + if __name__ == "__main__": test_runner.main() diff --git a/hidl/bufferpool/V1_0/target/Android.mk b/hidl/bufferpool/V1_0/target/Android.mk new file mode 100644 index 0000000..89dd65d --- /dev/null +++ b/hidl/bufferpool/V1_0/target/Android.mk @@ -0,0 +1,23 @@ +# +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := VtsVndkHidlBufferpoolV1_0Target +VTS_CONFIG_SRC_DIR := testcases/vndk/hidl/bufferpool/V1_0/target +include test/vts/tools/build/Android.host_config.mk diff --git a/hidl/bufferpool/V1_0/target/AndroidTest.xml b/hidl/bufferpool/V1_0/target/AndroidTest.xml new file mode 100644 index 0000000..a4d2398 --- /dev/null +++ b/hidl/bufferpool/V1_0/target/AndroidTest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2018 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Config for VTS VtsVndkHidlBufferpoolV1_0Target test cases"> + <option name="config-descriptor:metadata" key="plan" value="vts-vndk" /> + <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher"> + <option name="abort-on-push-failure" value="false"/> + <option name="push-group" value="HostDrivenTest.push"/> + </target_preparer> + <multi_target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" /> + <test class="com.android.tradefed.testtype.VtsMultiDeviceTest"> + <option name="test-module-name" value="VtsVndkHidlBufferpoolV1_0Target"/> + <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsVndkHidlBufferpoolV1_0TargetSingleTest/VtsVndkHidlBufferpoolV1_0TargetSingleTest"/> + <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsVndkHidlBufferpoolV1_0TargetSingleTest/VtsVndkHidlBufferpoolV1_0TargetSingleTest"/> + <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsVndkHidlBufferpoolV1_0TargetMultiTest/VtsVndkHidlBufferpoolV1_0TargetMultiTest"/> + <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsVndkHidlBufferpoolV1_0TargetMultiTest/VtsVndkHidlBufferpoolV1_0TargetMultiTest"/> + <option name="binary-test-type" value="gtest_binary_test"/> + <option name="test-timeout" value="1m"/> + </test> +</configuration> 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 |