1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

Added a script to check APK/Workload versions for inconsistencies

This commit is contained in:
Sebastian Goscik 2016-08-24 15:30:18 +01:00
parent 9d4aa4983a
commit 8e27794124
2 changed files with 71 additions and 0 deletions

View File

@ -6,6 +6,11 @@ distributed as part of WA releases.
Scripts
-------
:check_apk_versions: Compares WA workload versions with the versions listed in APK
if there are any incistency it will highlight these. This
requires all APK files to be present for workloads with
versions.
:clean_install: Performs a clean install of WA from source. This will remove any
existing WA install (regardless of whether it was made from
source or through a tarball with pip).

View File

@ -0,0 +1,66 @@
#!/usr/bin/env python
import os
from distutils.version import StrictVersion
from wlauto.core.extension_loader import ExtensionLoader
from wlauto.common.android.workload import ApkWorkload
from wlauto.utils.android import ApkInfo
el = ExtensionLoader()
class fake_config(object):
def __init__(self, ext_loader):
self.ext_loader = ext_loader
self.get_extension = ext_loader.get_extension
class fake_device(object):
platform = "android"
config = fake_config(el)
device = fake_device()
if "WA_USER_DIRECTORY" in os.environ:
base_path = os.environ["WA_USER_DIRECTORY"]
else:
base_path = "~/.workload_automation/dependencies/"
apk_workloads = [e for e in el.list_workloads()
if issubclass(el.get_extension_class(e.name), ApkWorkload)]
for wl in apk_workloads:
# Get versions from workloads
workload_versions = []
for p in wl.parameters:
if p.name == "version" and p.allowed_values:
workload_versions = p.allowed_values
break
else:
continue
dep_path = os.path.join(os.path.expanduser(base_path), wl.name)
apks = [apk for apk in os.listdir(dep_path) if apk.endswith(".apk")]
# Get versions from APK files
apk_versions = []
for apk in apks:
# skip antutu 3d benchmark apk
if apk == "com.antutu.benchmark.full-1.apk":
continue
apk_versions.append(ApkInfo(os.path.join(dep_path, apk)).version_name)
# Output workload info
print "Workload: {}".format(wl.name)
print "Workload Versions: {}".format(sorted(workload_versions, key=StrictVersion))
print "APK versions: {}".format(sorted(apk_versions, key=StrictVersion))
# Check for bad/missing versions
error = False
for v in apk_versions:
if v not in workload_versions:
msg = "APK version '{}' not present in workload list of versions"
print msg.format(v)
error = True
if not error:
print "OK"