mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 00:52:08 +00:00 
			
		
		
		
	Antutu: New antutu workload for the 7.0.4 version
This commit is contained in:
		
							
								
								
									
										61
									
								
								wa/workloads/antutu/__init__.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										61
									
								
								wa/workloads/antutu/__init__.py
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					#    Copyright 2014-2016 ARM Limited
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from wa import ApkUiautoWorkload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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.]+)')]
 | 
				
			||||||
 | 
					    description = '''
 | 
				
			||||||
 | 
					    Executes Antutu 3D, UX, CPU and Memory tests 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    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:
 | 
				
			||||||
 | 
					            for line in fh: 
 | 
				
			||||||
 | 
					                for regex in self.regex_matches:
 | 
				
			||||||
 | 
					                    match = regex.search(line)
 | 
				
			||||||
 | 
					                    if match: 
 | 
				
			||||||
 | 
					                        result = float(match.group(1))
 | 
				
			||||||
 | 
					                        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))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								wa/workloads/antutu/com.arm.wa.uiauto.antutu.apk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								wa/workloads/antutu/com.arm.wa.uiauto.antutu.apk
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -0,0 +1,131 @@
 | 
				
			|||||||
 | 
					/*    Copyright 2013-2015 ARM Limited
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 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.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package com.arm.wa.uiauto.antutu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.app.Activity;
 | 
				
			||||||
 | 
					import android.os.Bundle;
 | 
				
			||||||
 | 
					import android.support.test.runner.AndroidJUnit4;
 | 
				
			||||||
 | 
					import android.support.test.uiautomator.UiObject;
 | 
				
			||||||
 | 
					import android.support.test.uiautomator.UiObjectNotFoundException;
 | 
				
			||||||
 | 
					import android.support.test.uiautomator.UiScrollable;
 | 
				
			||||||
 | 
					import android.support.test.uiautomator.UiSelector;
 | 
				
			||||||
 | 
					import android.util.Log;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.arm.wa.uiauto.BaseUiAutomation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.junit.Test;
 | 
				
			||||||
 | 
					import org.junit.runner.RunWith;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.HashSet;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					import java.util.concurrent.TimeUnit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@RunWith(AndroidJUnit4.class)
 | 
				
			||||||
 | 
					public class UiAutomation extends BaseUiAutomation {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static String TAG = "UXPERF";
 | 
				
			||||||
 | 
					    public static String TestButton5 = "com.antutu.ABenchMark:id/start_test_region";
 | 
				
			||||||
 | 
					    public static String TestButton6 = "com.antutu.ABenchMark:id/start_test_text";
 | 
				
			||||||
 | 
					    private static int initialTimeoutSeconds = 20;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    public void runWorkload() throws Exception{
 | 
				
			||||||
 | 
					        hitTest();
 | 
				
			||||||
 | 
					        waitforCompletion();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    public void extractResults() throws Exception{
 | 
				
			||||||
 | 
					        getScores();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void hitTest() throws Exception {
 | 
				
			||||||
 | 
					        UiObject testbutton = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().resourceId("com.antutu.ABenchMark:id/main_test_start_title"));
 | 
				
			||||||
 | 
					        testbutton.click();
 | 
				
			||||||
 | 
					        sleep(1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void waitforCompletion() throws Exception {
 | 
				
			||||||
 | 
					        UiObject totalScore =
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().resourceId("com.antutu.ABenchMark:id/textViewTotalScore"));
 | 
				
			||||||
 | 
					        totalScore.waitForExists(600000);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void getScores() throws Exception {
 | 
				
			||||||
 | 
					        //Expand, Extract and Close CPU sub scores
 | 
				
			||||||
 | 
					        UiObject cpuscores = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("CPU"));
 | 
				
			||||||
 | 
					        cpuscores.click();
 | 
				
			||||||
 | 
					        UiObject cpumaths = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("CPU Mathematics Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        UiObject cpucommon = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("CPU Common Use Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        UiObject cpumulti = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("CPU Multi-Core Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        Log.d(TAG, "CPU Maths Score " + cpumaths.getText());
 | 
				
			||||||
 | 
					        Log.d(TAG, "CPU Common Score " + cpucommon.getText());
 | 
				
			||||||
 | 
					        Log.d(TAG, "CPU Multi Score " + cpumulti.getText());
 | 
				
			||||||
 | 
					        cpuscores.click();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Expand, Extract and Close GPU sub scores
 | 
				
			||||||
 | 
					        UiObject gpuscores = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("GPU"));
 | 
				
			||||||
 | 
					        gpuscores.click();
 | 
				
			||||||
 | 
					        UiObject gpumaroon = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("3D [Marooned] Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        UiObject gpucoast = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("3D [Coastline] Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        UiObject gpurefinery = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("3D [Refinery] Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        Log.d(TAG, "GPU Marooned Score " + gpumaroon.getText());
 | 
				
			||||||
 | 
					        Log.d(TAG, "GPU Coastline Score " + gpucoast.getText());
 | 
				
			||||||
 | 
					        Log.d(TAG, "GPU Refinery Score " + gpurefinery.getText());
 | 
				
			||||||
 | 
					        gpuscores.click();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Expand, Extract and Close UX sub scores
 | 
				
			||||||
 | 
					        UiObject uxscores = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("UX"));
 | 
				
			||||||
 | 
					        uxscores.click();
 | 
				
			||||||
 | 
					        UiObject security = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("Data Security Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        UiObject dataprocessing = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("Data Processing Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        UiObject imageprocessing = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("Image Processing Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        UiObject uxscore = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("User Experience Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        Log.d(TAG, "Data Security Score " + security.getText());
 | 
				
			||||||
 | 
					        Log.d(TAG, "Data Processing Score " + dataprocessing.getText());
 | 
				
			||||||
 | 
					        Log.d(TAG, "Image Processing Score " + imageprocessing.getText());
 | 
				
			||||||
 | 
					        Log.d(TAG, "User Experience Score " + uxscore.getText());
 | 
				
			||||||
 | 
					        uxscores.click();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Expand, Extract and Close MEM sub scores
 | 
				
			||||||
 | 
					        UiObject memscores = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("MEM"));
 | 
				
			||||||
 | 
					        memscores.click();
 | 
				
			||||||
 | 
					        UiObject ramscore = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("RAM Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        UiObject romscore = 
 | 
				
			||||||
 | 
					            mDevice.findObject(new UiSelector().text("ROM Score").fromParent(new UiSelector().index(3)));
 | 
				
			||||||
 | 
					        Log.d(TAG, "RAM Score " + ramscore.getText());
 | 
				
			||||||
 | 
					        Log.d(TAG, "ROM Score " + romscore.getText());
 | 
				
			||||||
 | 
					        memscores.click();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user