2018-07-04 15:39:44 +01:00
|
|
|
# Copyright 2014-2018 ARM Limited
|
2018-03-07 09:22:36 +00:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
import re
|
|
|
|
|
2018-03-13 17:13:33 +00:00
|
|
|
from wa import ApkUiautoWorkload, WorkloadError
|
2018-03-07 09:22:36 +00:00
|
|
|
|
2018-07-03 13:23:16 +01:00
|
|
|
|
2018-03-07 09:22:36 +00:00
|
|
|
class Antutu(ApkUiautoWorkload):
|
|
|
|
|
|
|
|
name = 'antutu'
|
|
|
|
package_names = ['com.antutu.ABenchMark']
|
2018-03-13 17:13:33 +00:00
|
|
|
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 (.+)')]
|
2018-03-07 09:22:36 +00:00
|
|
|
description = '''
|
2018-03-13 17:13:33 +00:00
|
|
|
Executes Antutu 3D, UX, CPU and Memory tests
|
2018-03-07 09:22:36 +00:00
|
|
|
|
|
|
|
Test description:
|
|
|
|
1. Open Antutu application
|
|
|
|
2. Execute Antutu benchmark
|
|
|
|
|
|
|
|
Known working APK version: 7.0.4
|
|
|
|
'''
|
|
|
|
|
|
|
|
def update_output(self, context):
|
|
|
|
super(Antutu, self).update_output(context)
|
|
|
|
expected_results = len(self.regex_matches)
|
|
|
|
logcat_file = context.get_artifact_path('logcat')
|
|
|
|
with open(logcat_file) as fh:
|
2018-03-13 17:13:33 +00:00
|
|
|
for line in fh:
|
2018-03-07 09:22:36 +00:00
|
|
|
for regex in self.regex_matches:
|
|
|
|
match = regex.search(line)
|
2018-03-13 17:13:33 +00:00
|
|
|
if match:
|
|
|
|
try:
|
|
|
|
result = float(match.group(1))
|
|
|
|
except ValueError:
|
2018-07-09 15:28:22 +01:00
|
|
|
result = float('NaN')
|
2018-03-07 09:22:36 +00:00
|
|
|
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))
|