mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-30 22:54:18 +00:00 
			
		
		
		
	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'
This commit is contained in:
		| @@ -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)) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user