1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-05 18:31:12 +01:00

fw/workload: Prefix TestPackages with "test_"

Previously, when pulling an apk from the target to the host, the default
package name was used for both regular apks and test apks. This could
result in one overwriting the other. To prevent this ensure
`TestPackages` have the "test_" prefixed to their filename.
This commit is contained in:
Marc Bonnici 2020-02-03 13:57:03 +00:00
parent c6d23ab01f
commit 44cead2f76

View File

@ -904,16 +904,20 @@ class PackageHandler(object):
message = 'Cannot retrieve "{}" as not installed on Target'
raise WorkloadError(message.format(package))
package_info = self.target.get_package_info(package)
self.target.pull(package_info.apk_path, self.owner.dependencies_directory,
apk_name = self._get_package_name(package_info.apk_path)
host_path = os.path.join(self.owner.dependencies_directory, apk_name)
self.target.pull(package_info.apk_path, host_path,
timeout=self.install_timeout)
apk_name = self.target.path.basename(package_info.apk_path)
return os.path.join(self.owner.dependencies_directory, apk_name)
return host_path
def teardown(self):
self.target.execute('am force-stop {}'.format(self.apk_info.package))
if self.uninstall:
self.target.uninstall_package(self.apk_info.package)
def _get_package_name(self, apk_path):
return self.target.path.basename(apk_path)
def _get_package_error_msg(self, location):
if self.version:
msg = 'Multiple matches for "{version}" found on {location}.'
@ -981,6 +985,9 @@ class TestPackageHandler(PackageHandler):
self._instrument_output = self.target.execute(self.cmd)
self.logger.debug(self._instrument_output)
def _get_package_name(self, apk_path):
return 'test_{}'.format(self.target.path.basename(apk_path))
@property
def instrument_output(self):
if self.instrument_thread.is_alive():