diff options
author | Marc Bonnici <marc.bonnici@arm.com> | 2018-03-13 17:13:33 +0000 |
---|---|---|
committer | setrofim <setrofim@gmail.com> | 2018-03-15 12:33:17 +0000 |
commit | 6742c5c8ad8fee9ff76d2c5a4e441f606c410c8f (patch) | |
tree | 5abb8c3f8bb5c7d496e03ff6c21bedf3e77dd732 | |
parent | 811dfbe5aff7dc851803c2727f7dd93a1f5ffac3 (diff) |
workloads/antutu: Allow for unsupported tests
Not all benchmarks are available on all phones and will report "Not
supported" To allow for this update the regexes and if not a valid score
set any unsupported results to 'NaN'
-rwxr-xr-x | wa/workloads/antutu/__init__.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/wa/workloads/antutu/__init__.py b/wa/workloads/antutu/__init__.py index 15aea771..a5724bda 100755 --- a/wa/workloads/antutu/__init__.py +++ b/wa/workloads/antutu/__init__.py @@ -14,26 +14,26 @@ # import re -from wa import ApkUiautoWorkload +from wa import ApkUiautoWorkload, WorkloadError class Antutu(ApkUiautoWorkload): name = 'antutu' package_names = ['com.antutu.ABenchMark'] - regex_matches = [re.compile(r'CPU Maths Score ([\d.]+)'), - re.compile(r'CPU Common Score ([\d.]+)'), - re.compile(r'CPU Multi Score ([\d.]+)'), - re.compile(r'GPU Marooned Score ([\d.]+)'), - re.compile(r'GPU Coastline Score ([\d.]+)'), - re.compile(r'GPU Refinery Score ([\d.]+)'), - re.compile(r'Data Security Score ([\d.]+)'), - re.compile(r'Data Processing Score ([\d.]+)'), - re.compile(r'Image Processing Score ([\d.]+)'), - re.compile(r'User Experience Score ([\d.]+)'), - re.compile(r'RAM Score ([\d.]+)'), - re.compile(r'ROM Score ([\d.]+)')] + regex_matches = [re.compile(r'CPU Maths Score (.+)'), + re.compile(r'CPU Common Score (.+)'), + re.compile(r'CPU Multi Score (.+)'), + re.compile(r'GPU Marooned Score (.+)'), + re.compile(r'GPU Coastline Score (.+)'), + re.compile(r'GPU Refinery Score (.+)'), + re.compile(r'Data Security Score (.+)'), + re.compile(r'Data Processing Score (.+)'), + re.compile(r'Image Processing Score (.+)'), + re.compile(r'User Experience Score (.+)'), + re.compile(r'RAM Score (.+)'), + re.compile(r'ROM Score (.+)')] description = ''' - Executes Antutu 3D, UX, CPU and Memory tests + Executes Antutu 3D, UX, CPU and Memory tests Test description: 1. Open Antutu application @@ -47,15 +47,17 @@ class Antutu(ApkUiautoWorkload): expected_results = len(self.regex_matches) logcat_file = context.get_artifact_path('logcat') with open(logcat_file) as fh: - for line in fh: + for line in fh: for regex in self.regex_matches: match = regex.search(line) - if match: - result = float(match.group(1)) + if match: + try: + result = float(match.group(1)) + except ValueError: + result = 'NaN' entry = regex.pattern.rsplit(None, 1)[0] context.add_metric(entry, result, lower_is_better=False) expected_results -= 1 if expected_results > 0: msg = "The Antutu workload has failed. Expected {} scores, Detected {} scores." raise WorkloadError(msg.format(len(self.regex_matches), expected_results)) - |