1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-22 02:29:10 +00:00

ApkWorkload: ensure that the APK is always replaced and that a downgrade is allowed.

This commit is contained in:
Sergei Trofimov 2016-10-10 13:15:24 +01:00
parent 93fbb7282a
commit 10dd2b304e

View File

@ -252,7 +252,7 @@ class ApkWorkload(Workload):
except ResourceError as e: except ResourceError as e:
msg = "force_install is 'True' but the host version is invalid:\n\t{}" msg = "force_install is 'True' but the host version is invalid:\n\t{}"
raise ResourceError(msg.format(str(e))) raise ResourceError(msg.format(str(e)))
self.install_apk(context, replace=(target_version is not None)) self.install_apk(context, replace=True)
def prefer_host_apk(self, context, host_version, target_version): def prefer_host_apk(self, context, host_version, target_version):
msg = "check_apk is 'True' " msg = "check_apk is 'True' "
@ -288,7 +288,7 @@ class ApkWorkload(Workload):
return return
msg += " and the host version is not on the target, installing APK" msg += " and the host version is not on the target, installing APK"
self.logger.debug(msg) self.logger.debug(msg)
self.install_apk(context, replace=(target_version is not None)) self.install_apk(context, replace=True)
def prefer_target_apk(self, context, host_version, target_version): def prefer_target_apk(self, context, host_version, target_version):
msg = "check_apk is 'False' " msg = "check_apk is 'False' "
@ -370,7 +370,8 @@ class ApkWorkload(Workload):
success = False success = False
if replace: if replace:
self.device.uninstall(self.package) self.device.uninstall(self.package)
output = self.device.install(self.apk_file, self.install_timeout) output = self.device.install_apk(self.apk_file, timeout=self.install_timeout,
replace=replace, allow_downgrade=True)
if 'Failure' in output: if 'Failure' in output:
if 'ALREADY_EXISTS' in output: if 'ALREADY_EXISTS' in output:
self.logger.warn('Using already installed APK (did not unistall properly?)') self.logger.warn('Using already installed APK (did not unistall properly?)')