mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 00:52:08 +00:00 
			
		
		
		
	Fixes for Reader/Gmail/Photos
Check in missing UiAutomation .class files Fix generation and deletion of dump sys logs including renaming to a standard [test tag]_[test number].log format Improved Reader to run across a range of devices with subtlety different layouts and views
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								wlauto/common/android/UxPerfUiAutomation$GestureTestParams.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								wlauto/common/android/UxPerfUiAutomation$GestureTestParams.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -66,30 +66,29 @@ class Gmail(AndroidUiAutoBenchmark):
 | 
			
		||||
    def update_result(self, context):
 | 
			
		||||
        super(Gmail, self).update_result(context)
 | 
			
		||||
 | 
			
		||||
        if self.dumpsys_enabled:
 | 
			
		||||
            self.device.pull_file(self.output_file, context.output_directory)
 | 
			
		||||
            result_file = os.path.join(context.output_directory, self.instrumentation_log)
 | 
			
		||||
        self.device.pull_file(self.output_file, context.output_directory)
 | 
			
		||||
        result_file = os.path.join(context.output_directory, self.instrumentation_log)
 | 
			
		||||
 | 
			
		||||
            with open(result_file, 'r') as wfh:
 | 
			
		||||
                regex = re.compile(r'(?P<key>\w+)\s+(?P<value1>\d+)\s+(?P<value2>\d+)\s+(?P<value3>\d+)')
 | 
			
		||||
                for line in wfh:
 | 
			
		||||
                    match = regex.search(line)
 | 
			
		||||
                    if match:
 | 
			
		||||
                        context.result.add_metric((match.group('key') + "_start"),
 | 
			
		||||
                                                  match.group('value1'))
 | 
			
		||||
                        context.result.add_metric((match.group('key') + "_finish"),
 | 
			
		||||
                                                  match.group('value2'))
 | 
			
		||||
                        context.result.add_metric((match.group('key') + "_duration"),
 | 
			
		||||
                                                  match.group('value3'))
 | 
			
		||||
        with open(result_file, 'r') as wfh:
 | 
			
		||||
            regex = re.compile(r'(?P<key>\w+)\s+(?P<value1>\d+)\s+(?P<value2>\d+)\s+(?P<value3>\d+)')
 | 
			
		||||
            for line in wfh:
 | 
			
		||||
                match = regex.search(line)
 | 
			
		||||
                if match:
 | 
			
		||||
                    context.result.add_metric((match.group('key') + "_start"),
 | 
			
		||||
                                              match.group('value1'))
 | 
			
		||||
                    context.result.add_metric((match.group('key') + "_finish"),
 | 
			
		||||
                                              match.group('value2'))
 | 
			
		||||
                    context.result.add_metric((match.group('key') + "_duration"),
 | 
			
		||||
                                              match.group('value3'))
 | 
			
		||||
 | 
			
		||||
    def teardown(self, context):
 | 
			
		||||
        super(Gmail, self).teardown(context)
 | 
			
		||||
 | 
			
		||||
        for file in self.device.listdir(self.device.working_directory):
 | 
			
		||||
            if file.startswith (self.name) and file.endswith(".log"):
 | 
			
		||||
            if file.endswith(".log"):
 | 
			
		||||
                self.device.pull_file(os.path.join(self.device.working_directory, file), context.output_directory)
 | 
			
		||||
                self.device.delete_file(os.path.join(self.device.working_directory, file))
 | 
			
		||||
            if file.startswith (self.name) and file.endswith(".jpg"):
 | 
			
		||||
            if file.endswith(".jpg"):
 | 
			
		||||
                self.device.delete_file(os.path.join(self.device.working_directory, file))
 | 
			
		||||
 | 
			
		||||
        # Force a re-index of the mediaserver cache to pick up new files
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -20,12 +20,14 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
    public static String TAG = "uxperf_googlephotos";
 | 
			
		||||
 | 
			
		||||
    public Bundle parameters;
 | 
			
		||||
    private long viewTimeout =  TimeUnit.SECONDS.toMillis(10);
 | 
			
		||||
    private int viewTimeoutSecs = 10;
 | 
			
		||||
    private long viewTimeout =  TimeUnit.SECONDS.toMillis(viewTimeoutSecs);
 | 
			
		||||
    private LinkedHashMap<String, Timer> timingResults = new LinkedHashMap<String, Timer>();
 | 
			
		||||
 | 
			
		||||
    public void runUiAutomation() throws Exception {
 | 
			
		||||
        parameters = getParams();
 | 
			
		||||
 | 
			
		||||
        confirmLocalFileAccess();
 | 
			
		||||
        dismissWelcomeView();
 | 
			
		||||
        gesturesTest();
 | 
			
		||||
        editPhotoTest();
 | 
			
		||||
@@ -33,16 +35,31 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
        writeResultsToFile(timingResults, parameters.getString("output_file"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void confirmLocalFileAccess() throws Exception {
 | 
			
		||||
        // First time run requires confirmation to allow access to local files
 | 
			
		||||
        UiObject allowButton = new UiObject(new UiSelector().textContains("Allow")
 | 
			
		||||
                                                            .className("android.widget.Button"));
 | 
			
		||||
        if (allowButton.waitForExists(timeout)) {
 | 
			
		||||
            allowButton.clickAndWaitForNewWindow(timeout);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private void dismissWelcomeView() throws Exception {
 | 
			
		||||
 | 
			
		||||
        // Click through the first two pages and make sure that we don't sign
 | 
			
		||||
        // in to our google account. This ensures the same set of photographs
 | 
			
		||||
        // are placed in the camera directory for each run.
 | 
			
		||||
 | 
			
		||||
        sleep(3); // Pause while splash screen loads
 | 
			
		||||
        sleep(5); // Pause while splash screen loads
 | 
			
		||||
 | 
			
		||||
        UiObject getStartedButton =
 | 
			
		||||
            getUiObjectByResourceId("com.google.android.apps.photos:id/get_started",
 | 
			
		||||
                                    "android.widget.Button");
 | 
			
		||||
            new UiObject (new UiSelector().textContains("Get started")
 | 
			
		||||
                                          .className("android.widget.Button"));
 | 
			
		||||
 | 
			
		||||
        tapDisplayCentre();
 | 
			
		||||
        waitObject(getStartedButton, 10);
 | 
			
		||||
 | 
			
		||||
        getStartedButton.clickAndWaitForNewWindow();
 | 
			
		||||
 | 
			
		||||
        UiObject welcomeButton =
 | 
			
		||||
@@ -78,7 +95,6 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
        testParams.put("pinch_out", new GestureTestParams(GestureType.PINCH, PinchType.OUT, 100, 50));
 | 
			
		||||
        testParams.put("pinch_in", new GestureTestParams(GestureType.PINCH, PinchType.IN, 100, 50));
 | 
			
		||||
        testParams.put("swipe_right", new GestureTestParams(GestureType.UIDEVICE_SWIPE, Direction.RIGHT, 10));
 | 
			
		||||
        testParams.put("swipe_up", new GestureTestParams(GestureType.UIDEVICE_SWIPE, Direction.UP, 10));
 | 
			
		||||
 | 
			
		||||
        Iterator<Entry<String, GestureTestParams>> it = testParams.entrySet().iterator();
 | 
			
		||||
 | 
			
		||||
@@ -128,6 +144,10 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
 | 
			
		||||
            timingResults.put(runName, results);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        UiObject navigateUpButton =
 | 
			
		||||
            getUiObjectByDescription("Navigate Up", "android.widget.ImageButton");
 | 
			
		||||
        navigateUpButton.click();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void editPhotoTest() throws Exception {
 | 
			
		||||
 
 | 
			
		||||
@@ -65,21 +65,20 @@ class Reader(AndroidUiAutoBenchmark):
 | 
			
		||||
    def update_result(self, context):
 | 
			
		||||
        super(Reader, self).update_result(context)
 | 
			
		||||
 | 
			
		||||
        if self.dumpsys_enabled:
 | 
			
		||||
            self.device.pull_file(self.output_file, context.output_directory)
 | 
			
		||||
            result_file = os.path.join(context.output_directory, self.instrumentation_log)
 | 
			
		||||
        self.device.pull_file(self.output_file, context.output_directory)
 | 
			
		||||
        result_file = os.path.join(context.output_directory, self.instrumentation_log)
 | 
			
		||||
 | 
			
		||||
            with open(result_file, 'r') as wfh:
 | 
			
		||||
                regex = re.compile(r'(?P<key>\w+)\s+(?P<value1>\d+)\s+(?P<value2>\d+)\s+(?P<value3>\d+)')
 | 
			
		||||
                for line in wfh:
 | 
			
		||||
                    match = regex.search(line)
 | 
			
		||||
                    if match:
 | 
			
		||||
                        context.result.add_metric((match.group('key') + "_start"),
 | 
			
		||||
                                                  match.group('value1'))
 | 
			
		||||
                        context.result.add_metric((match.group('key') + "_finish"),
 | 
			
		||||
                                                  match.group('value2'))
 | 
			
		||||
                        context.result.add_metric((match.group('key') + "_duration"),
 | 
			
		||||
                                                  match.group('value3'))
 | 
			
		||||
        with open(result_file, 'r') as wfh:
 | 
			
		||||
            regex = re.compile(r'(?P<key>\w+)\s+(?P<value1>\d+)\s+(?P<value2>\d+)\s+(?P<value3>\d+)')
 | 
			
		||||
            for line in wfh:
 | 
			
		||||
                match = regex.search(line)
 | 
			
		||||
                if match:
 | 
			
		||||
                    context.result.add_metric((match.group('key') + "_start"),
 | 
			
		||||
                                              match.group('value1'))
 | 
			
		||||
                    context.result.add_metric((match.group('key') + "_finish"),
 | 
			
		||||
                                              match.group('value2'))
 | 
			
		||||
                    context.result.add_metric((match.group('key') + "_duration"),
 | 
			
		||||
                                              match.group('value3'))
 | 
			
		||||
 | 
			
		||||
    def teardown(self, context):
 | 
			
		||||
        super(Reader, self).teardown(context)
 | 
			
		||||
@@ -88,6 +87,6 @@ class Reader(AndroidUiAutoBenchmark):
 | 
			
		||||
                self.device.delete_file(os.path.join(self.reader_local_dir, file))
 | 
			
		||||
 | 
			
		||||
        for file in self.device.listdir(self.device.working_directory):
 | 
			
		||||
            if file.startswith (self.name) and file.endswith(".log"):
 | 
			
		||||
            if file.endswith(".log"):
 | 
			
		||||
                self.device.pull_file(os.path.join(self.device.working_directory, file), context.output_directory)
 | 
			
		||||
                self.device.delete_file(os.path.join(self.device.working_directory, file))
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@@ -227,7 +227,7 @@ public class UiAutomation extends UxPerfUiAutomation {
 | 
			
		||||
            int percent = pair.getValue().percent;
 | 
			
		||||
 | 
			
		||||
            String runName = String.format(TestTag + "_" + pair.getKey());
 | 
			
		||||
            String gfxInfologName =  String.format(TAG + "_" + runName + "_gfxInfo.log");
 | 
			
		||||
            String gfxInfologName =  String.format(runName + "_gfxInfo.log");
 | 
			
		||||
            String surfFlingerlogName =  String.format(runName + "_surfFlinger.log");
 | 
			
		||||
            String viewName = new String("com.adobe.reader.viewer.ARViewerActivity");
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user