diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-28 20:26:17 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-28 20:26:17 +0000 |
commit | 2b6f33d0e7f69d12bdccc3c4e1886655c1098046 (patch) | |
tree | ef87935750407065628323128870e53fb33c8e2a | |
parent | ebef45589fb5156d741d80aec6ab041b6729c7da (diff) | |
parent | f54333933db666b7847800bacc326a50ede303a4 (diff) | |
download | vndk-android-mainline-10.0.0_r11.tar.gz |
Snap for 6439596 from f54333933db666b7847800bacc326a50ede303a4 to qt-aml-tzdata-releaseandroid-mainline-10.0.0_r11
Change-Id: Id96b8924b8fc670257fcff6eef652bbc32125a4a
-rw-r--r-- | abi/VtsVndkAbiTest.py | 27 | ||||
-rw-r--r-- | dependency/VtsVndkDependencyTest.py | 24 | ||||
-rw-r--r-- | files/VtsVndkFilesTest.py | 37 | ||||
-rw-r--r-- | open_libraries/VtsVndkOpenLibrariesTest.py | 12 |
4 files changed, 40 insertions, 60 deletions
diff --git a/abi/VtsVndkAbiTest.py b/abi/VtsVndkAbiTest.py index 554dd14..89d12e2 100644 --- a/abi/VtsVndkAbiTest.py +++ b/abi/VtsVndkAbiTest.py @@ -240,9 +240,9 @@ class VtsVndkAbiTest(base_test.BaseTestClass): with the dump directories of the given version. Returns: - A list of strings, the incompatible libraries. + An integer, number of incompatible libraries. """ - error_list = [] + error_count = 0 dump_paths = dict() lib_paths = dict() for parent_dir, dump_name in utils.iterate_files(dump_dir): @@ -292,16 +292,16 @@ class VtsVndkAbiTest(base_test.BaseTestClass): rel_path, "\n".join(" ".join(e) for e in vtable_diff)) if (has_exception or missing_symbols or vtable_diff): - error_list.append(rel_path) + error_count += 1 else: logging.info("%s: Pass", rel_path) - return error_list + return error_count @staticmethod def _GetLinkerSearchIndex(target_path): """Returns the key for sorting linker search paths.""" index = 0 - for prefix in ("/odm", "/vendor", "/apex"): + for prefix in ("/odm", "/vendor", "/system"): if target_path.startswith(prefix): return index index += 1 @@ -330,23 +330,22 @@ class VtsVndkAbiTest(base_test.BaseTestClass): self._vndk_version, primary_abi, self.abi_bitness)) logging.info("dump dir: %s", dump_dir) + target_vndk_dir = vndk_utils.GetVndkCoreDirectory(self.abi_bitness, + self._vndk_version) + target_vndk_sp_dir = vndk_utils.GetVndkSpDirectory(self.abi_bitness, + self._vndk_version) target_dirs = vndk_utils.GetVndkExtDirectories(self.abi_bitness) target_dirs += vndk_utils.GetVndkSpExtDirectories(self.abi_bitness) - target_dirs += [vndk_utils.GetVndkDirectory(self.abi_bitness, - self._vndk_version)] + target_dirs += [target_vndk_dir, target_vndk_sp_dir] target_dirs.sort(key=self._GetLinkerSearchIndex) host_dirs = [self._ToHostPath(x) for x in target_dirs] for target_dir, host_dir in zip(target_dirs, host_dirs): self._PullOrCreateDir(target_dir, host_dir) - assert_lines = self._ScanLibDirs(dump_dir, host_dirs, dump_version) - if assert_lines: - error_count = len(assert_lines) - if error_count > 20: - assert_lines = assert_lines[:20] + ["..."] - assert_lines.append("Total number of errors: " + str(error_count)) - asserts.fail("\n".join(assert_lines)) + error_count = self._ScanLibDirs(dump_dir, host_dirs, dump_version) + asserts.assertEqual(error_count, 0, + "Total number of errors: " + str(error_count)) if __name__ == "__main__": diff --git a/dependency/VtsVndkDependencyTest.py b/dependency/VtsVndkDependencyTest.py index 0ad79e7..0302220 100644 --- a/dependency/VtsVndkDependencyTest.py +++ b/dependency/VtsVndkDependencyTest.py @@ -46,8 +46,10 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): /system/lib[64]. _sp_hal: List of patterns. The names of the same-process HAL libraries expected to be in /vendor/lib[64]. - _vndk: Set of strings. The names of VNDK-core libraries. - _vndk_sp: Set of strings. The names of VNDK-SP libraries. + _vndk: Set of strings. The names of VNDK core libraries in + /system/lib[64]/vndk-${VER}. + _vndk_sp: Set of strings. The names of VNDK-SP libraries in + /system/lib[64]/vndk-sp-${VER}. _SP_HAL_LINK_PATHS: Format strings of same-process HAL's link paths. _VENDOR_LINK_PATHS: Format strings of vendor processes' link paths. """ @@ -449,26 +451,18 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): if self._dut.is64Bit: dep_errors.extend(self._TestElfDependency(64, objs)) - assert_lines = [] if read_errors: - error_lines = ["%s: %s" % (x[0], x[1]) for x in read_errors] + error_lines = ("%s: %s" % (x[0], x[1]) for x in read_errors) logging.error("%d read errors:\n%s", len(read_errors), "\n".join(error_lines)) - assert_lines.extend(error_lines[:20]) - if dep_errors: - error_lines = ["%s: %s" % (x[0], ", ".join(x[1])) - for x in dep_errors] + error_lines = ("%s: %s" % (x[0], ", ".join(x[1])) + for x in dep_errors) logging.error("%d disallowed dependencies:\n%s", len(dep_errors), "\n".join(error_lines)) - assert_lines.extend(error_lines[:20]) - error_count = len(read_errors) + len(dep_errors) - if error_count: - if error_count > len(assert_lines): - assert_lines.append("...") - assert_lines.append("Total number of errors: " + str(error_count)) - asserts.fail("\n".join(assert_lines)) + asserts.assertEqual(error_count, 0, + "Total number of errors: " + str(error_count)) if __name__ == "__main__": diff --git a/files/VtsVndkFilesTest.py b/files/VtsVndkFilesTest.py index 93411ad..d88cd8a 100644 --- a/files/VtsVndkFilesTest.py +++ b/files/VtsVndkFilesTest.py @@ -68,22 +68,6 @@ class VtsVndkFilesTest(base_test.BaseTestClass): return target_file_utils.FindFiles(self._shell, dir_path, "*", "! -type d") - @staticmethod - def _Fail(unexpected_paths): - """Logs error and fails current test. - - Args: - unexpected_paths: A list of strings, the paths to be shown in the - log message. - """ - logging.error("Unexpected files:\n%s", "\n".join(unexpected_paths)) - assert_lines = unexpected_paths[:20] - if len(unexpected_paths) > 20: - assert_lines.append("...") - assert_lines.append( - "Total number of errors: %d" % len(unexpected_paths)) - asserts.fail("\n".join(assert_lines)) - def _TestVndkDirectory(self, vndk_dir, vndk_list_names): """Verifies that the VNDK directory doesn't contain extra files. @@ -100,7 +84,8 @@ class VtsVndkFilesTest(base_test.BaseTestClass): unexpected = [x for x in self._ListFiles(vndk_dir) if path_utils.TargetBaseName(x) not in vndk_set] if unexpected: - self._Fail(unexpected) + 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. @@ -121,16 +106,24 @@ class VtsVndkFilesTest(base_test.BaseTestClass): unexpected = [x for x in self._ListFiles(vndk_dir) if path_utils.TargetBaseName(x) in vndk_set] if unexpected: - self._Fail(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 directory doesn't contain extra files.""" + """Verifies that VNDK-core directory doesn't contain extra files.""" asserts.skipIf(not vndk_utils.IsVndkRuntimeEnforced(self._dut), "VNDK runtime is not enforced on the device.") self._TestVndkDirectory( - vndk_utils.GetVndkDirectory(self.abi_bitness, self._vndk_version), - (vndk_data.VNDK, vndk_data.VNDK_PRIVATE, vndk_data.VNDK_SP, - vndk_data.VNDK_SP_PRIVATE,)) + vndk_utils.GetVndkCoreDirectory( + self.abi_bitness, self._vndk_version), + (vndk_data.VNDK, vndk_data.VNDK_PRIVATE,)) + + def testVndkSpDirectory(self): + """Verifies that VNDK-SP directory doesn't contain extra files.""" + self._TestVndkDirectory( + vndk_utils.GetVndkSpDirectory( + self.abi_bitness, self._vndk_version), + (vndk_data.VNDK_SP, vndk_data.VNDK_SP_PRIVATE,)) def testNoLlndkInVendor(self): """Verifies that vendor partition has no LL-NDK libraries.""" diff --git a/open_libraries/VtsVndkOpenLibrariesTest.py b/open_libraries/VtsVndkOpenLibrariesTest.py index a6b066d..8dbfda6 100644 --- a/open_libraries/VtsVndkOpenLibrariesTest.py +++ b/open_libraries/VtsVndkOpenLibrariesTest.py @@ -120,8 +120,7 @@ class VtsVndkOpenLibrariesTest(base_test.BaseTestClass): x.startswith("/vendor/"))) def _IsDisallowedSystemLib(lib_path): - return ((lib_path.startswith("/system/") or - lib_path.startswith("/apex/")) and + return (lib_path.startswith("/system/") and lib_path.endswith(".so") and path_utils.TargetBaseName(lib_path) not in allowed_libs) @@ -130,13 +129,8 @@ class VtsVndkOpenLibrariesTest(base_test.BaseTestClass): error_lines = ["%s %s %s" % (pid, cmds[pid], libs) for pid, libs in deps.iteritems()] logging.error("pid command libraries\n%s", "\n".join(error_lines)) - - assert_lines = ["pid command libraries"] + error_lines[:20] - if len(deps) > 20: - assert_lines.append("...") - assert_lines.append("Number of vendor processes using system " - "libraries: " + str(len(deps))) - asserts.fail("\n".join(assert_lines)) + asserts.fail("Number of vendor processes using system libraries: " + + str(len(deps))) if __name__ == "__main__": |