diff options
author | Hsin-Yi Chen <hsinyichen@google.com> | 2018-03-23 14:45:29 +0800 |
---|---|---|
committer | Hsin-Yi Chen <hsinyichen@google.com> | 2018-03-27 13:16:39 +0800 |
commit | 01ca20e4624d7cb3aaf93bdb2df755ba9b23001c (patch) | |
tree | 7b5c8396f5772cdfb75f34555ead798fb0be55f6 | |
parent | 992aff14e47b64fa384abc66f5c4834eb27a84d8 (diff) | |
download | vndk-01ca20e4624d7cb3aaf93bdb2df755ba9b23001c.tar.gz |
Load default VNDK version from file
If the device has no VNDK version, load the PLATFORM_VNDK_VERSION of the
VTS package from file and also load the test data of the version.
Test: run vts -m VtsVndkDependency
Bug: 76080475
Change-Id: Ic7b2b2ab659e3a220b6c1310f3e0afe8995cbeda
-rw-r--r-- | abi/VtsVndkAbiTest.py | 7 | ||||
-rw-r--r-- | golden/vndk_data.py | 45 |
2 files changed, 37 insertions, 15 deletions
diff --git a/abi/VtsVndkAbiTest.py b/abi/VtsVndkAbiTest.py index bc1b975..d277073 100644 --- a/abi/VtsVndkAbiTest.py +++ b/abi/VtsVndkAbiTest.py @@ -249,10 +249,13 @@ class VtsVndkAbiTest(base_test.BaseTestClass): """Checks ABI compliance of VNDK libraries.""" primary_abi = self._dut.getCpuAbiList()[0] dump_version = (self._vndk_version if self._vndk_version else - vndk_data.DEFAULT_VNDK_VERSION) + vndk_data.LoadDefaultVndkVersion(self.data_file_path)) + asserts.assertTrue(dump_version, + "Cannot load default VNDK version.") + dump_dir = vndk_data.GetAbiDumpDirectory( self.data_file_path, - self._vndk_version, + dump_version, primary_abi, self.abi_bitness) asserts.assertTrue( diff --git a/golden/vndk_data.py b/golden/vndk_data.py index 3ad4620..e177e0b 100644 --- a/golden/vndk_data.py +++ b/golden/vndk_data.py @@ -41,9 +41,6 @@ VNDK_SP = "VNDK-SP" # VNDK-SP dependencies that vendor modules cannot directly access. VNDK_SP_PRIVATE = "VNDK-SP-Private" -# The name of the data directory for devices with no VNDK version. -DEFAULT_VNDK_VERSION = "P" - # The ABI dump directories. 64-bit comes before 32-bit in order to sequentially # search for longest prefix. _ABI_NAMES = ("arm64", "arm", "mips64", "mips", "x86_64", "x86") @@ -52,6 +49,25 @@ _ABI_NAMES = ("arm64", "arm", "mips64", "mips", "x86_64", "x86") _GOLDEN_DIR = os.path.join("vts", "testcases", "vndk", "golden") +def LoadDefaultVndkVersion(data_file_path): + """Loads the name of the data directory for devices with no VNDK version. + + Args: + data_file_path: The path to VTS data directory. + + Returns: + A string, the directory name. + None if fails to load the name. + """ + try: + with open(os.path.join(data_file_path, _GOLDEN_DIR, + "platform_vndk_version.txt"), "r") as f: + return f.read().strip() + except IOError: + logging.error("Cannot load default VNDK version.") + return None + + def GetAbiDumpDirectory(data_file_path, version, abi_name, abi_bitness): """Returns the VNDK dump directory on host. @@ -71,12 +87,13 @@ def GetAbiDumpDirectory(data_file_path, version, abi_name, abi_bitness): logging.warning("Unknown ABI %s.", abi_name) return None - dump_dir = os.path.join( - data_file_path, - _GOLDEN_DIR, - version if version else DEFAULT_VNDK_VERSION, - abi_dir, - "lib64" if str(abi_bitness) == "64" else "lib") + version_dir = (version if version else + LoadDefaultVndkVersion(data_file_path)) + if not version_dir: + return None + + dump_dir = os.path.join(data_file_path, _GOLDEN_DIR, version_dir, abi_dir, + "lib64" if str(abi_bitness) == "64" else "lib") if not os.path.isdir(dump_dir): logging.warning("%s is not a directory.", dump_dir) @@ -99,11 +116,13 @@ def LoadVndkLibraryLists(data_file_path, version, *tags): expressions. None if the spreadsheet for the version is not found. """ + version_dir = (version if version else + LoadDefaultVndkVersion(data_file_path)) + if not version_dir: + return None + path = os.path.join( - data_file_path, - _GOLDEN_DIR, - version if version else DEFAULT_VNDK_VERSION, - "eligible-list.csv") + data_file_path, _GOLDEN_DIR, version_dir, "eligible-list.csv") if not os.path.isfile(path): logging.warning("Cannot load %s.", path) return None |