summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--abi/vts_vndk_abi_test.py23
-rw-r--r--dependency/vts_vndk_dependency_test.py36
-rw-r--r--files/vts_vndk_files_test.py41
3 files changed, 56 insertions, 44 deletions
diff --git a/abi/vts_vndk_abi_test.py b/abi/vts_vndk_abi_test.py
index 85627a3..004eb48 100644
--- a/abi/vts_vndk_abi_test.py
+++ b/abi/vts_vndk_abi_test.py
@@ -307,6 +307,10 @@ class VtsVndkAbiTest(unittest.TestCase):
Args:
bitness: 32 or 64, the bitness of the tested libraries.
"""
+ if not self._dut.GetCpuAbiList(bitness):
+ logging.info("Skip the test as the device doesn't support %d-bit "
+ "ABI.", bitness)
+ return
self.assertTrue(self._dut.IsRoot(), "This test requires adb root.")
primary_abi = self._dut.GetCpuAbiList()[0]
binder_bitness = self._dut.GetBinderBitness()
@@ -314,14 +318,11 @@ class VtsVndkAbiTest(unittest.TestCase):
dump_version = self._dut.GetVndkVersion()
self.assertTrue(dump_version, "Cannot determine VNDK version.")
- # VNDK 35 will not be frozen.
- try:
- if int(dump_version) > 34:
- logging.info("Skip the test. version: %s ABI: %s bitness: %d",
- dump_version, primary_abi, bitness)
- return
- except ValueError:
- pass
+ if vndk_utils.IsVndkInstalledInVendor(self._dut):
+ logging.info("Skip the test as VNDK should be installed in vendor "
+ "partition. version: %s ABI: %s bitness: %d",
+ dump_version, primary_abi, bitness)
+ return
dump_paths = vndk_data.GetAbiDumpPathsFromResources(
dump_version,
@@ -360,11 +361,7 @@ class VtsVndkAbiTest(unittest.TestCase):
def testAbiCompatibility64(self):
"""Checks ABI compliance of 64-bit VNDK libraries."""
- if self._dut.GetCpuAbiList(64):
- self._TestAbiCompatibility(64)
- else:
- logging.info("Skip the test as the device doesn't support 64-bit "
- "ABI.")
+ self._TestAbiCompatibility(64)
if __name__ == "__main__":
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))
diff --git a/files/vts_vndk_files_test.py b/files/vts_vndk_files_test.py
index 99f8598..dce9de2 100644
--- a/files/vts_vndk_files_test.py
+++ b/files/vts_vndk_files_test.py
@@ -126,17 +126,18 @@ class VtsVndkFilesTest(unittest.TestCase):
def _TestVndkCoreDirectory(self, bitness):
"""Verifies that VNDK directory doesn't contain extra files."""
+ if not self._dut.GetCpuAbiList(bitness):
+ logging.info("Skip the test as the device doesn't support %d-bit "
+ "ABI.", bitness)
+ return
if not vndk_utils.IsVndkRuntimeEnforced(self._dut):
logging.info("Skip the test as VNDK runtime is not enforced on "
"the device.")
return
- try:
- if int(self._vndk_version) > 34:
- logging.info("Skip the test as VNDK %s should be installed in "
- "vendor partition.", self._vndk_version)
- return
- except ValueError:
- pass
+ if vndk_utils.IsVndkInstalledInVendor(self._dut):
+ logging.info("Skip the test as VNDK %s should be installed in "
+ "vendor partition.", self._vndk_version)
+ return
self._TestVndkDirectory(
vndk_utils.GetVndkDirectory(bitness, self._vndk_version),
(vndk_data.VNDK, vndk_data.VNDK_PRIVATE, vndk_data.VNDK_SP,
@@ -148,14 +149,14 @@ class VtsVndkFilesTest(unittest.TestCase):
def testVndkCoreDirectory64(self):
"""Runs _TestVndkCoreDirectory for 64-bit libraries."""
- if self._dut.GetCpuAbiList(64):
- self._TestVndkCoreDirectory(64)
- else:
- logging.info("Skip the test as the device doesn't support 64-bit "
- "ABI.")
+ self._TestVndkCoreDirectory(64)
def _TestNoLlndkInVendor(self, bitness):
"""Verifies that vendor partition has no LL-NDK libraries."""
+ if not self._dut.GetCpuAbiList(bitness):
+ logging.info("Skip the test as the device doesn't support %d-bit "
+ "ABI.", bitness)
+ return
self._TestNotInVndkDirecotory(
vndk_utils.FormatVndkPath(self._TARGET_VENDOR_LIB, bitness),
(vndk_data.LL_NDK,),
@@ -167,14 +168,14 @@ class VtsVndkFilesTest(unittest.TestCase):
def testNoLlndkInVendor64(self):
"""Runs _TestNoLlndkInVendor for 64-bit libraries."""
- if self._dut.GetCpuAbiList(64):
- self._TestNoLlndkInVendor(64)
- else:
- logging.info("Skip the test as the device doesn't support 64-bit "
- "ABI.")
+ self._TestNoLlndkInVendor(64)
def _TestNoLlndkInOdm(self, bitness):
"""Verifies that odm partition has no LL-NDK libraries."""
+ if not self._dut.GetCpuAbiList(bitness):
+ logging.info("Skip the test as the device doesn't support %d-bit "
+ "ABI.", bitness)
+ return
self._TestNotInVndkDirecotory(
vndk_utils.FormatVndkPath(self._TARGET_ODM_LIB, bitness),
(vndk_data.LL_NDK,),
@@ -186,11 +187,7 @@ class VtsVndkFilesTest(unittest.TestCase):
def testNoLlndkInOdm64(self):
"""Runs _TestNoLlndkInOdm for 64-bit libraries."""
- if self._dut.GetCpuAbiList(64):
- self._TestNoLlndkInOdm(64)
- else:
- logging.info("Skip the test as the device doesn't support 64-bit "
- "ABI.")
+ self._TestNoLlndkInOdm(64)
if __name__ == "__main__":