summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-05-13 14:18:53 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-05-13 14:18:53 -0700
commitf2b2e38ecca7ebe31359dd7cbbfb9e8c4d836edd (patch)
treea56595465781fbd1c837eef607eb483fdfdbdeee
parenta859c0849f4279203497306a835aa11d9607fbcb (diff)
parent3372bd357079ce667ad80f482bc552003047c78b (diff)
downloadvndk-pie-cuttlefish-testing.tar.gz
Snap for 5450365 from a5db0f348e91c327b70bc53e2b5a0d86694dc317 to pi-platform-releasepie-cuttlefish-testing
am: 3372bd3570 Change-Id: I62d073907b178fd5160cdfa42d567cc629619f94
-rw-r--r--dependency/AndroidTest.xml1
-rw-r--r--dependency/VtsVndkDependencyTest.py43
2 files changed, 40 insertions, 4 deletions
diff --git a/dependency/AndroidTest.xml b/dependency/AndroidTest.xml
index 4f2176b..70c3138 100644
--- a/dependency/AndroidTest.xml
+++ b/dependency/AndroidTest.xml
@@ -21,6 +21,7 @@
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
<option name="test-module-name" value="VtsVndkDependency" />
<option name="test-case-path" value="vts/testcases/vndk/dependency/VtsVndkDependencyTest" />
+ <option name="test-timeout" value="6m" />
</test>
</configuration>
diff --git a/dependency/VtsVndkDependencyTest.py b/dependency/VtsVndkDependencyTest.py
index 76c6244..094d84a 100644
--- a/dependency/VtsVndkDependencyTest.py
+++ b/dependency/VtsVndkDependencyTest.py
@@ -65,6 +65,9 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
"/odm/{LIB}/hw", "/odm/{LIB}/egl", "/odm/{LIB}",
"/vendor/{LIB}/hw", "/vendor/{LIB}/egl", "/vendor/{LIB}"
]
+ _DEFAULT_PROGRAM_INTERPRETERS = [
+ "/system/bin/linker", "/system/bin/linker64"
+ ]
class ElfObject(object):
"""Contains dependencies of an ELF file on target device.
@@ -124,6 +127,40 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
logging.info("Delete %s", self._temp_dir)
shutil.rmtree(self._temp_dir)
+ def _IsElfObjectForAp(self, elf, target_path, abi_list):
+ """Checks whether an ELF object is for application processor.
+
+ Args:
+ elf: The object of elf_parser.ElfParser.
+ target_path: The path to the ELF file on target.
+ abi_list: A list of strings, the ABIs of the application processor.
+
+ Returns:
+ A boolean, whether the ELF object is for application processor.
+ """
+ if not any(elf.MatchCpuAbi(x) for x in abi_list):
+ logging.debug("%s does not match the ABI", target_path)
+ return False
+
+ # b/115567177 Skip an ELF file if it meets the following 3 conditions:
+ # The ELF type is executable.
+ if not elf.IsExecutable():
+ return True
+
+ # It requires special program interpreter.
+ interp = elf.GetProgramInterpreter()
+ if not interp or interp in self._DEFAULT_PROGRAM_INTERPRETERS:
+ return True
+
+ # It does not have execute permission in the file system.
+ permissions = target_file_utils.GetPermission(target_path,
+ self._dut.shell)
+ if target_file_utils.IsExecutable(permissions):
+ return True
+
+ logging.debug("%s is not for application processor", target_path)
+ return False
+
def _LoadElfObjects(self, host_dir, target_dir, abi_list,
elf_error_handler):
"""Scans a host directory recursively and loads all ELF files in it.
@@ -150,11 +187,9 @@ class VtsVndkDependencyTest(base_test.BaseTestClass):
except elf_parser.ElfError:
logging.debug("%s is not an ELF file", target_path)
continue
- if not any(elf.MatchCpuAbi(x) for x in abi_list):
- logging.debug("%s does not match the ABI", target_path)
- elf.Close()
- continue
try:
+ if not self._IsElfObjectForAp(elf, target_path, abi_list):
+ continue
deps = elf.ListDependencies()
except elf_parser.ElfError as e:
elf_error_handler(target_path, e)