diff options
author | Hsin-Yi Chen <hsinyichen@google.com> | 2019-06-20 23:43:48 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-06-20 23:43:48 -0700 |
commit | f54333933db666b7847800bacc326a50ede303a4 (patch) | |
tree | ef87935750407065628323128870e53fb33c8e2a | |
parent | 33ead3a0dd45030d135cfa2f005fc72ad5b8363c (diff) | |
parent | 3aa7c19c0ab25a462b2c1fbe8893d7025bf1a1ce (diff) | |
download | vndk-android10-mainline-media-release.tar.gz |
Do not test the ELF objects not built for Android am: ae9db0ecb2 am: 81182ebfb4android-mainline-10.0.0_r9android-mainline-10.0.0_r7android-mainline-10.0.0_r5android-mainline-10.0.0_r4android-mainline-10.0.0_r10android-10.0.0_r45android-10.0.0_r44android-10.0.0_r43android-10.0.0_r42android-10.0.0_r41android-10.0.0_r40android-10.0.0_r39android-10.0.0_r38android-10.0.0_r37android-10.0.0_r36android-10.0.0_r35android-10.0.0_r34android-10.0.0_r33android-10.0.0_r32android-10.0.0_r31android-10.0.0_r30android10-qpr3-s1-releaseandroid10-qpr3-releaseandroid10-qpr2-s4-releaseandroid10-qpr2-s3-releaseandroid10-qpr2-s2-releaseandroid10-qpr2-s1-releaseandroid10-qpr2-releaseandroid10-qpr1-mainline-releaseandroid10-mainline-media-releaseandroid10-d4-s1-releaseandroid10-d4-release
am: 3aa7c19c0a
Change-Id: Ifa76800cb02dc26c1464daafb4e23449b54984c6
-rw-r--r-- | dependency/VtsVndkDependencyTest.py | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/dependency/VtsVndkDependencyTest.py b/dependency/VtsVndkDependencyTest.py index 4878978..0302220 100644 --- a/dependency/VtsVndkDependencyTest.py +++ b/dependency/VtsVndkDependencyTest.py @@ -154,9 +154,48 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): if target_file_utils.IsExecutable(permissions): return True - logging.debug("%s is not for application processor", target_path) return False + def _IsElfObjectBuiltForAndroid(self, elf, target_path): + """Checks whether an ELF object is built for Android. + + Some ELF objects in vendor partition require special program + interpreters. Such executable files have .interp sections, but shared + libraries don't. As there is no reliable way to identify those + libraries. This method checks .note.android.ident section which is + created by Android build system. + + Args: + elf: The object of elf_parser.ElfParser. + target_path: The path to the ELF file on target. + + Returns: + A boolean, whether the ELF object is built for Android. + """ + # b/133399940 Skip an ELF file if it does not have .note.android.ident + # section and meets one of the following conditions: + if elf.HasAndroidIdent(): + return True + + # It's in the specific directory and is a shared library. + if (target_path.startswith("/vendor/arib/lib/") and + ".so" in target_path and + elf.IsSharedObject()): + return False + + # It's in the specific directory, requires special program interpreter, + # and is executable. + if target_path.startswith("/vendor/arib/bin/"): + interp = elf.GetProgramInterpreter() + if interp and interp not in self._DEFAULT_PROGRAM_INTERPRETERS: + permissions = target_file_utils.GetPermission(target_path, + self._dut.shell) + if (elf.IsExecutable() or + target_file_utils.IsExecutable(permissions)): + return False + + return True + def _LoadElfObjects(self, host_dir, target_dir, abi_list, elf_error_handler): """Scans a host directory recursively and loads all ELF files in it. @@ -185,7 +224,13 @@ class VtsVndkDependencyTest(base_test.BaseTestClass): continue try: if not self._IsElfObjectForAp(elf, target_path, abi_list): + logging.info("%s is not for application processor", + target_path) continue + if not self._IsElfObjectBuiltForAndroid(elf, target_path): + logging.info("%s is not built for Android", target_path) + continue + deps = elf.ListDependencies() except elf_parser.ElfError as e: elf_error_handler(target_path, e) |